@@ -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 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'type' => $type, |
| 54 | 54 | 'format' => $format, |
| 55 | 55 | 'direction' => GraphNavigator::DIRECTION_SERIALIZATION, |
| 56 | - 'method' => 'serialize' . $type, |
|
| 56 | + 'method' => 'serialize'.$type, |
|
| 57 | 57 | ); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | private function isDataXmlNull($data) |
| 117 | 117 | { |
| 118 | 118 | $attributes = $data->attributes('xsi', true); |
| 119 | - return isset($attributes['nil'][0]) && (string)$attributes['nil'][0] === 'true'; |
|
| 119 | + return isset($attributes['nil'][0]) && (string) $attributes['nil'][0] === 'true'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | public function deserializeDateTimeFromXml(XmlDeserializationVisitor $visitor, $data, array $type) |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | $format = $this->getFormat($type); |
| 180 | 180 | |
| 181 | 181 | if ($immutable) { |
| 182 | - $datetime = \DateTimeImmutable::createFromFormat($format, (string)$data, $timezone); |
|
| 182 | + $datetime = \DateTimeImmutable::createFromFormat($format, (string) $data, $timezone); |
|
| 183 | 183 | } else { |
| 184 | - $datetime = \DateTime::createFromFormat($format, (string)$data, $timezone); |
|
| 184 | + $datetime = \DateTime::createFromFormat($format, (string) $data, $timezone); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if (false === $datetime) { |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | $format = 'P'; |
| 222 | 222 | |
| 223 | 223 | if (0 < $dateInterval->y) { |
| 224 | - $format .= $dateInterval->y . 'Y'; |
|
| 224 | + $format .= $dateInterval->y.'Y'; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | if (0 < $dateInterval->m) { |
| 228 | - $format .= $dateInterval->m . 'M'; |
|
| 228 | + $format .= $dateInterval->m.'M'; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if (0 < $dateInterval->d) { |
| 232 | - $format .= $dateInterval->d . 'D'; |
|
| 232 | + $format .= $dateInterval->d.'D'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (0 < $dateInterval->h) { |
| 240 | - $format .= $dateInterval->h . 'H'; |
|
| 240 | + $format .= $dateInterval->h.'H'; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if (0 < $dateInterval->i) { |
| 244 | - $format .= $dateInterval->i . 'M'; |
|
| 244 | + $format .= $dateInterval->i.'M'; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if (0 < $dateInterval->s) { |
| 248 | - $format .= $dateInterval->s . 'S'; |
|
| 248 | + $format .= $dateInterval->s.'S'; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if ($format === 'P') { |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | \DateTimeInterface $date, |
| 73 | 73 | array $type, |
| 74 | 74 | Context $context |
| 75 | - ) |
|
| 76 | - { |
|
| 75 | + ) { |
|
| 77 | 76 | if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { |
| 78 | 77 | return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type, $context); |
| 79 | 78 | } |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | \DateTimeImmutable $date, |
| 97 | 96 | array $type, |
| 98 | 97 | Context $context |
| 99 | - ) |
|
| 100 | - { |
|
| 98 | + ) { |
|
| 101 | 99 | return $this->serializeDateTimeInterface($visitor, $date, $type, $context); |
| 102 | 100 | } |
| 103 | 101 | |
@@ -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; |