@@ -250,7 +250,7 @@ |
||
250 | 250 | */ |
251 | 251 | public function __toString(): string |
252 | 252 | { |
253 | - return 'Error-object with ' . ( |
|
253 | + return 'Error-object with '.( |
|
254 | 254 | $this->id === null |
255 | 255 | ? 'no ID' |
256 | 256 | : sprintf('ID: "%s"', $this->id) |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | foreach ($definition->getParameters() as $name => $value) |
116 | 116 | { |
117 | - if (! preg_match('~@(?:(?<namespace>[a-z0-9_\.]+)\:)?(?<name>[a-z0-9_\.]+)~i', $value, $matches)) { |
|
117 | + if (!preg_match('~@(?:(?<namespace>[a-z0-9_\.]+)\:)?(?<name>[a-z0-9_\.]+)~i', $value, $matches)) { |
|
118 | 118 | $resolved[$name] = $value; |
119 | 119 | continue; |
120 | 120 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | - if (! isset($scope[$matches['namespace']])) { |
|
127 | + if (!isset($scope[$matches['namespace']])) { |
|
128 | 128 | throw new \LogicException(sprintf('Object "%s" not found in the scope.', $matches['namespace'])); |
129 | 129 | } |
130 | 130 |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | static protected function registerAnnotations() |
49 | 49 | { |
50 | 50 | if (self::$annotationsRegistered === false) { |
51 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Relationship.php'); |
|
52 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attribute.php'); |
|
53 | - AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Link.php'); |
|
51 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Relationship.php'); |
|
52 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Attribute.php'); |
|
53 | + AnnotationRegistry::registerFile(__DIR__.'/Annotation/Link.php'); |
|
54 | 54 | |
55 | 55 | self::$annotationsRegistered = true; |
56 | 56 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getDefinition(string $class): Definition |
82 | 82 | { |
83 | - if (! isset($this->definitionCache[$class])) { |
|
83 | + if (!isset($this->definitionCache[$class])) { |
|
84 | 84 | $reflection = new \ReflectionClass($class); |
85 | 85 | |
86 | 86 | $this->definitionCache[$class] = $this->createDefinition($reflection); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function validateMethodAttribute(AttributeAnnotation $annotation, \ReflectionMethod $method) |
204 | 204 | { |
205 | - if (! $method->isPublic()) { |
|
205 | + if (!$method->isPublic()) { |
|
206 | 206 | throw new \LogicException(sprintf( |
207 | 207 | 'Attribute annotation can be applied only to non public method "%s".', |
208 | 208 | $method->getName() |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | protected function processDataType(string $definition, Attribute $attribute) |
339 | 339 | { |
340 | - if (! preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
340 | + if (!preg_match(self::DATATYPE_PATTERN, $definition, $matches)) { |
|
341 | 341 | throw new \LogicException(sprintf('Data-type definition "%s" is invalid.', $definition)); |
342 | 342 | } |
343 | 343 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | foreach (['get', 'is'] as $prefix) |
396 | 396 | { |
397 | - $getter = $prefix . ucfirst($name); |
|
397 | + $getter = $prefix.ucfirst($name); |
|
398 | 398 | |
399 | 399 | if ($class->hasMethod($getter) && $class->getMethod($getter)->isPublic()) { |
400 | 400 | return $getter; |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | |
404 | 404 | throw new \LogicException(sprintf( |
405 | - 'Getter-method for the property "%s" cannot be resolved automatically. ' . |
|
405 | + 'Getter-method for the property "%s" cannot be resolved automatically. '. |
|
406 | 406 | 'Probably there is no get%2$s() or is%2$s() method or it is not public.', |
407 | 407 | $name, ucfirst($name) |
408 | 408 | )); |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | $name = $property->getName(); |
420 | 420 | $class = $property->getDeclaringClass(); |
421 | 421 | |
422 | - $setter = 'set' . ucfirst($name); |
|
422 | + $setter = 'set'.ucfirst($name); |
|
423 | 423 | |
424 | 424 | if ($class->hasMethod($setter) && $class->getMethod($setter)->isPublic()) { |
425 | 425 | return $setter; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | */ |
451 | 451 | protected function createLink(LinkAnnotation $annotation): Link |
452 | 452 | { |
453 | - if (! preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) { |
|
453 | + if (!preg_match(self::RESOURCE_PATTERN, $annotation->resource, $matches)) { |
|
454 | 454 | throw new \LogicException(sprintf('Invalid resource definition: "%s"', $annotation->resource)); |
455 | 455 | } |
456 | 456 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | foreach ($definitions as $definition) |
159 | 159 | { |
160 | - if (! $definition->hasSetter()) { |
|
160 | + if (!$definition->hasSetter()) { |
|
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | { |
177 | 177 | $name = $definition->getName(); |
178 | 178 | |
179 | - if (! $resource->hasAttribute($name)) { |
|
179 | + if (!$resource->hasAttribute($name)) { |
|
180 | 180 | return; |
181 | 181 | } |
182 | 182 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return; |
22 | 22 | } |
23 | 23 | |
24 | - if (! $value instanceof \DateTimeInterface) { |
|
24 | + if (!$value instanceof \DateTimeInterface) { |
|
25 | 25 | $value = new \DateTimeImmutable((string) $value); |
26 | 26 | } |
27 | 27 |
@@ -81,8 +81,7 @@ |
||
81 | 81 | |
82 | 82 | try { |
83 | 83 | $response = $this->client->request($request); |
84 | - } |
|
85 | - catch (\Throwable $exception) { |
|
84 | + } catch (\Throwable $exception) { |
|
86 | 85 | $exceptionEvent = new ExceptionEvent($request, $exception); |
87 | 86 | $this->dispatcher->dispatch($this->exceptionEvent, $exceptionEvent); |
88 | 87 |
@@ -86,13 +86,13 @@ |
||
86 | 86 | $exceptionEvent = new ExceptionEvent($request, $exception); |
87 | 87 | $this->dispatcher->dispatch($this->exceptionEvent, $exceptionEvent); |
88 | 88 | |
89 | - if (! $exceptionEvent->hasResponse()) { |
|
89 | + if (!$exceptionEvent->hasResponse()) { |
|
90 | 90 | throw $this->handleException($exception, $request); |
91 | 91 | } |
92 | 92 | |
93 | 93 | $response = $exceptionEvent->getResponse(); |
94 | 94 | |
95 | - if (! $exceptionEvent->isResponseEventEnabled()) { |
|
95 | + if (!$exceptionEvent->isResponseEventEnabled()) { |
|
96 | 96 | return $response; |
97 | 97 | } |
98 | 98 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function getDefinition(string $class): Definition |
56 | 56 | { |
57 | - if (! isset($this->definitions[$class])) { |
|
57 | + if (!isset($this->definitions[$class])) { |
|
58 | 58 | $this->definitions[$class] = $this->provideDefinition($class); |
59 | 59 | } |
60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function provideDefinition(string $class): Definition |
71 | 71 | { |
72 | - $key = self::PREFIX . md5($class); |
|
72 | + $key = self::PREFIX.md5($class); |
|
73 | 73 | $item = $this->cache->getItem($key); |
74 | 74 | |
75 | 75 | if ($item->isHit()) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | foreach ($options as $option => $value) |
63 | 63 | { |
64 | - if (! in_array($option, static::$possibleOptions, true)) { |
|
64 | + if (!in_array($option, static::$possibleOptions, true)) { |
|
65 | 65 | throw new InvalidOptionException($option, static::$possibleOptions); |
66 | 66 | } |
67 | 67 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $decoded = json_decode($content); |
155 | 155 | |
156 | 156 | if (json_last_error() !== JSON_ERROR_NONE) { |
157 | - throw new \RuntimeException('Decoding error: "' . json_last_error_msg() . '""'); |
|
157 | + throw new \RuntimeException('Decoding error: "'.json_last_error_msg().'""'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | return $this->hydrator->hydrate($decoded); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $encoded = json_encode($document->toArray()); |
172 | 172 | |
173 | 173 | if (json_last_error() !== JSON_ERROR_NONE) { |
174 | - throw new \RuntimeException('Encoding error: "' . json_last_error_msg() . '""'); |
|
174 | + throw new \RuntimeException('Encoding error: "'.json_last_error_msg().'""'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $stream = fopen('php://memory', 'r+'); |
@@ -88,8 +88,7 @@ |
||
88 | 88 | |
89 | 89 | try { |
90 | 90 | $response = $this->client->request($request); |
91 | - } |
|
92 | - catch (ResponseException $exception) { |
|
91 | + } catch (ResponseException $exception) { |
|
93 | 92 | if ($this->returnBadResponse) { |
94 | 93 | $response = $exception->getResponse(); |
95 | 94 | return $this->handleResponse($response); |
@@ -41,8 +41,7 @@ |
||
41 | 41 | { |
42 | 42 | try { |
43 | 43 | return $this->client->send($request); |
44 | - } |
|
45 | - catch (GuzzleRequestException $exception) { |
|
44 | + } catch (GuzzleRequestException $exception) { |
|
46 | 45 | throw $this->createException($exception); |
47 | 46 | } |
48 | 47 | } |