Skip to content

Commit 76c8997

Browse files
committed
style: break long lines
1 parent 7d4e0eb commit 76c8997

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

system/Validation/Rules.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ public function greater_than_equal_to(?string $str, string $min): bool
8686
public function is_not_unique(?string $str, string $field, array $data): bool
8787
{
8888
// Grab any data for exclusion of a single row.
89-
[$field, $whereField, $whereValue] = array_pad(explode(',', $field), 3, null);
89+
[$field, $whereField, $whereValue] = array_pad(
90+
explode(',', $field),
91+
3,
92+
null
93+
);
9094

9195
// Break the table and field apart
9296
sscanf($field, '%[^.].%[^.]', $table, $field);
@@ -97,7 +101,10 @@ public function is_not_unique(?string $str, string $field, array $data): bool
97101
->where($field, $str)
98102
->limit(1);
99103

100-
if (! empty($whereField) && ! empty($whereValue) && ! preg_match('/^\{(\w+)\}$/', $whereValue)) {
104+
if (
105+
! empty($whereField) && ! empty($whereValue)
106+
&& ! preg_match('/^\{(\w+)\}$/', $whereValue)
107+
) {
101108
$row = $row->where($whereField, $whereValue);
102109
}
103110

@@ -125,7 +132,11 @@ public function in_list(?string $value, string $list): bool
125132
*/
126133
public function is_unique(?string $str, string $field, array $data): bool
127134
{
128-
[$field, $ignoreField, $ignoreValue] = array_pad(explode(',', $field), 3, null);
135+
[$field, $ignoreField, $ignoreValue] = array_pad(
136+
explode(',', $field),
137+
3,
138+
null
139+
);
129140

130141
sscanf($field, '%[^.].%[^.]', $table, $field);
131142

@@ -135,7 +146,10 @@ public function is_unique(?string $str, string $field, array $data): bool
135146
->where($field, $str)
136147
->limit(1);
137148

138-
if (! empty($ignoreField) && ! empty($ignoreValue) && ! preg_match('/^\{(\w+)\}$/', $ignoreValue)) {
149+
if (
150+
! empty($ignoreField) && ! empty($ignoreValue)
151+
&& ! preg_match('/^\{(\w+)\}$/', $ignoreValue)
152+
) {
139153
$row = $row->where("{$ignoreField} !=", $ignoreValue);
140154
}
141155

system/Validation/StrictRules/Rules.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function is_not_unique($str, string $field, array $data): bool
137137
->where($field, $str)
138138
->limit(1);
139139

140-
if (! empty($whereField) && ! empty($whereValue) && ! preg_match('/^\{(\w+)\}$/', $whereValue)) {
140+
if (
141+
! empty($whereField) && ! empty($whereValue)
142+
&& ! preg_match('/^\{(\w+)\}$/', $whereValue)
143+
) {
141144
$row = $row->where($whereField, $whereValue);
142145
}
143146

@@ -193,7 +196,10 @@ public function is_unique($str, string $field, array $data): bool
193196
->where($field, $str)
194197
->limit(1);
195198

196-
if (! empty($ignoreField) && ! empty($ignoreValue) && ! preg_match('/^\{(\w+)\}$/', $ignoreValue)) {
199+
if (
200+
! empty($ignoreField) && ! empty($ignoreValue)
201+
&& ! preg_match('/^\{(\w+)\}$/', $ignoreValue)
202+
) {
197203
$row = $row->where("{$ignoreField} !=", $ignoreValue);
198204
}
199205

0 commit comments

Comments
 (0)