@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | /** |
| 4 | 4 | * /src/Utils/JSON.php |
| 5 | 5 | * |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $options ??= 0; |
| 41 | 41 | $depth ??= 512; |
| 42 | 42 | |
| 43 | - return json_encode($input, JSON_THROW_ON_ERROR | $options, $depth); |
|
| 43 | + return json_encode($input, JSON_THROW_ON_ERROR|$options, $depth); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -63,6 +63,6 @@ discard block |
||
| 63 | 63 | $depth ??= 512; |
| 64 | 64 | $options ??= 0; |
| 65 | 65 | |
| 66 | - return json_decode($json, $assoc, $depth, JSON_THROW_ON_ERROR | $options); |
|
| 66 | + return json_decode($json, $assoc, $depth, JSON_THROW_ON_ERROR|$options); |
|
| 67 | 67 | } |
| 68 | 68 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | /** |
| 4 | 4 | * /src/Rest/SearchTerm.php |
| 5 | 5 | * |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | final class SearchTerm implements SearchTermInterface |
| 34 | 34 | { |
| 35 | 35 | public static function getCriteria( |
| 36 | - array | string | null $column, |
|
| 37 | - array | string | null $search, |
|
| 36 | + array|string|null $column, |
|
| 37 | + array|string|null $search, |
|
| 38 | 38 | ?string $operand = null, |
| 39 | 39 | ?int $mode = null, |
| 40 | 40 | ): ?array { |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | private static function getTermIterator(array $columns, int $mode): Closure |
| 96 | 96 | { |
| 97 | - return static fn (string $term): ?array => empty($columns) |
|
| 97 | + return static fn(string $term): ?array => empty($columns) |
|
| 98 | 98 | ? null |
| 99 | 99 | : array_map(self::getColumnIterator($term, $mode), $columns); |
| 100 | 100 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @return array<int, string> |
| 113 | 113 | */ |
| 114 | - return static fn (string $column): array => [ |
|
| 114 | + return static fn(string $column): array => [ |
|
| 115 | 115 | str_contains($column, '.') ? $column : 'entity.' . $column, 'like', self::getTerm($mode, $term), |
| 116 | 116 | ]; |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private static function getTerm(int $mode, string $term): string |
| 123 | 123 | { |
| 124 | - return match ($mode) { |
|
| 124 | + return match($mode) { |
|
| 125 | 125 | self::MODE_STARTS_WITH => $term . '%', |
| 126 | 126 | self::MODE_ENDS_WITH => '%' . $term, |
| 127 | 127 | default => '%' . $term . '%', // self::MODE_FULL |
@@ -134,12 +134,12 @@ discard block |
||
| 134 | 134 | * |
| 135 | 135 | * @return array<int, string> |
| 136 | 136 | */ |
| 137 | - private static function getColumns(array | string | null $column): array |
|
| 137 | + private static function getColumns(array|string|null $column): array |
|
| 138 | 138 | { |
| 139 | 139 | // Normalize column and search parameters |
| 140 | 140 | return array_filter( |
| 141 | 141 | array_map('trim', (is_array($column) ? $column : (array)(string)$column)), |
| 142 | - static fn (string $value): bool => trim($value) !== '' |
|
| 142 | + static fn(string $value) : bool => trim($value) !== '' |
|
| 143 | 143 | ); |
| 144 | 144 | } |
| 145 | 145 | |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return array<int, string> |
| 152 | 152 | */ |
| 153 | - private static function getSearchTerms(array | string | null $search): array |
|
| 153 | + private static function getSearchTerms(array|string|null $search): array |
|
| 154 | 154 | { |
| 155 | 155 | if (is_string($search)) { |
| 156 | 156 | preg_match_all('#([^\"]\S*|\".+?\")\s*#', trim($search), $matches); |
| 157 | 157 | |
| 158 | 158 | if ($matches[1]) { |
| 159 | 159 | $search = array_map( |
| 160 | - static fn (string $term): string => trim(str_replace('"', '', $term)), |
|
| 160 | + static fn(string $term): string => trim(str_replace('"', '', $term)), |
|
| 161 | 161 | $matches[1], |
| 162 | 162 | ); |
| 163 | 163 | } |
@@ -166,10 +166,10 @@ discard block |
||
| 166 | 166 | return array_unique( |
| 167 | 167 | array_filter( |
| 168 | 168 | array_map( |
| 169 | - static fn (string $term): string => (string)preg_replace('#\s+#', ' ', $term), |
|
| 169 | + static fn(string $term): string => (string)preg_replace('#\s+#', ' ', $term), |
|
| 170 | 170 | array_map('trim', (is_array($search) ? $search : explode(' ', (string)$search))), |
| 171 | 171 | ), |
| 172 | - static fn (string $value): bool => trim($value) !== '' |
|
| 172 | + static fn(string $value) : bool => trim($value) !== '' |
|
| 173 | 173 | ) |
| 174 | 174 | ); |
| 175 | 175 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | /** |
| 4 | 4 | * /src/Rest/RepositoryHelper.php |
| 5 | 5 | * |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | private static function processExpression(QueryBuilder $queryBuilder, Composite $expression, array $criteria): void |
| 250 | 250 | { |
| 251 | - $iterator = static function (array $comparison, string | int $key) use ($queryBuilder, $expression): void { |
|
| 251 | + $iterator = static function (array $comparison, string|int $key) use ($queryBuilder, $expression): void { |
|
| 252 | 252 | $expressionAnd = ($key === 'and' || array_key_exists('and', $comparison)); |
| 253 | 253 | $expressionOr = ($key === 'or' || array_key_exists('or', $comparison)); |
| 254 | 254 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return array{0: string, 1: string, 2: string|array<int, string>} |
| 294 | 294 | */ |
| 295 | - private static function createCriteria(string $column, string | array $value): array |
|
| 295 | + private static function createCriteria(string $column, string|array $value): array |
|
| 296 | 296 | { |
| 297 | 297 | if (!str_contains($column, '.')) { |
| 298 | 298 | $column = 'entity.' . $column; |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | } else { |
| 357 | 357 | // Otherwise this must be IN or NOT IN expression |
| 358 | 358 | try { |
| 359 | - $value = array_map(static fn (string $value): string => UuidHelper::getBytes($value), $value); |
|
| 359 | + $value = array_map(static fn(string $value): string => UuidHelper::getBytes($value), $value); |
|
| 360 | 360 | } catch (InvalidUuidStringException) { |
| 361 | 361 | // Ok so value isn't list of UUIDs |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | $parameters[] = array_map( |
| 365 | - static fn (string $value): Literal => $queryBuilder->expr()->literal( |
|
| 365 | + static fn(string $value): Literal => $queryBuilder->expr()->literal( |
|
| 366 | 366 | is_numeric($value) ? (int)$value : $value |
| 367 | 367 | ), |
| 368 | 368 | $value |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | private static function getIterator(array &$condition): Closure |
| 379 | 379 | { |
| 380 | - return static function (string | array $value, string $column) use (&$condition): void { |
|
| 380 | + return static function (string|array $value, string $column) use (&$condition): void { |
|
| 381 | 381 | // If criteria contains 'and' OR 'or' key(s) assume that array in only in the right format |
| 382 | 382 | if (strcmp($column, 'and') === 0 || strcmp($column, 'or') === 0) { |
| 383 | 383 | $condition[$column] = $value; |