@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $config = Yaml::parse(file_get_contents($file)); |
| 55 | 55 | |
| 56 | - if (!isset($config[$name = $class->name])) { |
|
| 56 | + if ( ! isset($config[$name = $class->name])) { |
|
| 57 | 57 | throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $metadata->fileResources[] = $file; |
| 63 | 63 | $metadata->fileResources[] = $class->getFileName(); |
| 64 | 64 | $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE'; |
| 65 | - $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false; |
|
| 65 | + $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false; |
|
| 66 | 66 | $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY; |
| 67 | - $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false; |
|
| 67 | + $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false; |
|
| 68 | 68 | $this->addClassProperties($metadata, $config); |
| 69 | 69 | |
| 70 | 70 | $propertiesMetadata = []; |
@@ -75,20 +75,20 @@ discard block |
||
| 75 | 75 | unset($propertySettings['exp']); |
| 76 | 76 | } else { |
| 77 | 77 | |
| 78 | - if (!$class->hasMethod($methodName)) { |
|
| 79 | - throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
| 78 | + if ( ! $class->hasMethod($methodName)) { |
|
| 79 | + throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name); |
|
| 80 | 80 | } |
| 81 | 81 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $pName = !empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
| 84 | + $pName = ! empty($propertySettings["name"]) ? $propertySettings["name"] : $virtualPropertyMetadata->name; |
|
| 85 | 85 | |
| 86 | 86 | $propertiesMetadata[$pName] = $virtualPropertyMetadata; |
| 87 | 87 | $config['properties'][$pName] = $propertySettings; |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (!$excludeAll) { |
|
| 91 | + if ( ! $excludeAll) { |
|
| 92 | 92 | foreach ($class->getProperties() as $property) { |
| 93 | 93 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 94 | 94 | continue; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $pConfig = $config['properties'][$pName]; |
| 109 | 109 | |
| 110 | 110 | if (isset($pConfig['exclude'])) { |
| 111 | - $isExclude = (Boolean)$pConfig['exclude']; |
|
| 111 | + $isExclude = (Boolean) $pConfig['exclude']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if ($isExclude) { |
@@ -116,35 +116,35 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (isset($pConfig['expose'])) { |
| 119 | - $isExpose = (Boolean)$pConfig['expose']; |
|
| 119 | + $isExpose = (Boolean) $pConfig['expose']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (isset($pConfig['skip_when_empty'])) { |
| 123 | - $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty']; |
|
| 123 | + $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty']; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (isset($pConfig['since_version'])) { |
| 127 | - $pMetadata->sinceVersion = (string)$pConfig['since_version']; |
|
| 127 | + $pMetadata->sinceVersion = (string) $pConfig['since_version']; |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if (isset($pConfig['until_version'])) { |
| 131 | - $pMetadata->untilVersion = (string)$pConfig['until_version']; |
|
| 131 | + $pMetadata->untilVersion = (string) $pConfig['until_version']; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | if (isset($pConfig['exclude_if'])) { |
| 135 | - $pMetadata->excludeIf = (string)$pConfig['exclude_if']; |
|
| 135 | + $pMetadata->excludeIf = (string) $pConfig['exclude_if']; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (isset($pConfig['expose_if'])) { |
| 139 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")"; |
|
| 139 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset($pConfig['serialized_name'])) { |
| 143 | - $pMetadata->serializedName = (string)$pConfig['serialized_name']; |
|
| 143 | + $pMetadata->serializedName = (string) $pConfig['serialized_name']; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if (isset($pConfig['type'])) { |
| 147 | - $pMetadata->setType($this->typeParser->parse((string)$pConfig['type'])); |
|
| 147 | + $pMetadata->setType($this->typeParser->parse((string) $pConfig['type'])); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | if (isset($pConfig['groups'])) { |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $colConfig = $pConfig['xml_list']; |
| 158 | 158 | if (isset($colConfig['inline'])) { |
| 159 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 159 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | if (isset($colConfig['entry_name'])) { |
| 163 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 163 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if (isset($colConfig['skip_when_empty'])) { |
| 167 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
| 167 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
| 168 | 168 | } else { |
| 169 | 169 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (isset($colConfig['namespace'])) { |
| 173 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 173 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -179,15 +179,15 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $colConfig = $pConfig['xml_map']; |
| 181 | 181 | if (isset($colConfig['inline'])) { |
| 182 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 182 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (isset($colConfig['entry_name'])) { |
| 186 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 186 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if (isset($colConfig['namespace'])) { |
| 190 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 190 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (isset($colConfig['key_attribute_name'])) { |
@@ -198,33 +198,33 @@ discard block |
||
| 198 | 198 | if (isset($pConfig['xml_element'])) { |
| 199 | 199 | $colConfig = $pConfig['xml_element']; |
| 200 | 200 | if (isset($colConfig['cdata'])) { |
| 201 | - $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata']; |
|
| 201 | + $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata']; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | if (isset($colConfig['namespace'])) { |
| 205 | - $pMetadata->xmlNamespace = (string)$colConfig['namespace']; |
|
| 205 | + $pMetadata->xmlNamespace = (string) $colConfig['namespace']; |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if (isset($pConfig['xml_attribute'])) { |
| 210 | - $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute']; |
|
| 210 | + $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute']; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if (isset($pConfig['xml_attribute_map'])) { |
| 214 | - $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map']; |
|
| 214 | + $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map']; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (isset($pConfig['xml_value'])) { |
| 218 | - $pMetadata->xmlValue = (Boolean)$pConfig['xml_value']; |
|
| 218 | + $pMetadata->xmlValue = (Boolean) $pConfig['xml_value']; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | if (isset($pConfig['xml_key_value_pairs'])) { |
| 222 | - $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs']; |
|
| 222 | + $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs']; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | //we need read_only before setter and getter set, because that method depends on flag being set |
| 226 | 226 | if (isset($pConfig['read_only'])) { |
| 227 | - $pMetadata->readOnly = (Boolean)$pConfig['read_only']; |
|
| 227 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
| 228 | 228 | } else { |
| 229 | 229 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 230 | 230 | } |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | ); |
| 237 | 237 | |
| 238 | 238 | if (isset($pConfig['inline'])) { |
| 239 | - $pMetadata->inline = (Boolean)$pConfig['inline']; |
|
| 239 | + $pMetadata->inline = (Boolean) $pConfig['inline']; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if (isset($pConfig['max_depth'])) { |
| 243 | - $pMetadata->maxDepth = (int)$pConfig['max_depth']; |
|
| 243 | + $pMetadata->maxDepth = (int) $pConfig['max_depth']; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - if (!$pMetadata->serializedName) { |
|
| 247 | + if ( ! $pMetadata->serializedName) { |
|
| 248 | 248 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 249 | 249 | } |
| 250 | 250 | |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | $pConfig = $config['properties'][$pName]; |
| 253 | 253 | |
| 254 | 254 | if (isset($pConfig['name'])) { |
| 255 | - $pMetadata->name = (string)$pConfig['name']; |
|
| 255 | + $pMetadata->name = (string) $pConfig['name']; |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 259 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 260 | 260 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 261 | 261 | ) { |
| 262 | 262 | $metadata->addPropertyMetadata($pMetadata); |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | private function addClassProperties(ClassMetadata $metadata, array $config) |
| 290 | 290 | { |
| 291 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 291 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 292 | 292 | $config['accessor_order'] = 'custom'; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -297,11 +297,11 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | if (isset($config['xml_root_name'])) { |
| 300 | - $metadata->xmlRootName = (string)$config['xml_root_name']; |
|
| 300 | + $metadata->xmlRootName = (string) $config['xml_root_name']; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | if (isset($config['xml_root_namespace'])) { |
| 304 | - $metadata->xmlRootNamespace = (string)$config['xml_root_namespace']; |
|
| 304 | + $metadata->xmlRootNamespace = (string) $config['xml_root_namespace']; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (array_key_exists('xml_namespaces', $config)) { |
@@ -315,25 +315,25 @@ discard block |
||
| 315 | 315 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 316 | 316 | $metadata->discriminatorDisabled = true; |
| 317 | 317 | } else { |
| 318 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 318 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 319 | 319 | throw new RuntimeException('The "field_name" attribute must be set for discriminators.'); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if (!isset($config['discriminator']['map']) || !\is_array($config['discriminator']['map'])) { |
|
| 322 | + if ( ! isset($config['discriminator']['map']) || ! \is_array($config['discriminator']['map'])) { |
|
| 323 | 323 | throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.'); |
| 324 | 324 | } |
| 325 | 325 | $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : []; |
| 326 | 326 | $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups); |
| 327 | 327 | |
| 328 | 328 | if (isset($config['discriminator']['xml_attribute'])) { |
| 329 | - $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute']; |
|
| 329 | + $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute']; |
|
| 330 | 330 | } |
| 331 | 331 | if (isset($config['discriminator']['xml_element'])) { |
| 332 | 332 | if (isset($config['discriminator']['xml_element']['cdata'])) { |
| 333 | - $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata']; |
|
| 333 | + $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata']; |
|
| 334 | 334 | } |
| 335 | 335 | if (isset($config['discriminator']['xml_element']['namespace'])) { |
| 336 | - $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace']; |
|
| 336 | + $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace']; |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | } |
@@ -344,13 +344,13 @@ discard block |
||
| 344 | 344 | { |
| 345 | 345 | if (\is_string($config)) { |
| 346 | 346 | $config = [$config]; |
| 347 | - } elseif (!\is_array($config)) { |
|
| 347 | + } elseif ( ! \is_array($config)) { |
|
| 348 | 348 | throw new RuntimeException(sprintf('callback methods expects a string, or an array of strings that represent method names, but got %s.', json_encode($config['pre_serialize']))); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $methods = []; |
| 352 | 352 | foreach ($config as $name) { |
| 353 | - if (!$class->hasMethod($name)) { |
|
| 353 | + if ( ! $class->hasMethod($name)) { |
|
| 354 | 354 | throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
| 355 | 355 | } |
| 356 | 356 | |
@@ -62,97 +62,97 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $metadata = new ClassMetadata($name = $class->name); |
| 65 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 65 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 66 | 66 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
| 67 | 67 | } |
| 68 | 68 | $elem = reset($elems); |
| 69 | 69 | |
| 70 | 70 | $metadata->fileResources[] = $path; |
| 71 | 71 | $metadata->fileResources[] = $class->getFileName(); |
| 72 | - $exclusionPolicy = strtoupper((string)$elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
| 73 | - $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string)$exclude) : false; |
|
| 74 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 72 | + $exclusionPolicy = strtoupper((string) $elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
|
| 73 | + $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower((string) $exclude) : false; |
|
| 74 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 75 | 75 | |
| 76 | 76 | $propertiesMetadata = []; |
| 77 | 77 | $propertiesNodes = []; |
| 78 | 78 | |
| 79 | 79 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
| 80 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
| 80 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
| 84 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
| 84 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
| 88 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
| 88 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $readOnlyClass = 'true' === strtolower((string)$elem->attributes()->{'read-only'}); |
|
| 91 | + $readOnlyClass = 'true' === strtolower((string) $elem->attributes()->{'read-only'}); |
|
| 92 | 92 | |
| 93 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
| 93 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
| 94 | 94 | $discriminatorMap = []; |
| 95 | 95 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 96 | - if (!isset($entry->attributes()->value)) { |
|
| 96 | + if ( ! isset($entry->attributes()->value)) { |
|
| 97 | 97 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
| 100 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
| 103 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
| 104 | 104 | $metadata->discriminatorDisabled = true; |
| 105 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 105 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 106 | 106 | |
| 107 | 107 | $discriminatorGroups = []; |
| 108 | 108 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 109 | - $discriminatorGroups[] = (string)$entry; |
|
| 109 | + $discriminatorGroups[] = (string) $entry; |
|
| 110 | 110 | } |
| 111 | 111 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 115 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 115 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 116 | 116 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (isset($xmlNamespace->attributes()->prefix)) { |
| 120 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
| 120 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
| 121 | 121 | } else { |
| 122 | 122 | $prefix = null; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
| 125 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
| 129 | 129 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
| 130 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 130 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 131 | 131 | } |
| 132 | 132 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
| 133 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 133 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 134 | 134 | } |
| 135 | 135 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
| 136 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
| 136 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | foreach ($elem->xpath('./virtual-property') as $method) { |
| 141 | 141 | |
| 142 | 142 | if (isset($method->attributes()->expression)) { |
| 143 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
| 143 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
| 144 | 144 | } else { |
| 145 | - if (!isset($method->attributes()->method)) { |
|
| 145 | + if ( ! isset($method->attributes()->method)) { |
|
| 146 | 146 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
| 147 | 147 | } |
| 148 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
| 148 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $propertiesMetadata[] = $virtualPropertyMetadata; |
| 152 | 152 | $propertiesNodes[] = $method; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (!$excludeAll) { |
|
| 155 | + if ( ! $excludeAll) { |
|
| 156 | 156 | |
| 157 | 157 | foreach ($class->getProperties() as $property) { |
| 158 | 158 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 163 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 163 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 164 | 164 | |
| 165 | 165 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 166 | 166 | } |
@@ -172,10 +172,10 @@ discard block |
||
| 172 | 172 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 173 | 173 | |
| 174 | 174 | $pElem = $propertiesNodes[$propertyKey]; |
| 175 | - if (!empty($pElem)) { |
|
| 175 | + if ( ! empty($pElem)) { |
|
| 176 | 176 | |
| 177 | 177 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 178 | - $isExclude = 'true' === strtolower((string)$exclude); |
|
| 178 | + $isExclude = 'true' === strtolower((string) $exclude); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if ($isExclude) { |
@@ -183,44 +183,44 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (null !== $expose = $pElem->attributes()->expose) { |
| 186 | - $isExpose = 'true' === strtolower((string)$expose); |
|
| 186 | + $isExpose = 'true' === strtolower((string) $expose); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | if (null !== $excludeIf = $pElem->attributes()->{'exclude-if'}) { |
| 190 | - $pMetadata->excludeIf = (string)$excludeIf; |
|
| 190 | + $pMetadata->excludeIf = (string) $excludeIf; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if (null !== $skip = $pElem->attributes()->{'skip-when-empty'}) { |
| 194 | - $pMetadata->skipWhenEmpty = 'true' === strtolower((string)$skip); |
|
| 194 | + $pMetadata->skipWhenEmpty = 'true' === strtolower((string) $skip); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 198 | - $pMetadata->excludeIf = "!(" . (string)$excludeIf . ")"; |
|
| 198 | + $pMetadata->excludeIf = "!(".(string) $excludeIf.")"; |
|
| 199 | 199 | $isExpose = true; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
| 203 | - $pMetadata->sinceVersion = (string)$version; |
|
| 203 | + $pMetadata->sinceVersion = (string) $version; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
| 207 | - $pMetadata->untilVersion = (string)$version; |
|
| 207 | + $pMetadata->untilVersion = (string) $version; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
| 211 | - $pMetadata->serializedName = (string)$serializedName; |
|
| 211 | + $pMetadata->serializedName = (string) $serializedName; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if (null !== $type = $pElem->attributes()->type) { |
| 215 | - $pMetadata->setType($this->typeParser->parse((string)$type)); |
|
| 215 | + $pMetadata->setType($this->typeParser->parse((string) $type)); |
|
| 216 | 216 | } elseif (isset($pElem->type)) { |
| 217 | - $pMetadata->setType($this->typeParser->parse((string)$pElem->type)); |
|
| 217 | + $pMetadata->setType($this->typeParser->parse((string) $pElem->type)); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (null !== $groups = $pElem->attributes()->groups) { |
| 221 | - $pMetadata->groups = preg_split('/\s*,\s*/', trim((string)$groups)); |
|
| 221 | + $pMetadata->groups = preg_split('/\s*,\s*/', trim((string) $groups)); |
|
| 222 | 222 | } elseif (isset($pElem->groups)) { |
| 223 | - $pMetadata->groups = (array)$pElem->groups->value; |
|
| 223 | + $pMetadata->groups = (array) $pElem->groups->value; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | if (isset($pElem->{'xml-list'})) { |
@@ -229,21 +229,21 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | $colConfig = $pElem->{'xml-list'}; |
| 231 | 231 | if (isset($colConfig->attributes()->inline)) { |
| 232 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 232 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 236 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 236 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
| 240 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
| 240 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
| 241 | 241 | } else { |
| 242 | 242 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if (isset($colConfig->attributes()->namespace)) { |
| 246 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 246 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
@@ -252,56 +252,56 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $colConfig = $pElem->{'xml-map'}; |
| 254 | 254 | if (isset($colConfig->attributes()->inline)) { |
| 255 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 255 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 259 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 259 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (isset($colConfig->attributes()->namespace)) { |
| 263 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 263 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
| 267 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
| 267 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if (isset($pElem->{'xml-element'})) { |
| 272 | 272 | $colConfig = $pElem->{'xml-element'}; |
| 273 | 273 | if (isset($colConfig->attributes()->cdata)) { |
| 274 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
| 274 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | if (isset($colConfig->attributes()->namespace)) { |
| 278 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
| 278 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
| 283 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
| 283 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
| 287 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
| 287 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | if (isset($pElem->attributes()->{'xml-value'})) { |
| 291 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
| 291 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
| 295 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 295 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if (isset($pElem->attributes()->{'max-depth'})) { |
| 299 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
| 299 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | //we need read-only before setter and getter set, because that method depends on flag being set |
| 303 | 303 | if (null !== $readOnly = $pElem->attributes()->{'read-only'}) { |
| 304 | - $pMetadata->readOnly = 'true' === strtolower((string)$readOnly); |
|
| 304 | + $pMetadata->readOnly = 'true' === strtolower((string) $readOnly); |
|
| 305 | 305 | } else { |
| 306 | 306 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 307 | 307 | } |
@@ -309,26 +309,26 @@ discard block |
||
| 309 | 309 | $getter = $pElem->attributes()->{'accessor-getter'}; |
| 310 | 310 | $setter = $pElem->attributes()->{'accessor-setter'}; |
| 311 | 311 | $pMetadata->setAccessor( |
| 312 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 313 | - $getter ? (string)$getter : null, |
|
| 314 | - $setter ? (string)$setter : null |
|
| 312 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 313 | + $getter ? (string) $getter : null, |
|
| 314 | + $setter ? (string) $setter : null |
|
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | 317 | if (null !== $inline = $pElem->attributes()->inline) { |
| 318 | - $pMetadata->inline = 'true' === strtolower((string)$inline); |
|
| 318 | + $pMetadata->inline = 'true' === strtolower((string) $inline); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if (!$pMetadata->serializedName) { |
|
| 322 | + if ( ! $pMetadata->serializedName) { |
|
| 323 | 323 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 327 | - $pMetadata->name = (string)$name; |
|
| 326 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 327 | + $pMetadata->name = (string) $name; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 331 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 330 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 331 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 332 | 332 | ) { |
| 333 | 333 | |
| 334 | 334 | |
@@ -338,31 +338,31 @@ discard block |
||
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | foreach ($elem->xpath('./callback-method') as $method) { |
| 341 | - if (!isset($method->attributes()->type)) { |
|
| 341 | + if ( ! isset($method->attributes()->type)) { |
|
| 342 | 342 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 343 | 343 | } |
| 344 | - if (!isset($method->attributes()->name)) { |
|
| 344 | + if ( ! isset($method->attributes()->name)) { |
|
| 345 | 345 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - switch ((string)$method->attributes()->type) { |
|
| 348 | + switch ((string) $method->attributes()->type) { |
|
| 349 | 349 | case 'pre-serialize': |
| 350 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 350 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 351 | 351 | break; |
| 352 | 352 | |
| 353 | 353 | case 'post-serialize': |
| 354 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 354 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | case 'post-deserialize': |
| 358 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 358 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 359 | 359 | break; |
| 360 | 360 | |
| 361 | 361 | case 'handler': |
| 362 | - if (!isset($method->attributes()->format)) { |
|
| 362 | + if ( ! isset($method->attributes()->format)) { |
|
| 363 | 363 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 364 | 364 | } |
| 365 | - if (!isset($method->attributes()->direction)) { |
|
| 365 | + if ( ! isset($method->attributes()->direction)) { |
|
| 366 | 366 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function translateName(PropertyMetadata $property): string |
| 45 | 45 | { |
| 46 | - $name = preg_replace('/[A-Z]+/', $this->separator . '\\0', $property->name); |
|
| 46 | + $name = preg_replace('/[A-Z]+/', $this->separator.'\\0', $property->name); |
|
| 47 | 47 | |
| 48 | 48 | if ($this->lowerCase) { |
| 49 | 49 | return strtolower($name); |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | /** @var $metadata ClassMetadata */ |
| 164 | 164 | $metadata = $this->metadataFactory->getMetadataForClass($type['name']); |
| 165 | 165 | |
| 166 | - if ($metadata->usingExpression && !$this->expressionExclusionStrategy) { |
|
| 166 | + if ($metadata->usingExpression && ! $this->expressionExclusionStrategy) { |
|
| 167 | 167 | throw new ExpressionLanguageRequiredException("To use conditional exclude/expose in {$metadata->name} you must configure the expression language."); |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if (!empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 170 | + if ( ! empty($metadata->discriminatorMap) && $type['name'] === $metadata->discriminatorBaseClass) { |
|
| 171 | 171 | $metadata = $this->resolveMetadata($data, $metadata); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | $typeValue = $this->visitor->visitDiscriminatorMapProperty($data, $metadata); |
| 218 | 218 | |
| 219 | - if (!isset($metadata->discriminatorMap[$typeValue])) { |
|
| 219 | + if ( ! isset($metadata->discriminatorMap[$typeValue])) { |
|
| 220 | 220 | throw new LogicException(sprintf( |
| 221 | 221 | 'The type value "%s" does not exist in the discriminator map of class "%s". Available types: %s', |
| 222 | 222 | $typeValue, |
@@ -37,10 +37,10 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | switch ($direction) { |
| 39 | 39 | case GraphNavigatorInterface::DIRECTION_DESERIALIZATION: |
| 40 | - return 'deserialize' . $type . 'From' . $format; |
|
| 40 | + return 'deserialize'.$type.'From'.$format; |
|
| 41 | 41 | |
| 42 | 42 | case GraphNavigatorInterface::DIRECTION_SERIALIZATION: |
| 43 | - return 'serialize' . $type . 'To' . $format; |
|
| 43 | + return 'serialize'.$type.'To'.$format; |
|
| 44 | 44 | |
| 45 | 45 | default: |
| 46 | 46 | throw new LogicException(sprintf('The direction %s does not exist; see GraphNavigatorInterface::DIRECTION_??? constants.', json_encode($direction))); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public function registerSubscribingHandler(SubscribingHandlerInterface $handler): void |
| 56 | 56 | { |
| 57 | 57 | foreach ($handler->getSubscribingMethods() as $methodData) { |
| 58 | - if (!isset($methodData['type'], $methodData['format'])) { |
|
| 58 | + if ( ! isset($methodData['type'], $methodData['format'])) { |
|
| 59 | 59 | 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))); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public function getHandler(int $direction, string $typeName, string $format) |
| 84 | 84 | { |
| 85 | - if (!isset($this->handlers[$direction][$typeName][$format])) { |
|
| 85 | + if ( ! isset($this->handlers[$direction][$typeName][$format])) { |
|
| 86 | 86 | return null; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'type' => $type, |
| 56 | 56 | 'format' => $format, |
| 57 | 57 | 'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION, |
| 58 | - 'method' => 'serialize' . $type, |
|
| 58 | + 'method' => 'serialize'.$type, |
|
| 59 | 59 | ]; |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $format = $this->getFormat($type); |
| 84 | 84 | if ('U' === $format) { |
| 85 | - return $visitor->visitInteger((int)$date->format($format), $type); |
|
| 85 | + return $visitor->visitInteger((int) $date->format($format), $type); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $visitor->visitString($date->format($this->getFormat($type)), $type); |
@@ -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) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | return null; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - return $this->parseDateInterval((string)$data); |
|
| 146 | + return $this->parseDateInterval((string) $data); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public function deserializeDateTimeFromJson(JsonDeserializationVisitor $visitor, $data, array $type) |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | private function parseDateTime($data, array $type, $immutable = false) |
| 177 | 177 | { |
| 178 | - $timezone = !empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 178 | + $timezone = ! empty($type['params'][1]) ? new \DateTimeZone($type['params'][1]) : $this->defaultTimezone; |
|
| 179 | 179 | $format = $this->getDeserializationFormat($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) { |
@@ -240,15 +240,15 @@ discard block |
||
| 240 | 240 | $format = 'P'; |
| 241 | 241 | |
| 242 | 242 | if (0 < $dateInterval->y) { |
| 243 | - $format .= $dateInterval->y . 'Y'; |
|
| 243 | + $format .= $dateInterval->y.'Y'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if (0 < $dateInterval->m) { |
| 247 | - $format .= $dateInterval->m . 'M'; |
|
| 247 | + $format .= $dateInterval->m.'M'; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | if (0 < $dateInterval->d) { |
| 251 | - $format .= $dateInterval->d . 'D'; |
|
| 251 | + $format .= $dateInterval->d.'D'; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) { |
@@ -256,15 +256,15 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (0 < $dateInterval->h) { |
| 259 | - $format .= $dateInterval->h . 'H'; |
|
| 259 | + $format .= $dateInterval->h.'H'; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | if (0 < $dateInterval->i) { |
| 263 | - $format .= $dateInterval->i . 'M'; |
|
| 263 | + $format .= $dateInterval->i.'M'; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | if (0 < $dateInterval->s) { |
| 267 | - $format .= $dateInterval->s . 'S'; |
|
| 267 | + $format .= $dateInterval->s.'S'; |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | if ($format === 'P') { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function createRoot(ClassMetadata $metadata = null, $rootName = null, $rootNamespace = null) |
| 81 | 81 | { |
| 82 | - if ($metadata !== null && !empty($metadata->xmlRootName)) { |
|
| 82 | + if ($metadata !== null && ! empty($metadata->xmlRootName)) { |
|
| 83 | 83 | $rootName = $metadata->xmlRootName; |
| 84 | 84 | $rootNamespace = $metadata->xmlRootNamespace ?: $this->getClassDefaultNamespace($metadata); |
| 85 | 85 | } else { |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | { |
| 113 | 113 | $doCData = null !== $this->currentMetadata ? $this->currentMetadata->xmlElementCData : true; |
| 114 | 114 | |
| 115 | - return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string)$data); |
|
| 115 | + return $doCData ? $this->document->createCDATASection($data) : $this->document->createTextNode((string) $data); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function visitSimpleString($data, array $type) |
| 119 | 119 | { |
| 120 | - return $this->document->createTextNode((string)$data); |
|
| 120 | + return $this->document->createTextNode((string) $data); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function visitBoolean(bool $data, array $type) |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function visitInteger(int $data, array $type) |
| 129 | 129 | { |
| 130 | - return $this->document->createTextNode((string)$data); |
|
| 130 | + return $this->document->createTextNode((string) $data); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function visitDouble(float $data, array $type) |
| 134 | 134 | { |
| 135 | 135 | if (floor($data) === $data) { |
| 136 | - return $this->document->createTextNode($data . ".0"); |
|
| 136 | + return $this->document->createTextNode($data.".0"); |
|
| 137 | 137 | } else { |
| 138 | - return $this->document->createTextNode((string)$data); |
|
| 138 | + return $this->document->createTextNode((string) $data); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
@@ -152,14 +152,14 @@ discard block |
||
| 152 | 152 | $elType = $this->getElementType($type); |
| 153 | 153 | foreach ($data as $k => $v) { |
| 154 | 154 | |
| 155 | - $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string)$k)) ? $k : $entryName; |
|
| 155 | + $tagName = (null !== $this->currentMetadata && $this->currentMetadata->xmlKeyValuePairs && $this->isElementNameValid((string) $k)) ? $k : $entryName; |
|
| 156 | 156 | |
| 157 | 157 | $entryNode = $this->createElement($tagName, $namespace); |
| 158 | 158 | $this->currentNode->appendChild($entryNode); |
| 159 | 159 | $this->setCurrentNode($entryNode); |
| 160 | 160 | |
| 161 | 161 | if (null !== $keyAttributeName) { |
| 162 | - $entryNode->setAttribute($keyAttributeName, (string)$k); |
|
| 162 | + $entryNode->setAttribute($keyAttributeName, (string) $k); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | try { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $node = $this->navigator->accept($v, $metadata->type); |
| 195 | 195 | $this->revertCurrentMetadata(); |
| 196 | 196 | |
| 197 | - if (!$node instanceof \DOMCharacterData) { |
|
| 197 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 198 | 198 | throw new RuntimeException(sprintf('Unsupported value for XML attribute for %s. Expected character data, but got %s.', $metadata->name, json_encode($v))); |
| 199 | 199 | } |
| 200 | 200 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (($metadata->xmlValue && $this->currentNode->childNodes->length > 0) |
| 207 | - || (!$metadata->xmlValue && $this->hasValue) |
|
| 207 | + || ( ! $metadata->xmlValue && $this->hasValue) |
|
| 208 | 208 | ) { |
| 209 | 209 | throw new RuntimeException(sprintf('If you make use of @XmlValue, all other properties in the class must have the @XmlAttribute annotation. Invalid usage detected in class %s.', $metadata->class)); |
| 210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $node = $this->navigator->accept($v, $metadata->type); |
| 217 | 217 | $this->revertCurrentMetadata(); |
| 218 | 218 | |
| 219 | - if (!$node instanceof \DOMCharacterData) { |
|
| 219 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 220 | 220 | throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, \is_object($node) ? \get_class($node) : \gettype($node))); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if ($metadata->xmlAttributeMap) { |
| 229 | - if (!\is_array($v)) { |
|
| 229 | + if ( ! \is_array($v)) { |
|
| 230 | 230 | throw new RuntimeException(sprintf('Unsupported value type for XML attribute map. Expected array but got %s.', \gettype($v))); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $node = $this->navigator->accept($value, null); |
| 236 | 236 | $this->revertCurrentMetadata(); |
| 237 | 237 | |
| 238 | - if (!$node instanceof \DOMCharacterData) { |
|
| 238 | + if ( ! $node instanceof \DOMCharacterData) { |
|
| 239 | 239 | throw new RuntimeException(sprintf('Unsupported value for a XML attribute map value. Expected character data, but got %s.', json_encode($v))); |
| 240 | 240 | } |
| 241 | 241 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | return; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if ($addEnclosingElement = !$this->isInLineCollection($metadata) && !$metadata->inline) { |
|
| 248 | + if ($addEnclosingElement = ! $this->isInLineCollection($metadata) && ! $metadata->inline) { |
|
| 249 | 249 | |
| 250 | 250 | $namespace = null !== $metadata->xmlNamespace |
| 251 | 251 | ? $metadata->xmlNamespace |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | private function isSkippableEmptyObject($node, PropertyMetadata $metadata) |
| 292 | 292 | { |
| 293 | - return $node === null && !$metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 293 | + return $node === null && ! $metadata->xmlCollection && $metadata->skipWhenEmpty; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | private function isSkippableCollection(PropertyMetadata $metadata) |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | private function isElementEmpty(\DOMElement $element) |
| 302 | 302 | { |
| 303 | - return !$element->hasChildNodes() && !$element->hasAttributes(); |
|
| 303 | + return ! $element->hasChildNodes() && ! $element->hasAttributes(); |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | public function endVisitingObject(ClassMetadata $metadata, object $data, array $type) |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | foreach ($metadata->xmlNamespaces as $prefix => $uri) { |
| 408 | 408 | $attribute = 'xmlns'; |
| 409 | 409 | if ($prefix !== '') { |
| 410 | - $attribute .= ':' . $prefix; |
|
| 410 | + $attribute .= ':'.$prefix; |
|
| 411 | 411 | } elseif ($element->namespaceURI === $uri) { |
| 412 | 412 | continue; |
| 413 | 413 | } |
@@ -423,19 +423,19 @@ discard block |
||
| 423 | 423 | if ($this->currentNode->isDefaultNamespace($namespace)) { |
| 424 | 424 | return $this->document->createElementNS($namespace, $tagName); |
| 425 | 425 | } |
| 426 | - if (!($prefix = $this->currentNode->lookupPrefix($namespace)) && !($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 427 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 426 | + if ( ! ($prefix = $this->currentNode->lookupPrefix($namespace)) && ! ($prefix = $this->document->lookupPrefix($namespace))) { |
|
| 427 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 428 | 428 | } |
| 429 | - return $this->document->createElementNS($namespace, $prefix . ':' . $tagName); |
|
| 429 | + return $this->document->createElementNS($namespace, $prefix.':'.$tagName); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | private function setAttributeOnNode(\DOMElement $node, $name, $value, $namespace = null) |
| 433 | 433 | { |
| 434 | 434 | if (null !== $namespace) { |
| 435 | - if (!$prefix = $node->lookupPrefix($namespace)) { |
|
| 436 | - $prefix = 'ns-' . substr(sha1($namespace), 0, 8); |
|
| 435 | + if ( ! $prefix = $node->lookupPrefix($namespace)) { |
|
| 436 | + $prefix = 'ns-'.substr(sha1($namespace), 0, 8); |
|
| 437 | 437 | } |
| 438 | - $node->setAttributeNS($namespace, $prefix . ':' . $name, $value); |
|
| 438 | + $node->setAttributeNS($namespace, $prefix.':'.$name, $value); |
|
| 439 | 439 | } else { |
| 440 | 440 | $node->setAttribute($name, $value); |
| 441 | 441 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if (false !== stripos($data, '<!doctype')) { |
| 62 | 62 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
| 63 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 63 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 64 | 64 | throw new InvalidArgumentException(sprintf( |
| 65 | 65 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
| 66 | 66 | $internalSubset |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | private function emptyStringToSpaceCharacter($data) |
| 84 | 84 | { |
| 85 | - return $data === '' ? ' ' : (string)$data; |
|
| 85 | + return $data === '' ? ' ' : (string) $data; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function visitNull($data, array $type): void |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | public function visitString($data, array $type): string |
| 94 | 94 | { |
| 95 | - return (string)$data; |
|
| 95 | + return (string) $data; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function visitBoolean($data, array $type): bool |
| 99 | 99 | { |
| 100 | - $data = (string)$data; |
|
| 100 | + $data = (string) $data; |
|
| 101 | 101 | |
| 102 | 102 | if ('true' === $data || '1' === $data) { |
| 103 | 103 | return true; |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | public function visitInteger($data, array $type): int |
| 112 | 112 | { |
| 113 | - return (integer)$data; |
|
| 113 | + return (integer) $data; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public function visitDouble($data, array $type): float |
| 117 | 117 | { |
| 118 | - return (double)$data; |
|
| 118 | + return (double) $data; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function visitArray($data, array $type): array |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $nodes = $data->xpath($entryName); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - if (!\count($nodes)) { |
|
| 163 | + if ( ! \count($nodes)) { |
|
| 164 | 164 | return []; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $nodes = $data->children($namespace)->$entryName; |
| 189 | 189 | foreach ($nodes as $v) { |
| 190 | 190 | $attrs = $v->attributes(); |
| 191 | - if (!isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 191 | + if ( ! isset($attrs[$this->currentMetadata->xmlKeyAttribute])) { |
|
| 192 | 192 | throw new RuntimeException(sprintf('The key attribute "%s" must be set for each entry of the map.', $this->currentMetadata->xmlKeyAttribute)); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -208,18 +208,18 @@ discard block |
||
| 208 | 208 | switch (true) { |
| 209 | 209 | // Check XML attribute without namespace for discriminatorFieldName |
| 210 | 210 | case $metadata->xmlDiscriminatorAttribute && null === $metadata->xmlDiscriminatorNamespace && isset($data->attributes()->{$metadata->discriminatorFieldName}): |
| 211 | - return (string)$data->attributes()->{$metadata->discriminatorFieldName}; |
|
| 211 | + return (string) $data->attributes()->{$metadata->discriminatorFieldName}; |
|
| 212 | 212 | |
| 213 | 213 | // Check XML attribute with namespace for discriminatorFieldName |
| 214 | 214 | case $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
| 215 | - return (string)$data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 215 | + return (string) $data->attributes($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 216 | 216 | |
| 217 | 217 | // Check XML element with namespace for discriminatorFieldName |
| 218 | - case !$metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 219 | - return (string)$data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 218 | + case ! $metadata->xmlDiscriminatorAttribute && null !== $metadata->xmlDiscriminatorNamespace && isset($data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}): |
|
| 219 | + return (string) $data->children($metadata->xmlDiscriminatorNamespace)->{$metadata->discriminatorFieldName}; |
|
| 220 | 220 | // Check XML element for discriminatorFieldName |
| 221 | 221 | case isset($data->{$metadata->discriminatorFieldName}): |
| 222 | - return (string)$data->{$metadata->discriminatorFieldName}; |
|
| 222 | + return (string) $data->{$metadata->discriminatorFieldName}; |
|
| 223 | 223 | |
| 224 | 224 | default: |
| 225 | 225 | throw new LogicException(sprintf( |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | { |
| 241 | 241 | $name = $metadata->serializedName; |
| 242 | 242 | |
| 243 | - if (!$metadata->type) { |
|
| 243 | + if ( ! $metadata->type) { |
|
| 244 | 244 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
| 245 | 245 | } |
| 246 | 246 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | if ($metadata->xmlCollection) { |
| 262 | 262 | $enclosingElem = $data; |
| 263 | - if (!$metadata->xmlCollectionInline) { |
|
| 263 | + if ( ! $metadata->xmlCollectionInline) { |
|
| 264 | 264 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | |
| 273 | 273 | if ($metadata->xmlNamespace) { |
| 274 | 274 | $node = $data->children($metadata->xmlNamespace)->$name; |
| 275 | - if (!$node->count()) { |
|
| 275 | + if ( ! $node->count()) { |
|
| 276 | 276 | throw new NotAcceptableException(); |
| 277 | 277 | } |
| 278 | 278 | } else { |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | if (isset($namespaces[''])) { |
| 283 | 283 | $prefix = uniqid('ns-'); |
| 284 | 284 | $data->registerXPathNamespace($prefix, $namespaces['']); |
| 285 | - $nodes = $data->xpath('./' . $prefix . ':' . $name); |
|
| 285 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
| 286 | 286 | } else { |
| 287 | - $nodes = $data->xpath('./' . $name); |
|
| 287 | + $nodes = $data->xpath('./'.$name); |
|
| 288 | 288 | } |
| 289 | 289 | if (empty($nodes)) { |
| 290 | 290 | throw new NotAcceptableException(); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | $xsiAttributes = $value->attributes('http://www.w3.org/2001/XMLSchema-instance'); |
| 399 | 399 | if (isset($xsiAttributes['nil']) |
| 400 | - && ((string)$xsiAttributes['nil'] === 'true' || (string)$xsiAttributes['nil'] === '1') |
|
| 400 | + && ((string) $xsiAttributes['nil'] === 'true' || (string) $xsiAttributes['nil'] === '1') |
|
| 401 | 401 | ) { |
| 402 | 402 | return true; |
| 403 | 403 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | private function getAccessorStrategy(): AccessorStrategyInterface |
| 133 | 133 | { |
| 134 | - if (!$this->accessorStrategy) { |
|
| 134 | + if ( ! $this->accessorStrategy) { |
|
| 135 | 135 | $this->accessorStrategy = new DefaultAccessorStrategy(); |
| 136 | 136 | |
| 137 | 137 | if ($this->expressionEvaluator) { |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | public function setCacheDir(string $dir): self |
| 173 | 173 | { |
| 174 | - if (!is_dir($dir)) { |
|
| 174 | + if ( ! is_dir($dir)) { |
|
| 175 | 175 | $this->createDir($dir); |
| 176 | 176 | } |
| 177 | - if (!is_writable($dir)) { |
|
| 177 | + if ( ! is_writable($dir)) { |
|
| 178 | 178 | throw new InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir)); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | public function setMetadataDirs(array $namespacePrefixToDirMap): self |
| 296 | 296 | { |
| 297 | 297 | foreach ($namespacePrefixToDirMap as $dir) { |
| 298 | - if (!is_dir($dir)) { |
|
| 298 | + if ( ! is_dir($dir)) { |
|
| 299 | 299 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 300 | 300 | } |
| 301 | 301 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function addMetadataDir(string $dir, string $namespacePrefix = ''): self |
| 335 | 335 | { |
| 336 | - if (!is_dir($dir)) { |
|
| 336 | + if ( ! is_dir($dir)) { |
|
| 337 | 337 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 338 | 338 | } |
| 339 | 339 | |
@@ -375,11 +375,11 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function replaceMetadataDir(string $dir, $namespacePrefix = ''): self |
| 377 | 377 | { |
| 378 | - if (!is_dir($dir)) { |
|
| 378 | + if ( ! is_dir($dir)) { |
|
| 379 | 379 | throw new InvalidArgumentException(sprintf('The directory "%s" does not exist.', $dir)); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - if (!isset($this->metadataDirs[$namespacePrefix])) { |
|
| 382 | + if ( ! isset($this->metadataDirs[$namespacePrefix])) { |
|
| 383 | 383 | throw new InvalidArgumentException(sprintf('There is no directory configured for namespace prefix "%s". Please use addMetadataDir() for adding new directories.', $namespacePrefix)); |
| 384 | 384 | } |
| 385 | 385 | |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | $annotationReader = new AnnotationReader(); |
| 443 | 443 | |
| 444 | 444 | if (null !== $this->cacheDir) { |
| 445 | - $this->createDir($this->cacheDir . '/annotations'); |
|
| 446 | - $annotationsCache = new FilesystemCache($this->cacheDir . '/annotations'); |
|
| 445 | + $this->createDir($this->cacheDir.'/annotations'); |
|
| 446 | + $annotationsCache = new FilesystemCache($this->cacheDir.'/annotations'); |
|
| 447 | 447 | $annotationReader = new CachedReader($annotationReader, $annotationsCache, $this->debug); |
| 448 | 448 | } |
| 449 | 449 | } |
@@ -459,19 +459,19 @@ discard block |
||
| 459 | 459 | $metadataFactory->setIncludeInterfaces($this->includeInterfaceMetadata); |
| 460 | 460 | |
| 461 | 461 | if (null !== $this->cacheDir) { |
| 462 | - $this->createDir($this->cacheDir . '/metadata'); |
|
| 463 | - $metadataFactory->setCache(new FileCache($this->cacheDir . '/metadata')); |
|
| 462 | + $this->createDir($this->cacheDir.'/metadata'); |
|
| 463 | + $metadataFactory->setCache(new FileCache($this->cacheDir.'/metadata')); |
|
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - if (!$this->handlersConfigured) { |
|
| 466 | + if ( ! $this->handlersConfigured) { |
|
| 467 | 467 | $this->addDefaultHandlers(); |
| 468 | 468 | } |
| 469 | 469 | |
| 470 | - if (!$this->listenersConfigured) { |
|
| 470 | + if ( ! $this->listenersConfigured) { |
|
| 471 | 471 | $this->addDefaultListeners(); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - if (!$this->visitorsAdded) { |
|
| 474 | + if ( ! $this->visitorsAdded) { |
|
| 475 | 475 | $this->addDefaultSerializationVisitors(); |
| 476 | 476 | $this->addDefaultDeserializationVisitors(); |
| 477 | 477 | } |