@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function startVisiting($object) |
| 51 | 51 | { |
| 52 | - if (!is_object($object)) { |
|
| 52 | + if ( ! is_object($object)) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | $this->visitingSet->attach($object); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function stopVisiting($object) |
| 60 | 60 | { |
| 61 | - if (!is_object($object)) { |
|
| 61 | + if ( ! is_object($object)) { |
|
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | 64 | $this->visitingSet->detach($object); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function isVisiting($object) |
| 73 | 73 | { |
| 74 | - if (!is_object($object)) { |
|
| 74 | + if ( ! is_object($object)) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $path[] = get_class($obj); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if (!$path) { |
|
| 88 | + if ( ! $path) { |
|
| 89 | 89 | return null; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function getObject() |
| 106 | 106 | { |
| 107 | - return !$this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 107 | + return ! $this->visitingStack->isEmpty() ? $this->visitingStack->top() : null; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function getVisitingStack() |
@@ -59,22 +59,22 @@ |
||
| 59 | 59 | $class = $this->reflection->getDeclaringClass(); |
| 60 | 60 | |
| 61 | 61 | if (empty($getter)) { |
| 62 | - if ($class->hasMethod('get' . $this->name) && $class->getMethod('get' . $this->name)->isPublic()) { |
|
| 63 | - $getter = 'get' . $this->name; |
|
| 64 | - } elseif ($class->hasMethod('is' . $this->name) && $class->getMethod('is' . $this->name)->isPublic()) { |
|
| 65 | - $getter = 'is' . $this->name; |
|
| 66 | - } elseif ($class->hasMethod('has' . $this->name) && $class->getMethod('has' . $this->name)->isPublic()) { |
|
| 67 | - $getter = 'has' . $this->name; |
|
| 62 | + if ($class->hasMethod('get'.$this->name) && $class->getMethod('get'.$this->name)->isPublic()) { |
|
| 63 | + $getter = 'get'.$this->name; |
|
| 64 | + } elseif ($class->hasMethod('is'.$this->name) && $class->getMethod('is'.$this->name)->isPublic()) { |
|
| 65 | + $getter = 'is'.$this->name; |
|
| 66 | + } elseif ($class->hasMethod('has'.$this->name) && $class->getMethod('has'.$this->name)->isPublic()) { |
|
| 67 | + $getter = 'has'.$this->name; |
|
| 68 | 68 | } else { |
| 69 | - 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)); |
|
| 69 | + 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)); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (empty($setter) && !$this->readOnly) { |
|
| 74 | - if ($class->hasMethod('set' . $this->name) && $class->getMethod('set' . $this->name)->isPublic()) { |
|
| 75 | - $setter = 'set' . $this->name; |
|
| 73 | + if (empty($setter) && ! $this->readOnly) { |
|
| 74 | + if ($class->hasMethod('set'.$this->name) && $class->getMethod('set'.$this->name)->isPublic()) { |
|
| 75 | + $setter = 'set'.$this->name; |
|
| 76 | 76 | } else { |
| 77 | - 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)); |
|
| 77 | + 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)); |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setAccessorOrder($order, array $customOrder = array()) |
| 90 | 90 | { |
| 91 | - if (!in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 91 | + if ( ! in_array($order, array(self::ACCESSOR_ORDER_UNDEFINED, self::ACCESSOR_ORDER_ALPHABETICAL, self::ACCESSOR_ORDER_CUSTOM), true)) { |
|
| 92 | 92 | throw new InvalidArgumentException(sprintf('The accessor order "%s" is invalid.', $order)); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | foreach ($customOrder as $name) { |
| 96 | - if (!is_string($name)) { |
|
| 96 | + if ( ! is_string($name)) { |
|
| 97 | 97 | throw new InvalidArgumentException(sprintf('$customOrder is expected to be a list of strings, but got element of value %s.', json_encode($name))); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | public function merge(MergeableInterface $object) |
| 131 | 131 | { |
| 132 | - if (!$object instanceof ClassMetadata) { |
|
| 132 | + if ( ! $object instanceof ClassMetadata) { |
|
| 133 | 133 | throw new InvalidArgumentException('$object must be an instance of ClassMetadata.'); |
| 134 | 134 | } |
| 135 | 135 | parent::merge($object); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $this->discriminatorBaseClass, |
| 154 | 154 | $this->discriminatorBaseClass |
| 155 | 155 | )); |
| 156 | - } elseif (!$this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 156 | + } elseif ( ! $this->discriminatorFieldName && $object->discriminatorFieldName) { |
|
| 157 | 157 | $this->discriminatorFieldName = $object->discriminatorFieldName; |
| 158 | 158 | $this->discriminatorMap = $object->discriminatorMap; |
| 159 | 159 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $this->discriminatorBaseClass = $object->discriminatorBaseClass; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ($this->discriminatorMap && !$this->reflection->isAbstract()) { |
|
| 171 | + if ($this->discriminatorMap && ! $this->reflection->isAbstract()) { |
|
| 172 | 172 | if (false === $typeValue = array_search($this->name, $this->discriminatorMap, true)) { |
| 173 | 173 | throw new \LogicException(sprintf( |
| 174 | 174 | 'The sub-class "%s" is not listed in the discriminator of the base class "%s".', |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->discriminatorValue = $typeValue; |
| 181 | 181 | |
| 182 | 182 | if (isset($this->propertyMetadata[$this->discriminatorFieldName]) |
| 183 | - && !$this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 183 | + && ! $this->propertyMetadata[$this->discriminatorFieldName] instanceof StaticPropertyMetadata |
|
| 184 | 184 | ) { |
| 185 | 185 | throw new \LogicException(sprintf( |
| 186 | 186 | 'The discriminator field name "%s" of the base-class "%s" conflicts with a regular property of the sub-class "%s".', |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | public function registerNamespace($uri, $prefix = null) |
| 209 | 209 | { |
| 210 | - if (!is_string($uri)) { |
|
| 210 | + if ( ! is_string($uri)) { |
|
| 211 | 211 | throw new InvalidArgumentException(sprintf('$uri is expected to be a strings, but got value %s.', json_encode($uri))); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | if ($prefix !== null) { |
| 215 | - if (!is_string($prefix)) { |
|
| 215 | + if ( ! is_string($prefix)) { |
|
| 216 | 216 | throw new InvalidArgumentException(sprintf('$prefix is expected to be a strings, but got value %s.', json_encode($prefix))); |
| 217 | 217 | } |
| 218 | 218 | } else { |
@@ -300,19 +300,19 @@ discard block |
||
| 300 | 300 | case self::ACCESSOR_ORDER_CUSTOM: |
| 301 | 301 | $order = $this->customOrder; |
| 302 | 302 | $currentSorting = $this->propertyMetadata ? array_combine(array_keys($this->propertyMetadata), range(1, count($this->propertyMetadata))) : []; |
| 303 | - uksort($this->propertyMetadata, function ($a, $b) use ($order, $currentSorting) { |
|
| 303 | + uksort($this->propertyMetadata, function($a, $b) use ($order, $currentSorting) { |
|
| 304 | 304 | $existsA = isset($order[$a]); |
| 305 | 305 | $existsB = isset($order[$b]); |
| 306 | 306 | |
| 307 | - if (!$existsA && !$existsB) { |
|
| 307 | + if ( ! $existsA && ! $existsB) { |
|
| 308 | 308 | return $currentSorting[$a] - $currentSorting[$b]; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if (!$existsA) { |
|
| 311 | + if ( ! $existsA) { |
|
| 312 | 312 | return 1; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - if (!$existsB) { |
|
| 315 | + if ( ! $existsB) { |
|
| 316 | 316 | return -1; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $metadata = new ClassMetadata($name = $class->name); |
| 47 | - if (!$elems = $elem->xpath("./class[@name = '" . $name . "']")) { |
|
| 47 | + if ( ! $elems = $elem->xpath("./class[@name = '".$name."']")) { |
|
| 48 | 48 | throw new RuntimeException(sprintf('Could not find class %s inside XML element.', $name)); |
| 49 | 49 | } |
| 50 | 50 | $elem = reset($elems); |
@@ -53,88 +53,88 @@ discard block |
||
| 53 | 53 | $metadata->fileResources[] = $class->getFileName(); |
| 54 | 54 | $exclusionPolicy = strtoupper($elem->attributes()->{'exclusion-policy'}) ?: 'NONE'; |
| 55 | 55 | $excludeAll = null !== ($exclude = $elem->attributes()->exclude) ? 'true' === strtolower($exclude) : false; |
| 56 | - $classAccessType = (string)($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 56 | + $classAccessType = (string) ($elem->attributes()->{'access-type'} ?: PropertyMetadata::ACCESS_TYPE_PROPERTY); |
|
| 57 | 57 | |
| 58 | 58 | $propertiesMetadata = array(); |
| 59 | 59 | $propertiesNodes = array(); |
| 60 | 60 | |
| 61 | 61 | if (null !== $accessorOrder = $elem->attributes()->{'accessor-order'}) { |
| 62 | - $metadata->setAccessorOrder((string)$accessorOrder, preg_split('/\s*,\s*/', (string)$elem->attributes()->{'custom-accessor-order'})); |
|
| 62 | + $metadata->setAccessorOrder((string) $accessorOrder, preg_split('/\s*,\s*/', (string) $elem->attributes()->{'custom-accessor-order'})); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (null !== $xmlRootName = $elem->attributes()->{'xml-root-name'}) { |
| 66 | - $metadata->xmlRootName = (string)$xmlRootName; |
|
| 66 | + $metadata->xmlRootName = (string) $xmlRootName; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (null !== $xmlRootNamespace = $elem->attributes()->{'xml-root-namespace'}) { |
| 70 | - $metadata->xmlRootNamespace = (string)$xmlRootNamespace; |
|
| 70 | + $metadata->xmlRootNamespace = (string) $xmlRootNamespace; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $readOnlyClass = 'true' === strtolower($elem->attributes()->{'read-only'}); |
| 74 | 74 | |
| 75 | - $discriminatorFieldName = (string)$elem->attributes()->{'discriminator-field-name'}; |
|
| 75 | + $discriminatorFieldName = (string) $elem->attributes()->{'discriminator-field-name'}; |
|
| 76 | 76 | $discriminatorMap = array(); |
| 77 | 77 | foreach ($elem->xpath('./discriminator-class') as $entry) { |
| 78 | - if (!isset($entry->attributes()->value)) { |
|
| 78 | + if ( ! isset($entry->attributes()->value)) { |
|
| 79 | 79 | throw new RuntimeException('Each discriminator-class element must have a "value" attribute.'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $discriminatorMap[(string)$entry->attributes()->value] = (string)$entry; |
|
| 82 | + $discriminatorMap[(string) $entry->attributes()->value] = (string) $entry; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if ('true' === (string)$elem->attributes()->{'discriminator-disabled'}) { |
|
| 85 | + if ('true' === (string) $elem->attributes()->{'discriminator-disabled'}) { |
|
| 86 | 86 | $metadata->discriminatorDisabled = true; |
| 87 | - } elseif (!empty($discriminatorFieldName) || !empty($discriminatorMap)) { |
|
| 87 | + } elseif ( ! empty($discriminatorFieldName) || ! empty($discriminatorMap)) { |
|
| 88 | 88 | |
| 89 | 89 | $discriminatorGroups = array(); |
| 90 | 90 | foreach ($elem->xpath('./discriminator-groups/group') as $entry) { |
| 91 | - $discriminatorGroups[] = (string)$entry; |
|
| 91 | + $discriminatorGroups[] = (string) $entry; |
|
| 92 | 92 | } |
| 93 | 93 | $metadata->setDiscriminator($discriminatorFieldName, $discriminatorMap, $discriminatorGroups); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | foreach ($elem->xpath('./xml-namespace') as $xmlNamespace) { |
| 97 | - if (!isset($xmlNamespace->attributes()->uri)) { |
|
| 97 | + if ( ! isset($xmlNamespace->attributes()->uri)) { |
|
| 98 | 98 | throw new RuntimeException('The prefix attribute must be set for all xml-namespace elements.'); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if (isset($xmlNamespace->attributes()->prefix)) { |
| 102 | - $prefix = (string)$xmlNamespace->attributes()->prefix; |
|
| 102 | + $prefix = (string) $xmlNamespace->attributes()->prefix; |
|
| 103 | 103 | } else { |
| 104 | 104 | $prefix = null; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $metadata->registerNamespace((string)$xmlNamespace->attributes()->uri, $prefix); |
|
| 107 | + $metadata->registerNamespace((string) $xmlNamespace->attributes()->uri, $prefix); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | foreach ($elem->xpath('./xml-discriminator') as $xmlDiscriminator) { |
| 111 | 111 | if (isset($xmlDiscriminator->attributes()->attribute)) { |
| 112 | - $metadata->xmlDiscriminatorAttribute = (string)$xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 112 | + $metadata->xmlDiscriminatorAttribute = (string) $xmlDiscriminator->attributes()->attribute === 'true'; |
|
| 113 | 113 | } |
| 114 | 114 | if (isset($xmlDiscriminator->attributes()->cdata)) { |
| 115 | - $metadata->xmlDiscriminatorCData = (string)$xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 115 | + $metadata->xmlDiscriminatorCData = (string) $xmlDiscriminator->attributes()->cdata === 'true'; |
|
| 116 | 116 | } |
| 117 | 117 | if (isset($xmlDiscriminator->attributes()->namespace)) { |
| 118 | - $metadata->xmlDiscriminatorNamespace = (string)$xmlDiscriminator->attributes()->namespace; |
|
| 118 | + $metadata->xmlDiscriminatorNamespace = (string) $xmlDiscriminator->attributes()->namespace; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | foreach ($elem->xpath('./virtual-property') as $method) { |
| 123 | 123 | |
| 124 | 124 | if (isset($method->attributes()->expression)) { |
| 125 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string)$method->attributes()->name, (string)$method->attributes()->expression); |
|
| 125 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, (string) $method->attributes()->name, (string) $method->attributes()->expression); |
|
| 126 | 126 | } else { |
| 127 | - if (!isset($method->attributes()->method)) { |
|
| 127 | + if ( ! isset($method->attributes()->method)) { |
|
| 128 | 128 | throw new RuntimeException('The method attribute must be set for all virtual-property elements.'); |
| 129 | 129 | } |
| 130 | - $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string)$method->attributes()->method); |
|
| 130 | + $virtualPropertyMetadata = new VirtualPropertyMetadata($name, (string) $method->attributes()->method); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $propertiesMetadata[] = $virtualPropertyMetadata; |
| 134 | 134 | $propertiesNodes[] = $method; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if (!$excludeAll) { |
|
| 137 | + if ( ! $excludeAll) { |
|
| 138 | 138 | |
| 139 | 139 | foreach ($class->getProperties() as $property) { |
| 140 | 140 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $propertiesMetadata[] = new PropertyMetadata($name, $pName = $property->getName()); |
| 145 | - $pElems = $elem->xpath("./property[@name = '" . $pName . "']"); |
|
| 145 | + $pElems = $elem->xpath("./property[@name = '".$pName."']"); |
|
| 146 | 146 | |
| 147 | 147 | $propertiesNodes[] = $pElems ? reset($pElems) : null; |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | || $pMetadata instanceof ExpressionPropertyMetadata; |
| 155 | 155 | |
| 156 | 156 | $pElem = $propertiesNodes[$propertyKey]; |
| 157 | - if (!empty($pElem)) { |
|
| 157 | + if ( ! empty($pElem)) { |
|
| 158 | 158 | |
| 159 | 159 | if (null !== $exclude = $pElem->attributes()->exclude) { |
| 160 | 160 | $isExclude = 'true' === strtolower($exclude); |
@@ -173,26 +173,26 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | if (null !== $excludeIf = $pElem->attributes()->{'expose-if'}) { |
| 176 | - $pMetadata->excludeIf = "!(" . $excludeIf . ")"; |
|
| 176 | + $pMetadata->excludeIf = "!(".$excludeIf.")"; |
|
| 177 | 177 | $isExpose = true; |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | if (null !== $version = $pElem->attributes()->{'since-version'}) { |
| 181 | - $pMetadata->sinceVersion = (string)$version; |
|
| 181 | + $pMetadata->sinceVersion = (string) $version; |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (null !== $version = $pElem->attributes()->{'until-version'}) { |
| 185 | - $pMetadata->untilVersion = (string)$version; |
|
| 185 | + $pMetadata->untilVersion = (string) $version; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if (null !== $serializedName = $pElem->attributes()->{'serialized-name'}) { |
| 189 | - $pMetadata->serializedName = (string)$serializedName; |
|
| 189 | + $pMetadata->serializedName = (string) $serializedName; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if (null !== $type = $pElem->attributes()->type) { |
| 193 | - $pMetadata->setType((string)$type); |
|
| 193 | + $pMetadata->setType((string) $type); |
|
| 194 | 194 | } elseif (isset($pElem->type)) { |
| 195 | - $pMetadata->setType((string)$pElem->type); |
|
| 195 | + $pMetadata->setType((string) $pElem->type); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (null !== $groups = $pElem->attributes()->groups) { |
@@ -207,21 +207,21 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | $colConfig = $pElem->{'xml-list'}; |
| 209 | 209 | if (isset($colConfig->attributes()->inline)) { |
| 210 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 210 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 214 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 214 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (isset($colConfig->attributes()->{'skip-when-empty'})) { |
| 218 | - $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string)$colConfig->attributes()->{'skip-when-empty'}; |
|
| 218 | + $pMetadata->xmlCollectionSkipWhenEmpty = 'true' === (string) $colConfig->attributes()->{'skip-when-empty'}; |
|
| 219 | 219 | } else { |
| 220 | 220 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | if (isset($colConfig->attributes()->namespace)) { |
| 224 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 224 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
@@ -230,51 +230,51 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $colConfig = $pElem->{'xml-map'}; |
| 232 | 232 | if (isset($colConfig->attributes()->inline)) { |
| 233 | - $pMetadata->xmlCollectionInline = 'true' === (string)$colConfig->attributes()->inline; |
|
| 233 | + $pMetadata->xmlCollectionInline = 'true' === (string) $colConfig->attributes()->inline; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (isset($colConfig->attributes()->{'entry-name'})) { |
| 237 | - $pMetadata->xmlEntryName = (string)$colConfig->attributes()->{'entry-name'}; |
|
| 237 | + $pMetadata->xmlEntryName = (string) $colConfig->attributes()->{'entry-name'}; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | if (isset($colConfig->attributes()->namespace)) { |
| 241 | - $pMetadata->xmlEntryNamespace = (string)$colConfig->attributes()->namespace; |
|
| 241 | + $pMetadata->xmlEntryNamespace = (string) $colConfig->attributes()->namespace; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | if (isset($colConfig->attributes()->{'key-attribute-name'})) { |
| 245 | - $pMetadata->xmlKeyAttribute = (string)$colConfig->attributes()->{'key-attribute-name'}; |
|
| 245 | + $pMetadata->xmlKeyAttribute = (string) $colConfig->attributes()->{'key-attribute-name'}; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | if (isset($pElem->{'xml-element'})) { |
| 250 | 250 | $colConfig = $pElem->{'xml-element'}; |
| 251 | 251 | if (isset($colConfig->attributes()->cdata)) { |
| 252 | - $pMetadata->xmlElementCData = 'true' === (string)$colConfig->attributes()->cdata; |
|
| 252 | + $pMetadata->xmlElementCData = 'true' === (string) $colConfig->attributes()->cdata; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (isset($colConfig->attributes()->namespace)) { |
| 256 | - $pMetadata->xmlNamespace = (string)$colConfig->attributes()->namespace; |
|
| 256 | + $pMetadata->xmlNamespace = (string) $colConfig->attributes()->namespace; |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | if (isset($pElem->attributes()->{'xml-attribute'})) { |
| 261 | - $pMetadata->xmlAttribute = 'true' === (string)$pElem->attributes()->{'xml-attribute'}; |
|
| 261 | + $pMetadata->xmlAttribute = 'true' === (string) $pElem->attributes()->{'xml-attribute'}; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | if (isset($pElem->attributes()->{'xml-attribute-map'})) { |
| 265 | - $pMetadata->xmlAttributeMap = 'true' === (string)$pElem->attributes()->{'xml-attribute-map'}; |
|
| 265 | + $pMetadata->xmlAttributeMap = 'true' === (string) $pElem->attributes()->{'xml-attribute-map'}; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | if (isset($pElem->attributes()->{'xml-value'})) { |
| 269 | - $pMetadata->xmlValue = 'true' === (string)$pElem->attributes()->{'xml-value'}; |
|
| 269 | + $pMetadata->xmlValue = 'true' === (string) $pElem->attributes()->{'xml-value'}; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (isset($pElem->attributes()->{'xml-key-value-pairs'})) { |
| 273 | - $pMetadata->xmlKeyValuePairs = 'true' === (string)$pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 273 | + $pMetadata->xmlKeyValuePairs = 'true' === (string) $pElem->attributes()->{'xml-key-value-pairs'}; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | if (isset($pElem->attributes()->{'max-depth'})) { |
| 277 | - $pMetadata->maxDepth = (int)$pElem->attributes()->{'max-depth'}; |
|
| 277 | + $pMetadata->maxDepth = (int) $pElem->attributes()->{'max-depth'}; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | //we need read-only before setter and getter set, because that method depends on flag being set |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | $getter = $pElem->attributes()->{'accessor-getter'}; |
| 288 | 288 | $setter = $pElem->attributes()->{'accessor-setter'}; |
| 289 | 289 | $pMetadata->setAccessor( |
| 290 | - (string)($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 291 | - $getter ? (string)$getter : null, |
|
| 292 | - $setter ? (string)$setter : null |
|
| 290 | + (string) ($pElem->attributes()->{'access-type'} ?: $classAccessType), |
|
| 291 | + $getter ? (string) $getter : null, |
|
| 292 | + $setter ? (string) $setter : null |
|
| 293 | 293 | ); |
| 294 | 294 | |
| 295 | 295 | if (null !== $inline = $pElem->attributes()->inline) { |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if ((ExclusionPolicy::NONE === (string)$exclusionPolicy && !$isExclude) |
|
| 302 | - || (ExclusionPolicy::ALL === (string)$exclusionPolicy && $isExpose) |
|
| 301 | + if ((ExclusionPolicy::NONE === (string) $exclusionPolicy && ! $isExclude) |
|
| 302 | + || (ExclusionPolicy::ALL === (string) $exclusionPolicy && $isExpose) |
|
| 303 | 303 | ) { |
| 304 | 304 | |
| 305 | 305 | $metadata->addPropertyMetadata($pMetadata); |
@@ -308,37 +308,37 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | foreach ($elem->xpath('./callback-method') as $method) { |
| 311 | - if (!isset($method->attributes()->type)) { |
|
| 311 | + if ( ! isset($method->attributes()->type)) { |
|
| 312 | 312 | throw new RuntimeException('The type attribute must be set for all callback-method elements.'); |
| 313 | 313 | } |
| 314 | - if (!isset($method->attributes()->name)) { |
|
| 314 | + if ( ! isset($method->attributes()->name)) { |
|
| 315 | 315 | throw new RuntimeException('The name attribute must be set for all callback-method elements.'); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - switch ((string)$method->attributes()->type) { |
|
| 318 | + switch ((string) $method->attributes()->type) { |
|
| 319 | 319 | case 'pre-serialize': |
| 320 | - $metadata->addPreSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 320 | + $metadata->addPreSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 321 | 321 | break; |
| 322 | 322 | |
| 323 | 323 | case 'post-serialize': |
| 324 | - $metadata->addPostSerializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 324 | + $metadata->addPostSerializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 325 | 325 | break; |
| 326 | 326 | |
| 327 | 327 | case 'post-deserialize': |
| 328 | - $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string)$method->attributes()->name)); |
|
| 328 | + $metadata->addPostDeserializeMethod(new MethodMetadata($name, (string) $method->attributes()->name)); |
|
| 329 | 329 | break; |
| 330 | 330 | |
| 331 | 331 | case 'handler': |
| 332 | - if (!isset($method->attributes()->format)) { |
|
| 332 | + if ( ! isset($method->attributes()->format)) { |
|
| 333 | 333 | throw new RuntimeException('The format attribute must be set for "handler" callback methods.'); |
| 334 | 334 | } |
| 335 | - if (!isset($method->attributes()->direction)) { |
|
| 335 | + if ( ! isset($method->attributes()->direction)) { |
|
| 336 | 336 | throw new RuntimeException('The direction attribute must be set for "handler" callback methods.'); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $direction = GraphNavigator::parseDirection((string)$method->attributes()->direction); |
|
| 340 | - $format = (string)$method->attributes()->format; |
|
| 341 | - $metadata->addHandlerCallback($direction, $format, (string)$method->attributes()->name); |
|
| 339 | + $direction = GraphNavigator::parseDirection((string) $method->attributes()->direction); |
|
| 340 | + $format = (string) $method->attributes()->format; |
|
| 341 | + $metadata->addHandlerCallback($direction, $format, (string) $method->attributes()->name); |
|
| 342 | 342 | |
| 343 | 343 | break; |
| 344 | 344 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $config = Yaml::parse(file_get_contents($file)); |
| 37 | 37 | |
| 38 | - if (!isset($config[$name = $class->name])) { |
|
| 38 | + if ( ! isset($config[$name = $class->name])) { |
|
| 39 | 39 | throw new RuntimeException(sprintf('Expected metadata for class %s to be defined in %s.', $class->name, $file)); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | $metadata->fileResources[] = $file; |
| 45 | 45 | $metadata->fileResources[] = $class->getFileName(); |
| 46 | 46 | $exclusionPolicy = isset($config['exclusion_policy']) ? strtoupper($config['exclusion_policy']) : 'NONE'; |
| 47 | - $excludeAll = isset($config['exclude']) ? (Boolean)$config['exclude'] : false; |
|
| 47 | + $excludeAll = isset($config['exclude']) ? (Boolean) $config['exclude'] : false; |
|
| 48 | 48 | $classAccessType = isset($config['access_type']) ? $config['access_type'] : PropertyMetadata::ACCESS_TYPE_PROPERTY; |
| 49 | - $readOnlyClass = isset($config['read_only']) ? (Boolean)$config['read_only'] : false; |
|
| 49 | + $readOnlyClass = isset($config['read_only']) ? (Boolean) $config['read_only'] : false; |
|
| 50 | 50 | $this->addClassProperties($metadata, $config); |
| 51 | 51 | |
| 52 | 52 | $propertiesMetadata = array(); |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | } else { |
| 60 | 60 | |
| 61 | - if (!$class->hasMethod($methodName)) { |
|
| 62 | - throw new RuntimeException('The method ' . $methodName . ' not found in class ' . $class->name); |
|
| 61 | + if ( ! $class->hasMethod($methodName)) { |
|
| 62 | + throw new RuntimeException('The method '.$methodName.' not found in class '.$class->name); |
|
| 63 | 63 | } |
| 64 | 64 | $virtualPropertyMetadata = new VirtualPropertyMetadata($name, $methodName); |
| 65 | 65 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (!$excludeAll) { |
|
| 71 | + if ( ! $excludeAll) { |
|
| 72 | 72 | foreach ($class->getProperties() as $property) { |
| 73 | 73 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 74 | 74 | continue; |
@@ -88,39 +88,39 @@ discard block |
||
| 88 | 88 | $pConfig = $config['properties'][$pName]; |
| 89 | 89 | |
| 90 | 90 | if (isset($pConfig['exclude'])) { |
| 91 | - $isExclude = (Boolean)$pConfig['exclude']; |
|
| 91 | + $isExclude = (Boolean) $pConfig['exclude']; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | if (isset($pConfig['expose'])) { |
| 95 | - $isExpose = (Boolean)$pConfig['expose']; |
|
| 95 | + $isExpose = (Boolean) $pConfig['expose']; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if (isset($pConfig['skip_when_empty'])) { |
| 99 | - $pMetadata->skipWhenEmpty = (Boolean)$pConfig['skip_when_empty']; |
|
| 99 | + $pMetadata->skipWhenEmpty = (Boolean) $pConfig['skip_when_empty']; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | if (isset($pConfig['since_version'])) { |
| 103 | - $pMetadata->sinceVersion = (string)$pConfig['since_version']; |
|
| 103 | + $pMetadata->sinceVersion = (string) $pConfig['since_version']; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if (isset($pConfig['until_version'])) { |
| 107 | - $pMetadata->untilVersion = (string)$pConfig['until_version']; |
|
| 107 | + $pMetadata->untilVersion = (string) $pConfig['until_version']; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | if (isset($pConfig['exclude_if'])) { |
| 111 | - $pMetadata->excludeIf = (string)$pConfig['exclude_if']; |
|
| 111 | + $pMetadata->excludeIf = (string) $pConfig['exclude_if']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if (isset($pConfig['expose_if'])) { |
| 115 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'] . ")"; |
|
| 115 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (isset($pConfig['serialized_name'])) { |
| 119 | - $pMetadata->serializedName = (string)$pConfig['serialized_name']; |
|
| 119 | + $pMetadata->serializedName = (string) $pConfig['serialized_name']; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if (isset($pConfig['type'])) { |
| 123 | - $pMetadata->setType((string)$pConfig['type']); |
|
| 123 | + $pMetadata->setType((string) $pConfig['type']); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if (isset($pConfig['groups'])) { |
@@ -132,21 +132,21 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $colConfig = $pConfig['xml_list']; |
| 134 | 134 | if (isset($colConfig['inline'])) { |
| 135 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 135 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | if (isset($colConfig['entry_name'])) { |
| 139 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 139 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset($colConfig['skip_when_empty'])) { |
| 143 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
| 143 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
| 144 | 144 | } else { |
| 145 | 145 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if (isset($colConfig['namespace'])) { |
| 149 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 149 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $colConfig = $pConfig['xml_map']; |
| 157 | 157 | if (isset($colConfig['inline'])) { |
| 158 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 158 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if (isset($colConfig['entry_name'])) { |
| 162 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 162 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if (isset($colConfig['namespace'])) { |
| 166 | - $pMetadata->xmlEntryNamespace = (string)$colConfig['namespace']; |
|
| 166 | + $pMetadata->xmlEntryNamespace = (string) $colConfig['namespace']; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | if (isset($colConfig['key_attribute_name'])) { |
@@ -175,33 +175,33 @@ discard block |
||
| 175 | 175 | if (isset($pConfig['xml_element'])) { |
| 176 | 176 | $colConfig = $pConfig['xml_element']; |
| 177 | 177 | if (isset($colConfig['cdata'])) { |
| 178 | - $pMetadata->xmlElementCData = (Boolean)$colConfig['cdata']; |
|
| 178 | + $pMetadata->xmlElementCData = (Boolean) $colConfig['cdata']; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | if (isset($colConfig['namespace'])) { |
| 182 | - $pMetadata->xmlNamespace = (string)$colConfig['namespace']; |
|
| 182 | + $pMetadata->xmlNamespace = (string) $colConfig['namespace']; |
|
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if (isset($pConfig['xml_attribute'])) { |
| 187 | - $pMetadata->xmlAttribute = (Boolean)$pConfig['xml_attribute']; |
|
| 187 | + $pMetadata->xmlAttribute = (Boolean) $pConfig['xml_attribute']; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if (isset($pConfig['xml_attribute_map'])) { |
| 191 | - $pMetadata->xmlAttributeMap = (Boolean)$pConfig['xml_attribute_map']; |
|
| 191 | + $pMetadata->xmlAttributeMap = (Boolean) $pConfig['xml_attribute_map']; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | if (isset($pConfig['xml_value'])) { |
| 195 | - $pMetadata->xmlValue = (Boolean)$pConfig['xml_value']; |
|
| 195 | + $pMetadata->xmlValue = (Boolean) $pConfig['xml_value']; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (isset($pConfig['xml_key_value_pairs'])) { |
| 199 | - $pMetadata->xmlKeyValuePairs = (Boolean)$pConfig['xml_key_value_pairs']; |
|
| 199 | + $pMetadata->xmlKeyValuePairs = (Boolean) $pConfig['xml_key_value_pairs']; |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | //we need read_only before setter and getter set, because that method depends on flag being set |
| 203 | 203 | if (isset($pConfig['read_only'])) { |
| 204 | - $pMetadata->readOnly = (Boolean)$pConfig['read_only']; |
|
| 204 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
| 205 | 205 | } else { |
| 206 | 206 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 207 | 207 | } |
@@ -213,14 +213,14 @@ discard block |
||
| 213 | 213 | ); |
| 214 | 214 | |
| 215 | 215 | if (isset($pConfig['inline'])) { |
| 216 | - $pMetadata->inline = (Boolean)$pConfig['inline']; |
|
| 216 | + $pMetadata->inline = (Boolean) $pConfig['inline']; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (isset($pConfig['max_depth'])) { |
| 220 | - $pMetadata->maxDepth = (int)$pConfig['max_depth']; |
|
| 220 | + $pMetadata->maxDepth = (int) $pConfig['max_depth']; |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 223 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 224 | 224 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 225 | 225 | ) { |
| 226 | 226 | $metadata->addPropertyMetadata($pMetadata); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | private function addClassProperties(ClassMetadata $metadata, array $config) |
| 263 | 263 | { |
| 264 | - if (isset($config['custom_accessor_order']) && !isset($config['accessor_order'])) { |
|
| 264 | + if (isset($config['custom_accessor_order']) && ! isset($config['accessor_order'])) { |
|
| 265 | 265 | $config['accessor_order'] = 'custom'; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | if (isset($config['xml_root_name'])) { |
| 273 | - $metadata->xmlRootName = (string)$config['xml_root_name']; |
|
| 273 | + $metadata->xmlRootName = (string) $config['xml_root_name']; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | if (isset($config['xml_root_namespace'])) { |
| 277 | - $metadata->xmlRootNamespace = (string)$config['xml_root_namespace']; |
|
| 277 | + $metadata->xmlRootNamespace = (string) $config['xml_root_namespace']; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | if (array_key_exists('xml_namespaces', $config)) { |
@@ -289,25 +289,25 @@ discard block |
||
| 289 | 289 | if (isset($config['discriminator']['disabled']) && true === $config['discriminator']['disabled']) { |
| 290 | 290 | $metadata->discriminatorDisabled = true; |
| 291 | 291 | } else { |
| 292 | - if (!isset($config['discriminator']['field_name'])) { |
|
| 292 | + if ( ! isset($config['discriminator']['field_name'])) { |
|
| 293 | 293 | throw new RuntimeException('The "field_name" attribute must be set for discriminators.'); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if (!isset($config['discriminator']['map']) || !is_array($config['discriminator']['map'])) { |
|
| 296 | + if ( ! isset($config['discriminator']['map']) || ! is_array($config['discriminator']['map'])) { |
|
| 297 | 297 | throw new RuntimeException('The "map" attribute must be set, and be an array for discriminators.'); |
| 298 | 298 | } |
| 299 | 299 | $groups = isset($config['discriminator']['groups']) ? $config['discriminator']['groups'] : array(); |
| 300 | 300 | $metadata->setDiscriminator($config['discriminator']['field_name'], $config['discriminator']['map'], $groups); |
| 301 | 301 | |
| 302 | 302 | if (isset($config['discriminator']['xml_attribute'])) { |
| 303 | - $metadata->xmlDiscriminatorAttribute = (bool)$config['discriminator']['xml_attribute']; |
|
| 303 | + $metadata->xmlDiscriminatorAttribute = (bool) $config['discriminator']['xml_attribute']; |
|
| 304 | 304 | } |
| 305 | 305 | if (isset($config['discriminator']['xml_element'])) { |
| 306 | 306 | if (isset($config['discriminator']['xml_element']['cdata'])) { |
| 307 | - $metadata->xmlDiscriminatorCData = (bool)$config['discriminator']['xml_element']['cdata']; |
|
| 307 | + $metadata->xmlDiscriminatorCData = (bool) $config['discriminator']['xml_element']['cdata']; |
|
| 308 | 308 | } |
| 309 | 309 | if (isset($config['discriminator']['xml_element']['namespace'])) { |
| 310 | - $metadata->xmlDiscriminatorNamespace = (string)$config['discriminator']['xml_element']['namespace']; |
|
| 310 | + $metadata->xmlDiscriminatorNamespace = (string) $config['discriminator']['xml_element']['namespace']; |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
@@ -319,13 +319,13 @@ discard block |
||
| 319 | 319 | { |
| 320 | 320 | if (is_string($config)) { |
| 321 | 321 | $config = array($config); |
| 322 | - } elseif (!is_array($config)) { |
|
| 322 | + } elseif ( ! is_array($config)) { |
|
| 323 | 323 | 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']))); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | $methods = array(); |
| 327 | 327 | foreach ($config as $name) { |
| 328 | - if (!$class->hasMethod($name)) { |
|
| 328 | + if ( ! $class->hasMethod($name)) { |
|
| 329 | 329 | throw new RuntimeException(sprintf('The method %s does not exist in class %s.', $name, $class->name)); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $propertyName = $propertyMetadata->name; |
| 44 | 44 | if ($doctrineMetadata->hasField($propertyName) && $fieldType = $this->normalizeFieldType($doctrineMetadata->getTypeOfField($propertyName))) { |
| 45 | 45 | $field = $doctrineMetadata->getFieldMapping($propertyName); |
| 46 | - if (!empty($field['multivalue'])) { |
|
| 46 | + if ( ! empty($field['multivalue'])) { |
|
| 47 | 47 | $fieldType = 'array'; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (!$doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 62 | + if ( ! $doctrineMetadata->isSingleValuedAssociation($propertyName)) { |
|
| 63 | 63 | $targetEntity = "ArrayCollection<{$targetEntity}>"; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | $metadata = require $file; |
| 30 | 30 | |
| 31 | - if (!$metadata instanceof ClassMetadata) { |
|
| 31 | + if ( ! $metadata instanceof ClassMetadata) { |
|
| 32 | 32 | throw new RuntimeException(sprintf('The file %s was expected to return an instance of ClassMetadata, but returned %s.', $file, json_encode($metadata))); |
| 33 | 33 | } |
| 34 | 34 | if ($metadata->name !== $class->name) { |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | $classMetadata->setDiscriminator($annot->field, $annot->map, $annot->groups); |
| 105 | 105 | } |
| 106 | 106 | } elseif ($annot instanceof XmlDiscriminator) { |
| 107 | - $classMetadata->xmlDiscriminatorAttribute = (bool)$annot->attribute; |
|
| 108 | - $classMetadata->xmlDiscriminatorCData = (bool)$annot->cdata; |
|
| 109 | - $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string)$annot->namespace : null; |
|
| 107 | + $classMetadata->xmlDiscriminatorAttribute = (bool) $annot->attribute; |
|
| 108 | + $classMetadata->xmlDiscriminatorCData = (bool) $annot->cdata; |
|
| 109 | + $classMetadata->xmlDiscriminatorNamespace = $annot->namespace ? (string) $annot->namespace : null; |
|
| 110 | 110 | } elseif ($annot instanceof VirtualProperty) { |
| 111 | 111 | $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $annot->name, $annot->exp); |
| 112 | 112 | $propertiesMetadata[] = $virtualPropertyMetadata; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if (!$excludeAll) { |
|
| 146 | + if ( ! $excludeAll) { |
|
| 147 | 147 | foreach ($class->getProperties() as $property) { |
| 148 | 148 | if ($property->class !== $name || (isset($property->info) && $property->info['class'] !== $name)) { |
| 149 | 149 | continue; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } elseif ($annot instanceof Expose) { |
| 175 | 175 | $isExpose = true; |
| 176 | 176 | if (null !== $annot->if) { |
| 177 | - $propertyMetadata->excludeIf = "!(" . $annot->if . ")"; |
|
| 177 | + $propertyMetadata->excludeIf = "!(".$annot->if.")"; |
|
| 178 | 178 | } |
| 179 | 179 | } elseif ($annot instanceof Exclude) { |
| 180 | 180 | if (null !== $annot->if) { |
@@ -218,12 +218,12 @@ discard block |
||
| 218 | 218 | $accessor = array($annot->getter, $annot->setter); |
| 219 | 219 | } elseif ($annot instanceof Groups) { |
| 220 | 220 | $propertyMetadata->groups = $annot->groups; |
| 221 | - foreach ((array)$propertyMetadata->groups as $groupName) { |
|
| 221 | + foreach ((array) $propertyMetadata->groups as $groupName) { |
|
| 222 | 222 | if (false !== strpos($groupName, ',')) { |
| 223 | 223 | throw new InvalidArgumentException(sprintf( |
| 224 | 224 | 'Invalid group name "%s" on "%s", did you mean to create multiple groups?', |
| 225 | 225 | implode(', ', $propertyMetadata->groups), |
| 226 | - $propertyMetadata->class . '->' . $propertyMetadata->name |
|
| 226 | + $propertyMetadata->class.'->'.$propertyMetadata->name |
|
| 227 | 227 | )); |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
| 240 | - if ((ExclusionPolicy::NONE === $exclusionPolicy && !$isExclude) |
|
| 240 | + if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude) |
|
| 241 | 241 | || (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose) |
| 242 | 242 | ) { |
| 243 | 243 | $propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $classMetadata = $this->delegate->loadMetadataForClass($class); |
| 84 | 84 | |
| 85 | 85 | // Abort if the given class is not a mapped entity |
| 86 | - if (!$doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 86 | + if ( ! $doctrineMetadata = $this->tryLoadingDoctrineMetadata($class->name)) { |
|
| 87 | 87 | return $classMetadata; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | protected function tryLoadingDoctrineMetadata($className) |
| 150 | 150 | { |
| 151 | - if (!$manager = $this->registry->getManagerForClass($className)) { |
|
| 151 | + if ( ! $manager = $this->registry->getManagerForClass($className)) { |
|
| 152 | 152 | return null; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | protected function normalizeFieldType($type) |
| 166 | 166 | { |
| 167 | - if (!isset($this->fieldMapping[$type])) { |
|
| 167 | + if ( ! isset($this->fieldMapping[$type])) { |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |