@@ -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 | } |
@@ -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 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | // Locate possible ObjectManager |
52 | 52 | $objectManager = $this->managerRegistry->getManagerForClass($metadata->name); |
53 | 53 | |
54 | - if (!$objectManager) { |
|
54 | + if ( ! $objectManager) { |
|
55 | 55 | // No ObjectManager found, proceed with normal deserialization |
56 | 56 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | // Managed entity, check for proxy load |
68 | - if (!is_array($data)) { |
|
68 | + if ( ! is_array($data)) { |
|
69 | 69 | // Single identifier, load proxy |
70 | 70 | return $objectManager->getReference($metadata->name, $data); |
71 | 71 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $identifierList = array(); |
76 | 76 | |
77 | 77 | foreach ($classMetadata->getIdentifierFieldNames() as $name) { |
78 | - if (!array_key_exists($name, $data)) { |
|
78 | + if ( ! array_key_exists($name, $data)) { |
|
79 | 79 | return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context); |
80 | 80 | } |
81 | 81 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | return $this->initializedHandlers[$direction][$typeName][$format]; |
44 | 44 | } |
45 | 45 | |
46 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
46 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
47 | 47 | return null; |
48 | 48 | } |
49 | 49 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
41 | 41 | 'type' => $type, |
42 | 42 | 'format' => $format, |
43 | - 'method' => $method . 'To' . $format, |
|
43 | + 'method' => $method.'To'.$format, |
|
44 | 44 | ); |
45 | 45 | } |
46 | 46 | } |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | |
35 | 35 | switch ($direction) { |
36 | 36 | case GraphNavigator::DIRECTION_DESERIALIZATION: |
37 | - return 'deserialize' . $type . 'From' . $format; |
|
37 | + return 'deserialize'.$type.'From'.$format; |
|
38 | 38 | |
39 | 39 | case GraphNavigator::DIRECTION_SERIALIZATION: |
40 | - return 'serialize' . $type . 'To' . $format; |
|
40 | + return 'serialize'.$type.'To'.$format; |
|
41 | 41 | |
42 | 42 | default: |
43 | 43 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigator::DIRECTION_??? constants.', json_encode($direction))); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler) |
53 | 53 | { |
54 | 54 | foreach ($handler->getSubscribingMethods() as $methodData) { |
55 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
55 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
56 | 56 | throw new RuntimeException(sprintf('For each subscribing method a "type" and "format" attribute must be given, but only got "%s" for %s.', implode('" and "', array_keys($methodData)), get_class($handler))); |
57 | 57 | } |
58 | 58 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function getHandler($direction, $typeName, $format) |
81 | 81 | { |
82 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
82 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
83 | 83 | return null; |
84 | 84 | } |
85 | 85 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | private function assertMutable() |
116 | 116 | { |
117 | - if (!$this->initialized) { |
|
117 | + if ( ! $this->initialized) { |
|
118 | 118 | return; |
119 | 119 | } |
120 | 120 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | throw new \LogicException('The groups must not be empty.'); |
170 | 170 | } |
171 | 171 | |
172 | - $this->attributes->set('groups', (array)$groups); |
|
173 | - $this->addExclusionStrategy(new GroupsExclusionStrategy((array)$groups)); |
|
172 | + $this->attributes->set('groups', (array) $groups); |
|
173 | + $this->addExclusionStrategy(new GroupsExclusionStrategy((array) $groups)); |
|
174 | 174 | |
175 | 175 | return $this; |
176 | 176 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function setSerializeNull($bool) |
192 | 192 | { |
193 | - $this->serializeNull = (boolean)$bool; |
|
193 | + $this->serializeNull = (boolean) $bool; |
|
194 | 194 | |
195 | 195 | return $this; |
196 | 196 | } |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | $metadata = $this->metadataStack->pop(); |
232 | 232 | |
233 | - if (!$metadata instanceof PropertyMetadata) { |
|
233 | + if ( ! $metadata instanceof PropertyMetadata) { |
|
234 | 234 | throw new RuntimeException('Context metadataStack not working well'); |
235 | 235 | } |
236 | 236 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | { |
240 | 240 | $metadata = $this->metadataStack->pop(); |
241 | 241 | |
242 | - if (!$metadata instanceof ClassMetadata) { |
|
242 | + if ( ! $metadata instanceof ClassMetadata) { |
|
243 | 243 | throw new RuntimeException('Context metadataStack not working well'); |
244 | 244 | } |
245 | 245 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function getCurrentPath() |
256 | 256 | { |
257 | - if (!$this->metadataStack) { |
|
257 | + if ( ! $this->metadataStack) { |
|
258 | 258 | return array(); |
259 | 259 | } |
260 | 260 |
@@ -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; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function startVisiting($object) |
51 | 51 | { |
52 | - if (!is_object($object)) { |
|
52 | + if ( ! is_object($object)) { |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | $this->visitingSet->attach($object); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function stopVisiting($object) |
60 | 60 | { |
61 | - if (!is_object($object)) { |
|
61 | + if ( ! is_object($object)) { |
|
62 | 62 | return; |
63 | 63 | } |
64 | 64 | $this->visitingSet->detach($object); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function isVisiting($object) |
73 | 73 | { |
74 | - if (!is_object($object)) { |
|
74 | + if ( ! is_object($object)) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $path[] = get_class($obj); |
86 | 86 | } |
87 | 87 | |
88 | - if (!$path) { |
|
88 | + if ( ! $path) { |
|
89 | 89 | return null; |
90 | 90 | } |
91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | public function getObject() |
106 | 106 | { |
107 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
107 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | public function getVisitingStack() |