@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | protected function getAccessorStrategy() |
112 | 112 | { |
113 | - if (!$this->accessorStrategy) { |
|
113 | + if ( ! $this->accessorStrategy) { |
|
114 | 114 | $this->accessorStrategy = new DefaultAccessorStrategy(); |
115 | 115 | |
116 | 116 | if ($this->expressionEvaluator) { |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | |
135 | 135 | public function setDebug($bool) |
136 | 136 | { |
137 | - $this->debug = (boolean)$bool; |
|
137 | + $this->debug = (boolean) $bool; |
|
138 | 138 | |
139 | 139 | return $this; |
140 | 140 | } |
141 | 141 | |
142 | 142 | public function setCacheDir($dir) |
143 | 143 | { |
144 | - if (!is_dir($dir)) { |
|
144 | + if ( ! is_dir($dir)) { |
|
145 | 145 | $this->createDir($dir); |
146 | 146 | } |
147 | - if (!is_writable($dir)) { |
|
147 | + if ( ! is_writable($dir)) { |
|
148 | 148 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
149 | 149 | } |
150 | 150 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | */ |
252 | 252 | public function includeInterfaceMetadata($include) |
253 | 253 | { |
254 | - $this->includeInterfaceMetadata = (Boolean)$include; |
|
254 | + $this->includeInterfaceMetadata = (Boolean) $include; |
|
255 | 255 | |
256 | 256 | return $this; |
257 | 257 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function setMetadataDirs(array $namespacePrefixToDirMap) |
271 | 271 | { |
272 | 272 | foreach ($namespacePrefixToDirMap as $dir) { |
273 | - if (!is_dir($dir)) { |
|
273 | + if ( ! is_dir($dir)) { |
|
274 | 274 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
275 | 275 | } |
276 | 276 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function addMetadataDir($dir, $namespacePrefix = '') |
310 | 310 | { |
311 | - if (!is_dir($dir)) { |
|
311 | + if ( ! is_dir($dir)) { |
|
312 | 312 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
313 | 313 | } |
314 | 314 | |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function replaceMetadataDir($dir, $namespacePrefix = '') |
352 | 352 | { |
353 | - if (!is_dir($dir)) { |
|
353 | + if ( ! is_dir($dir)) { |
|
354 | 354 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
355 | 355 | } |
356 | 356 | |
357 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
357 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
358 | 358 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
359 | 359 | } |
360 | 360 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | $annotationReader = new AnnotationReader(); |
418 | 418 | |
419 | 419 | if (null !== $this->cacheDir) { |
420 | - $this->createDir($this->cacheDir . '/annotations'); |
|
421 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
420 | + $this->createDir($this->cacheDir.'/annotations'); |
|
421 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
422 | 422 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
423 | 423 | } |
424 | 424 | } |
@@ -429,19 +429,19 @@ discard block |
||
429 | 429 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); |
430 | 430 | |
431 | 431 | if (null !== $this->cacheDir) { |
432 | - $this->createDir($this->cacheDir . '/metadata'); |
|
433 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
432 | + $this->createDir($this->cacheDir.'/metadata'); |
|
433 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
434 | 434 | } |
435 | 435 | |
436 | - if (!$this->handlersConfigured) { |
|
436 | + if ( ! $this->handlersConfigured) { |
|
437 | 437 | $this->addDefaultHandlers(); |
438 | 438 | } |
439 | 439 | |
440 | - if (!$this->listenersConfigured) { |
|
440 | + if ( ! $this->listenersConfigured) { |
|
441 | 441 | $this->addDefaultListeners(); |
442 | 442 | } |
443 | 443 | |
444 | - if (!$this->visitorsAdded) { |
|
444 | + if ( ! $this->visitorsAdded) { |
|
445 | 445 | $this->addDefaultSerializationVisitors(); |
446 | 446 | $this->addDefaultDeserializationVisitors(); |
447 | 447 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function writeln($content) |
63 | 63 | { |
64 | - $this->write($content . "\n"); |
|
64 | + $this->write($content."\n"); |
|
65 | 65 | |
66 | 66 | return $this; |
67 | 67 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $lines = explode("\n", $content); |
86 | 86 | for ($i = 0, $c = count($lines); $i < $c; $i++) { |
87 | 87 | if ($this->indentationLevel > 0 |
88 | - && !empty($lines[$i]) |
|
88 | + && ! empty($lines[$i]) |
|
89 | 89 | && ((empty($addition) && "\n" === substr($this->content, -1)) || "\n" === substr($addition, -1)) |
90 | 90 | ) { |
91 | 91 | $addition .= str_repeat(' ', $this->indentationLevel * $this->indentationSpaces); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function rtrim($preserveNewLines = true) |
109 | 109 | { |
110 | - if (!$preserveNewLines) { |
|
110 | + if ( ! $preserveNewLines) { |
|
111 | 111 | $this->content = rtrim($this->content); |
112 | 112 | |
113 | 113 | return $this; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | return $this->serializationVisitors->get($format) |
109 | - ->map(function (VisitorInterface $visitor) use ($context, $data, $format) { |
|
109 | + ->map(function(VisitorInterface $visitor) use ($context, $data, $format) { |
|
110 | 110 | $type = $context->getInitialType() !== null ? $this->typeParser->parse($context->getInitialType()) : null; |
111 | 111 | |
112 | 112 | $this->visit($visitor, $context, $visitor->prepare($data), $format, $type); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | return $this->deserializationVisitors->get($format) |
126 | - ->map(function (VisitorInterface $visitor) use ($context, $data, $format, $type) { |
|
126 | + ->map(function(VisitorInterface $visitor) use ($context, $data, $format, $type) { |
|
127 | 127 | $preparedData = $visitor->prepare($data); |
128 | 128 | $navigatorResult = $this->visit($visitor, $context, $preparedData, $format, $this->typeParser->parse($type)); |
129 | 129 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | return $this->serializationVisitors->get('json') |
145 | - ->map(function (JsonSerializationVisitor $visitor) use ($context, $data) { |
|
145 | + ->map(function(JsonSerializationVisitor $visitor) use ($context, $data) { |
|
146 | 146 | $type = $context->getInitialType() !== null ? $this->typeParser->parse($context->getInitialType()) : null; |
147 | 147 | |
148 | 148 | $this->visit($visitor, $context, $data, 'json', $type); |
149 | 149 | $result = $this->convertArrayObjects($visitor->getRoot()); |
150 | 150 | |
151 | - if (!is_array($result)) { |
|
151 | + if ( ! is_array($result)) { |
|
152 | 152 | throw new RuntimeException(sprintf( |
153 | 153 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', |
154 | 154 | is_object($data) ? get_class($data) : gettype($data), |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | return $this->deserializationVisitors->get('json') |
174 | - ->map(function (JsonDeserializationVisitor $visitor) use ($data, $type, $context) { |
|
174 | + ->map(function(JsonDeserializationVisitor $visitor) use ($data, $type, $context) { |
|
175 | 175 | $navigatorResult = $this->visit($visitor, $context, $data, 'json', $this->typeParser->parse($type)); |
176 | 176 | |
177 | 177 | return $this->handleDeserializeResult($visitor->getResult(), $navigatorResult); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | private function convertArrayObjects($data) |
207 | 207 | { |
208 | 208 | if ($data instanceof \ArrayObject || $data instanceof \stdClass) { |
209 | - $data = (array)$data; |
|
209 | + $data = (array) $data; |
|
210 | 210 | } |
211 | 211 | if (is_array($data)) { |
212 | 212 | foreach ($data as $k => $v) { |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | { |
53 | 53 | $groups = $this->getGroupsFor($navigatorContext); |
54 | 54 | |
55 | - if (!$property->groups) { |
|
56 | - return !in_array(self::DEFAULT_GROUP, $groups); |
|
55 | + if ( ! $property->groups) { |
|
56 | + return ! in_array(self::DEFAULT_GROUP, $groups); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return $this->shouldSkipUsingGroups($property, $groups); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $groups = $this->groups; |
78 | 78 | foreach ($paths as $index => $path) { |
79 | - if (!array_key_exists($path, $groups)) { |
|
79 | + if ( ! array_key_exists($path, $groups)) { |
|
80 | 80 | if ($index > 0) { |
81 | 81 | $groups = array(self::DEFAULT_GROUP); |
82 | 82 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function __construct($delegates) |
43 | 43 | { |
44 | - if (!$delegates instanceof SequenceInterface) { |
|
44 | + if ( ! $delegates instanceof SequenceInterface) { |
|
45 | 45 | $delegates = new Sequence($delegates); |
46 | 46 | } |
47 | 47 |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->root = $data; |
58 | 58 | } |
59 | 59 | |
60 | - return (string)$data; |
|
60 | + return (string) $data; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function visitBoolean($data, array $type, Context $context) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->root = $data; |
67 | 67 | } |
68 | 68 | |
69 | - return (boolean)$data; |
|
69 | + return (boolean) $data; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function visitInteger($data, array $type, Context $context) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $this->root = $data; |
76 | 76 | } |
77 | 77 | |
78 | - return (int)$data; |
|
78 | + return (int) $data; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | public function visitDouble($data, array $type, Context $context) |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $this->root = $data; |
85 | 85 | } |
86 | 86 | |
87 | - return (float)$data; |
|
87 | + return (float) $data; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $rs = $isHash ? new \ArrayObject() : array(); |
107 | 107 | } |
108 | 108 | |
109 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
109 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
110 | 110 | |
111 | 111 | foreach ($data as $k => $v) { |
112 | 112 | $v = $this->navigator->accept($v, $this->getElementType($type), $context); |
@@ -251,6 +251,6 @@ discard block |
||
251 | 251 | |
252 | 252 | public function setOptions($options) |
253 | 253 | { |
254 | - $this->options = (integer)$options; |
|
254 | + $this->options = (integer) $options; |
|
255 | 255 | } |
256 | 256 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | |
34 | 34 | public function __construct(array $values) |
35 | 35 | { |
36 | - if (!is_string($values['value'])) { |
|
36 | + if ( ! is_string($values['value'])) { |
|
37 | 37 | throw new RuntimeException('"value" must be a string.'); |
38 | 38 | } |
39 | 39 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function translateName(PropertyMetadata $property) |
43 | 43 | { |
44 | - $name = preg_replace('/[A-Z]/', $this->separator . '\\0', $property->name); |
|
44 | + $name = preg_replace('/[A-Z]/', $this->separator.'\\0', $property->name); |
|
45 | 45 | |
46 | 46 | if ($this->lowerCase) { |
47 | 47 | return strtolower($name); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | case 'resource': |
151 | 151 | $msg = 'Resources are not supported in serialized data.'; |
152 | 152 | if ($context instanceof SerializationContext && null !== $path = $context->getPath()) { |
153 | - $msg .= ' Path: ' . $path; |
|
153 | + $msg .= ' Path: '.$path; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | throw new RuntimeException($msg); |
@@ -206,11 +206,11 @@ discard block |
||
206 | 206 | /** @var $metadata ClassMetadata */ |
207 | 207 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
208 | 208 | |
209 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
209 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
210 | 210 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
211 | 211 | } |
212 | 212 | |
213 | - if ($context instanceof DeserializationContext && !empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
213 | + if ($context instanceof DeserializationContext && ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
214 | 214 | $metadata = $this->resolveMetadata($data, $metadata); |
215 | 215 | } |
216 | 216 | |
@@ -280,22 +280,22 @@ discard block |
||
280 | 280 | { |
281 | 281 | switch (true) { |
282 | 282 | case is_array($data) && isset($data[$metadata->discriminatorFieldName]): |
283 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
283 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
284 | 284 | break; |
285 | 285 | |
286 | 286 | // Check XML attribute for discriminatorFieldName |
287 | 287 | case is_object($data) && $metadata->xmlDiscriminatorAttribute && isset($data[$metadata->discriminatorFieldName]): |
288 | - $typeValue = (string)$data[$metadata->discriminatorFieldName]; |
|
288 | + $typeValue = (string) $data[$metadata->discriminatorFieldName]; |
|
289 | 289 | break; |
290 | 290 | |
291 | 291 | // Check XML element with namespace for discriminatorFieldName |
292 | - case is_object($data) && !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
293 | - $typeValue = (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
292 | + case is_object($data) && ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
293 | + $typeValue = (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
294 | 294 | break; |
295 | 295 | |
296 | 296 | // Check XML element for discriminatorFieldName |
297 | 297 | case is_object($data) && isset($data->{$metadata->discriminatorFieldName}): |
298 | - $typeValue = (string)$data->{$metadata->discriminatorFieldName}; |
|
298 | + $typeValue = (string) $data->{$metadata->discriminatorFieldName}; |
|
299 | 299 | break; |
300 | 300 | |
301 | 301 | default: |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | )); |
307 | 307 | } |
308 | 308 | |
309 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
309 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
310 | 310 | throw new \LogicException(sprintf( |
311 | 311 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
312 | 312 | $typeValue, |