@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups); |
| 115 | 115 | } |
| 116 | 116 | } elseif ($annot instanceof XmlDiscriminator) { |
| 117 | - $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute; |
|
| 118 | - $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata; |
|
| 119 | - $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null; |
|
| 117 | + $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute; |
|
| 118 | + $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata; |
|
| 119 | + $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null; |
|
| 120 | 120 | } elseif ($annot instanceof VirtualProperty) { |
| 121 | 121 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp); |
| 122 | 122 | $propertiesMetadata[] = $virtualPropertyMetadata; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if (!$excludeAll) { |
|
| 153 | + if ( ! $excludeAll) { |
|
| 154 | 154 | foreach ($class->getProperties() as $property) { |
| 155 | 155 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 156 | 156 | continue; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } elseif ($annot instanceof Expose) { |
| 182 | 182 | $isExpose = true; |
| 183 | 183 | if (null !== $annot->if) { |
| 184 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
| 184 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
| 185 | 185 | } |
| 186 | 186 | } elseif ($annot instanceof Exclude) { |
| 187 | 187 | if (null !== $annot->if) { |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | $accessor = [$annot->getter, $annot->setter]; |
| 226 | 226 | } elseif ($annot instanceof Groups) { |
| 227 | 227 | $propertyMetadata->groups = $annot->groups; |
| 228 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
| 228 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
| 229 | 229 | if (false !== strpos($groupName, ',')) { |
| 230 | 230 | throw new InvalidArgumentException(sprintf( |
| 231 | 231 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 232 | 232 | implode(', ', $propertyMetadata->groups), |
| 233 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 233 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 234 | 234 | )); |
| 235 | 235 | } |
| 236 | 236 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $classMetadata->isList = true; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - if (!$propertyMetadata->serializedName) { |
|
| 250 | + if ( ! $propertyMetadata->serializedName) { |
|
| 251 | 251 | $propertyMetadata->serializedName = $this->namingStrategy->translateName($propertyMetadata); |
| 252 | 252 | } |
| 253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 260 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 261 | 261 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 262 | 262 | ) { |
| 263 | 263 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -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,13 +309,13 @@ 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 | |
@@ -323,16 +323,16 @@ discard block |
||
| 323 | 323 | $metadata->isList = true; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if (!$pMetadata->serializedName) { |
|
| 326 | + if ( ! $pMetadata->serializedName) { |
|
| 327 | 327 | $pMetadata->serializedName = $this->namingStrategy->translateName($pMetadata); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if (!empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 331 | - $pMetadata->name = (string)$name; |
|
| 330 | + if ( ! empty($pElem) && null !== $name = $pElem->attributes()->name) { |
|
| 331 | + $pMetadata->name = (string) $name; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 335 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 334 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 335 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 336 | 336 | ) { |
| 337 | 337 | |
| 338 | 338 | |
@@ -342,31 +342,31 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | foreach ($elem->xpath('./callback-method') as $method) { |
| 345 | - if (!isset($method->attributes()->type)) { |
|
| 345 | + if ( ! isset($method->attributes()->type)) { |
|
| 346 | 346 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 347 | 347 | } |
| 348 | - if (!isset($method->attributes()->name)) { |
|
| 348 | + if ( ! isset($method->attributes()->name)) { |
|
| 349 | 349 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - switch ((string)$method->attributes()->type) { |
|
| 352 | + switch ((string) $method->attributes()->type) { |
|
| 353 | 353 | case 'pre-serialize': |
| 354 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 354 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 355 | 355 | break; |
| 356 | 356 | |
| 357 | 357 | case 'post-serialize': |
| 358 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 358 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 359 | 359 | break; |
| 360 | 360 | |
| 361 | 361 | case 'post-deserialize': |
| 362 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 362 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 363 | 363 | break; |
| 364 | 364 | |
| 365 | 365 | case 'handler': |
| 366 | - if (!isset($method->attributes()->format)) { |
|
| 366 | + if ( ! isset($method->attributes()->format)) { |
|
| 367 | 367 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 368 | 368 | } |
| 369 | - if (!isset($method->attributes()->direction)) { |
|
| 369 | + if ( ! isset($method->attributes()->direction)) { |
|
| 370 | 370 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 371 | 371 | } |
| 372 | 372 | |
@@ -64,22 +64,22 @@ discard block |
||
| 64 | 64 | $class = $this->reflection->getDeclaringClass(); |
| 65 | 65 | |
| 66 | 66 | if (empty($getter)) { |
| 67 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 68 | - $getter = 'get' . $this->name; |
|
| 69 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 70 | - $getter = 'is' . $this->name; |
|
| 71 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 72 | - $getter = 'has' . $this->name; |
|
| 67 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 68 | + $getter = 'get'.$this->name; |
|
| 69 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 70 | + $getter = 'is'.$this->name; |
|
| 71 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 72 | + $getter = 'has'.$this->name; |
|
| 73 | 73 | } else { |
| 74 | - throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get' . ucfirst($this->name), 'is' . ucfirst($this->name), 'has' . ucfirst($this->name), $this->class, $this->name)); |
|
| 74 | + throw new RuntimeException(sprintf('There is neither a public %s method, nor a public %s method, nor a public %s method in class %s. Please specify which public method should be used for retrieving the value of the property %s.', 'get'.ucfirst($this->name), 'is'.ucfirst($this->name), 'has'.ucfirst($this->name), $this->class, $this->name)); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (empty($setter) && !$this->readOnly) { |
|
| 79 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 80 | - $setter = 'set' . $this->name; |
|
| 78 | + if (empty($setter) && ! $this->readOnly) { |
|
| 79 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 80 | + $setter = 'set'.$this->name; |
|
| 81 | 81 | } else { |
| 82 | - throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set' . ucfirst($this->name), $this->class, $this->name)); |
|
| 82 | + throw new RuntimeException(sprintf('There is no public %s method in class %s. Please specify which public method should be used for setting the value of the property %s.', 'set'.ucfirst($this->name), $this->class, $this->name)); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | return is_array($type) |
| 109 | 109 | && $type['name'] === 'array' |
| 110 | 110 | && isset($type['params'][0]) |
| 111 | - && !isset($type['params'][1]); |
|
| 111 | + && ! isset($type['params'][1]); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public static function isCollectionMap(array $type = null): bool |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $rs = isset($type['params'][1]) ? new \ArrayObject() : []; |
| 81 | 81 | |
| 82 | - $isList = isset($type['params'][0]) && !isset($type['params'][1]); |
|
| 82 | + $isList = isset($type['params'][0]) && ! isset($type['params'][1]); |
|
| 83 | 83 | |
| 84 | 84 | $elType = $this->getElementType($type); |
| 85 | 85 | foreach ($data as $k => $v) { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->data = $this->dataStack->pop(); |
| 114 | 114 | |
| 115 | 115 | if ($metadata->isList) { |
| 116 | - return array_values((array)$rs); |
|
| 116 | + return array_values((array) $rs); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | return $rs; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | if ($metadata->inline) { |
| 135 | 135 | if (\is_array($v) || ($v instanceof \ArrayObject)) { |
| 136 | - $this->data->exchangeArray(array_merge((array)$this->data, (array)$v)); |
|
| 136 | + $this->data->exchangeArray(array_merge((array) $this->data, (array) $v)); |
|
| 137 | 137 | } |
| 138 | 138 | } else { |
| 139 | 139 | $this->data[$metadata->serializedName] = $v; |