@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function parseValue($value) |
39 | 39 | { |
40 | 40 | if (!is_string($value) || !filter_var($value, FILTER_VALIDATE_URL)) { // quite naive, but after all this is example |
41 | - throw new \UnexpectedValueException('Cannot represent value as URL: ' . Utils::printSafe($value)); |
|
41 | + throw new \UnexpectedValueException('Cannot represent value as URL: '.Utils::printSafe($value)); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return $value; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | // Note: throwing GraphQL\Error\Error vs \UnexpectedValueException to benefit from GraphQL |
58 | 58 | // error location in query: |
59 | 59 | if (!($ast instanceof StringValueNode)) { |
60 | - throw new Error('Query error: Can only parse strings got: ' . $ast->kind, [$ast]); |
|
60 | + throw new Error('Query error: Can only parse strings got: '.$ast->kind, [$ast]); |
|
61 | 61 | } |
62 | 62 | if (!is_string($ast->value) || !filter_var($ast->value, FILTER_VALIDATE_URL)) { |
63 | 63 | throw new Error('Query error: Not a valid URL', [$ast]); |
@@ -60,6 +60,6 @@ |
||
60 | 60 | */ |
61 | 61 | public function sendCli(ExecutionResult $result): void |
62 | 62 | { |
63 | - echo json_encode($result, JSON_PRETTY_PRINT) . PHP_EOL; |
|
63 | + echo json_encode($result, JSON_PRETTY_PRINT).PHP_EOL; |
|
64 | 64 | } |
65 | 65 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | $config = [ |
15 | 15 | 'query' => _types()->get(QueryType::class), |
16 | 16 | 'mutation' => _types()->get(MutationType::class), |
17 | - 'typeLoader' => function ($name) { |
|
17 | + 'typeLoader' => function($name) { |
|
18 | 18 | return _types()->get($name); |
19 | 19 | }, |
20 | 20 | ]; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | 'name' => 'viewer', |
17 | 17 | 'type' => _types()->getOutput(User::class), |
18 | 18 | 'description' => 'Represents currently logged-in user', |
19 | - 'resolve' => function ($root, array $args): ?User { |
|
19 | + 'resolve' => function($root, array $args): ?User { |
|
20 | 20 | return User::getCurrent(); |
21 | 21 | }, |
22 | 22 | ]; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | return [ |
39 | 39 | [ |
40 | 40 | 'name' => $plural, |
41 | - 'type' => _types()->get($shortName . 'Pagination'), |
|
41 | + 'type' => _types()->get($shortName.'Pagination'), |
|
42 | 42 | 'args' => $listArgs, |
43 | - 'resolve' => function ($root, array $args) use ($class): array { |
|
43 | + 'resolve' => function($root, array $args) use ($class): array { |
|
44 | 44 | if (($args['filters'] ?? false) && ($args['filter'] ?? false)) { |
45 | 45 | throw new Exception('Cannot use `filter` and `filters` at the same time'); |
46 | 46 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'name' => $name, |
63 | 63 | 'type' => _types()->getOutput($class), |
64 | 64 | 'args' => $singleArgs, |
65 | - 'resolve' => function ($root, array $args): ?AbstractModel { |
|
65 | + 'resolve' => function($root, array $args): ?AbstractModel { |
|
66 | 66 | $object = $args['id']->getEntity(); |
67 | 67 | |
68 | 68 | Helper::throwIfDenied($object, 'read'); |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | |
90 | 90 | return [ |
91 | 91 | [ |
92 | - 'name' => 'create' . $name, |
|
92 | + 'name' => 'create'.$name, |
|
93 | 93 | 'type' => Type::nonNull(_types()->getOutput($class)), |
94 | - 'description' => 'Create a new ' . $name, |
|
94 | + 'description' => 'Create a new '.$name, |
|
95 | 95 | 'args' => [ |
96 | 96 | 'input' => Type::nonNull(_types()->getInput($class)), |
97 | 97 | ], |
98 | - 'resolve' => function ($root, array $args) use ($class, $lowerName): AbstractModel { |
|
98 | + 'resolve' => function($root, array $args) use ($class, $lowerName): AbstractModel { |
|
99 | 99 | // Check ACL |
100 | 100 | $object = new $class(); |
101 | 101 | Helper::throwIfDenied($object, 'create'); |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | }, |
111 | 111 | ], |
112 | 112 | [ |
113 | - 'name' => 'update' . $name, |
|
113 | + 'name' => 'update'.$name, |
|
114 | 114 | 'type' => Type::nonNull(_types()->getOutput($class)), |
115 | - 'description' => 'Update an existing ' . $name, |
|
115 | + 'description' => 'Update an existing '.$name, |
|
116 | 116 | 'args' => [ |
117 | 117 | 'id' => Type::nonNull(_types()->getId($class)), |
118 | 118 | 'input' => Type::nonNull(_types()->getPartialInput($class)), |
119 | 119 | ], |
120 | - 'resolve' => function ($root, array $args) use ($lowerName): AbstractModel { |
|
120 | + 'resolve' => function($root, array $args) use ($lowerName): AbstractModel { |
|
121 | 121 | $object = $args['id']->getEntity(); |
122 | 122 | |
123 | 123 | // Check ACL |
@@ -133,13 +133,13 @@ discard block |
||
133 | 133 | }, |
134 | 134 | ], |
135 | 135 | [ |
136 | - 'name' => 'delete' . $plural, |
|
136 | + 'name' => 'delete'.$plural, |
|
137 | 137 | 'type' => Type::nonNull(Type::boolean()), |
138 | - 'description' => 'Delete one or several existing ' . $name, |
|
138 | + 'description' => 'Delete one or several existing '.$name, |
|
139 | 139 | 'args' => [ |
140 | 140 | 'ids' => Type::nonNull(Type::listOf(Type::nonNull(_types()->getId($class)))), |
141 | 141 | ], |
142 | - 'resolve' => function ($root, array $args) use ($lowerName): bool { |
|
142 | + 'resolve' => function($root, array $args) use ($lowerName): bool { |
|
143 | 143 | foreach ($args['ids'] as $id) { |
144 | 144 | $object = $id->getEntity(); |
145 | 145 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | return [ |
191 | 191 | [ |
192 | - 'name' => 'link' . $ownerName . $otherName, |
|
192 | + 'name' => 'link'.$ownerName.$otherName, |
|
193 | 193 | 'type' => Type::nonNull(_types()->getOutput($ownerClass)), |
194 | - 'description' => 'Create a relation between ' . $ownerName . ' and ' . $otherName . '.' . PHP_EOL . PHP_EOL . |
|
194 | + 'description' => 'Create a relation between '.$ownerName.' and '.$otherName.'.'.PHP_EOL.PHP_EOL. |
|
195 | 195 | 'If the relation already exists, it will have no effect.', |
196 | 196 | 'args' => $args, |
197 | - 'resolve' => function ($root, array $args) use ($lowerOwnerName, $lowerOtherName, $otherName, $otherClass, $byName): AbstractModel { |
|
197 | + 'resolve' => function($root, array $args) use ($lowerOwnerName, $lowerOtherName, $otherName, $otherClass, $byName): AbstractModel { |
|
198 | 198 | $owner = $args[$lowerOwnerName]->getEntity(); |
199 | 199 | if ($byName) { |
200 | 200 | $other = self::getByName($otherClass, $args[$lowerOtherName], true); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | Helper::throwIfDenied($owner, 'update'); |
207 | 207 | |
208 | 208 | // Do it |
209 | - $method = 'add' . $otherName; |
|
209 | + $method = 'add'.$otherName; |
|
210 | 210 | $owner->$method($other); |
211 | 211 | _em()->flush(); |
212 | 212 | |
@@ -214,12 +214,12 @@ discard block |
||
214 | 214 | }, |
215 | 215 | ], |
216 | 216 | [ |
217 | - 'name' => 'unlink' . $ownerName . $otherName, |
|
217 | + 'name' => 'unlink'.$ownerName.$otherName, |
|
218 | 218 | 'type' => Type::nonNull(_types()->getOutput($ownerClass)), |
219 | - 'description' => 'Delete a relation between ' . $ownerName . ' and ' . $otherName . '.' . PHP_EOL . PHP_EOL . |
|
219 | + 'description' => 'Delete a relation between '.$ownerName.' and '.$otherName.'.'.PHP_EOL.PHP_EOL. |
|
220 | 220 | 'If the relation does not exist, it will have no effect.', |
221 | 221 | 'args' => $args, |
222 | - 'resolve' => function ($root, array $args) use ($lowerOwnerName, $lowerOtherName, $otherName, $otherClass, $byName): AbstractModel { |
|
222 | + 'resolve' => function($root, array $args) use ($lowerOwnerName, $lowerOtherName, $otherName, $otherClass, $byName): AbstractModel { |
|
223 | 223 | $owner = $args[$lowerOwnerName]->getEntity(); |
224 | 224 | if ($byName) { |
225 | 225 | $other = self::getByName($otherClass, $args[$lowerOtherName], false); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | |
233 | 233 | // Do it |
234 | 234 | if ($other) { |
235 | - $method = 'remove' . $otherName; |
|
235 | + $method = 'remove'.$otherName; |
|
236 | 236 | $owner->$method($other); |
237 | 237 | _em()->flush(); |
238 | 238 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | private static function makePlural(string $name): string |
277 | 277 | { |
278 | - $plural = $name . 's'; |
|
278 | + $plural = $name.'s'; |
|
279 | 279 | $plural = preg_replace('/ys$/', 'ies', $plural); |
280 | 280 | $plural = preg_replace('/ss$/', 'ses', $plural); |
281 | 281 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | ], |
304 | 304 | ]; |
305 | 305 | |
306 | - $filterTypeClass = 'Old' . $class->getReflectionClass()->getShortName() . 'Filter'; |
|
306 | + $filterTypeClass = 'Old'.$class->getReflectionClass()->getShortName().'Filter'; |
|
307 | 307 | if (_types()->has($filterTypeClass)) { |
308 | 308 | $listArgs[] = [ |
309 | 309 | 'name' => 'filters', |
@@ -17,7 +17,7 @@ |
||
17 | 17 | 'name' => 'logout', |
18 | 18 | 'type' => Type::nonNull(Type::boolean()), |
19 | 19 | 'description' => 'Log out a user', |
20 | - 'resolve' => function ($root, array $args, SessionInterface $session): bool { |
|
20 | + 'resolve' => function($root, array $args, SessionInterface $session): bool { |
|
21 | 21 | |
22 | 22 | // Logout |
23 | 23 | $session->clear(); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | 'login' => Type::nonNull(_types()->get(LoginType::class)), |
24 | 24 | 'password' => Type::nonNull(Type::string()), |
25 | 25 | ], |
26 | - 'resolve' => function ($root, array $args, SessionInterface $session): User { |
|
26 | + 'resolve' => function($root, array $args, SessionInterface $session): User { |
|
27 | 27 | |
28 | 28 | // Logout |
29 | 29 | $session->clear(); |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | |
45 | 45 | $fieldWheres = []; |
46 | 46 | foreach ($fields as $field) { |
47 | - $fieldWheres[] = $field . ' LIKE :' . $parameterName; |
|
47 | + $fieldWheres[] = $field.' LIKE :'.$parameterName; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($fieldWheres) { |
51 | - $wordWheres[] = '(' . implode(' OR ', $fieldWheres) . ')'; |
|
52 | - $queryBuilder->setParameter($parameterName, '%' . $word . '%'); |
|
51 | + $wordWheres[] = '('.implode(' OR ', $fieldWheres).')'; |
|
52 | + $queryBuilder->setParameter($parameterName, '%'.$word.'%'); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - return '(' . implode(' AND ', $wordWheres) . ')'; |
|
56 | + return '('.implode(' AND ', $wordWheres).')'; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | protected function getSearchableFields(UniqueNameFactory $uniqueNameFactory, ClassMetadata $metadata, QueryBuilder $queryBuilder, string $alias): array |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | foreach ($metadata->fieldMappings as $mapping) { |
70 | 70 | if (in_array($mapping['fieldName'], $whitelistedFields, true)) { |
71 | 71 | $fieldName = $mapping['fieldName']; |
72 | - $field = $alias . '.' . $fieldName; |
|
72 | + $field = $alias.'.'.$fieldName; |
|
73 | 73 | |
74 | 74 | $fields[] = $field; |
75 | 75 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | { |
26 | 26 | $config = [ |
27 | 27 | 'description' => 'Describe what page we want', |
28 | - 'fields' => function (): array { |
|
28 | + 'fields' => function(): array { |
|
29 | 29 | return [ |
30 | 30 | 'offset' => [ |
31 | 31 | 'type' => self::int(), |