| @@ -187,6 +187,9 @@ | ||
| 187 | 187 | ->get(); | 
| 188 | 188 | } | 
| 189 | 189 | |
| 190 | + /** | |
| 191 | + * @param string $format | |
| 192 | + */ | |
| 190 | 193 | private function visit(VisitorInterface $visitor, Context $context, $data, $format, array $type = null) | 
| 191 | 194 |      { | 
| 192 | 195 | $context->initialize( | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | |
| 90 | 90 | public function serialize($data, $format, SerializationContext $context = null) | 
| 91 | 91 |      { | 
| 92 | -        if ( ! $this->serializationVisitors->containsKey($format)) { | |
| 92 | +        if (!$this->serializationVisitors->containsKey($format)) { | |
| 93 | 93 |              throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for serialization.', $format)); | 
| 94 | 94 | } | 
| 95 | 95 | |
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | |
| 113 | 113 | public function deserialize($data, $type, $format, DeserializationContext $context = null) | 
| 114 | 114 |      { | 
| 115 | -        if ( ! $this->deserializationVisitors->containsKey($format)) { | |
| 115 | +        if (!$this->deserializationVisitors->containsKey($format)) { | |
| 116 | 116 |              throw new UnsupportedFormatException(sprintf('The format "%s" is not supported for deserialization.', $format)); | 
| 117 | 117 | } | 
| 118 | 118 | |
| @@ -155,7 +155,7 @@ discard block | ||
| 155 | 155 |          ->map(function(JsonSerializationVisitor $visitor) use ($context, $data) { | 
| 156 | 156 | $this->visit($visitor, $context, $data, 'json'); | 
| 157 | 157 | $result = $this->convertArrayObjects($visitor->getRoot()); | 
| 158 | -            if ( ! is_array($result)) { | |
| 158 | +            if (!is_array($result)) { | |
| 159 | 159 | throw new RuntimeException(sprintf( | 
| 160 | 160 | 'The input data of type "%s" did not convert to an array, but got a result of type "%s".', | 
| 161 | 161 | is_object($data) ? get_class($data) : gettype($data), | 
| @@ -97,10 +97,10 @@ discard block | ||
| 97 | 97 | } | 
| 98 | 98 | public function setCacheDir($dir) | 
| 99 | 99 |      { | 
| 100 | -        if ( ! is_dir($dir)) { | |
| 100 | +        if (!is_dir($dir)) { | |
| 101 | 101 | $this->createDir($dir); | 
| 102 | 102 | } | 
| 103 | -        if ( ! is_writable($dir)) { | |
| 103 | +        if (!is_writable($dir)) { | |
| 104 | 104 |              throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); | 
| 105 | 105 | } | 
| 106 | 106 | $this->cacheDir = $dir; | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | public function setMetadataDirs(array $namespacePrefixToDirMap) | 
| 201 | 201 |      { | 
| 202 | 202 |          foreach ($namespacePrefixToDirMap as $dir) { | 
| 203 | -            if ( ! is_dir($dir)) { | |
| 203 | +            if (!is_dir($dir)) { | |
| 204 | 204 |                  throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); | 
| 205 | 205 | } | 
| 206 | 206 | } | 
| @@ -235,7 +235,7 @@ discard block | ||
| 235 | 235 | */ | 
| 236 | 236 | public function addMetadataDir($dir, $namespacePrefix = '') | 
| 237 | 237 |      { | 
| 238 | -        if ( ! is_dir($dir)) { | |
| 238 | +        if (!is_dir($dir)) { | |
| 239 | 239 |              throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); | 
| 240 | 240 | } | 
| 241 | 241 |          if (isset($this->metadataDirs[$namespacePrefix])) { | 
| @@ -271,10 +271,10 @@ discard block | ||
| 271 | 271 | */ | 
| 272 | 272 | public function replaceMetadataDir($dir, $namespacePrefix = '') | 
| 273 | 273 |      { | 
| 274 | -        if ( ! is_dir($dir)) { | |
| 274 | +        if (!is_dir($dir)) { | |
| 275 | 275 |              throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); | 
| 276 | 276 | } | 
| 277 | -        if ( ! isset($this->metadataDirs[$namespacePrefix])) { | |
| 277 | +        if (!isset($this->metadataDirs[$namespacePrefix])) { | |
| 278 | 278 |              throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); | 
| 279 | 279 | } | 
| 280 | 280 | $this->metadataDirs[$namespacePrefix] = $dir; | 
| @@ -290,24 +290,24 @@ discard block | ||
| 290 | 290 |          if (null === $annotationReader) { | 
| 291 | 291 | $annotationReader = new AnnotationReader(); | 
| 292 | 292 |              if (null !== $this->cacheDir) { | 
| 293 | - $this->createDir($this->cacheDir.'/annotations'); | |
| 294 | - $annotationReader = new FileCacheReader($annotationReader, $this->cacheDir.'/annotations', $this->debug); | |
| 293 | + $this->createDir($this->cacheDir . '/annotations'); | |
| 294 | + $annotationReader = new FileCacheReader($annotationReader, $this->cacheDir . '/annotations', $this->debug); | |
| 295 | 295 | } | 
| 296 | 296 | } | 
| 297 | 297 | $metadataDriver = $this->driverFactory->createDriver($this->metadataDirs, $annotationReader); | 
| 298 | 298 | $metadataFactory = new MetadataFactory($metadataDriver, null, $this->debug); | 
| 299 | 299 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); | 
| 300 | 300 |          if (null !== $this->cacheDir) { | 
| 301 | - $this->createDir($this->cacheDir.'/metadata'); | |
| 302 | - $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); | |
| 301 | + $this->createDir($this->cacheDir . '/metadata'); | |
| 302 | + $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); | |
| 303 | 303 | } | 
| 304 | -        if ( ! $this->handlersConfigured) { | |
| 304 | +        if (!$this->handlersConfigured) { | |
| 305 | 305 | $this->addDefaultHandlers(); | 
| 306 | 306 | } | 
| 307 | -        if ( ! $this->listenersConfigured) { | |
| 307 | +        if (!$this->listenersConfigured) { | |
| 308 | 308 | $this->addDefaultListeners(); | 
| 309 | 309 | } | 
| 310 | -        if ( ! $this->visitorsAdded) { | |
| 310 | +        if (!$this->visitorsAdded) { | |
| 311 | 311 | $this->addDefaultSerializationVisitors(); | 
| 312 | 312 | $this->addDefaultDeserializationVisitors(); | 
| 313 | 313 | } |