@@ -80,7 +80,7 @@ |
||
| 80 | 80 | $this->classListeners[$eventName][$loweredClass][$format] = $this->initializeListeners($eventName, $loweredClass, $format); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return !!$this->classListeners[$eventName][$loweredClass][$format]; |
|
| 83 | + return ! ! $this->classListeners[$eventName][$loweredClass][$format]; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function dispatch($eventName, $class, $format, Event $event) |
@@ -25,5 +25,7 @@ |
||
| 25 | 25 | const PRE_DESERIALIZE = 'serializer.pre_deserialize'; |
| 26 | 26 | const POST_DESERIALIZE = 'serializer.post_deserialize'; |
| 27 | 27 | |
| 28 | - final private function __construct() { } |
|
| 28 | + final private function __construct() |
|
| 29 | + { |
|
| 30 | +} |
|
| 29 | 31 | } |
@@ -167,7 +167,7 @@ |
||
| 167 | 167 | |
| 168 | 168 | //we need read_only before setter and getter set, because that method depends on flag being set |
| 169 | 169 | if (isset($pConfig['read_only'])) { |
| 170 | - $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
| 170 | + $pMetadata->readOnly = (Boolean) $pConfig['read_only']; |
|
| 171 | 171 | } else { |
| 172 | 172 | $pMetadata->readOnly = $pMetadata->readOnly || $readOnlyClass; |
| 173 | 173 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | if (array_key_exists('virtual_properties', $config)) { |
| 54 | 54 | foreach ($config['virtual_properties'] as $methodName => $propertySettings) { |
| 55 | 55 | if (isset($propertySettings['exp'])) { |
| 56 | - $virtualPropertyMetadata = new ExpressionPropertyMetadata( $name, $methodName, $propertySettings['exp']); |
|
| 56 | + $virtualPropertyMetadata = new ExpressionPropertyMetadata($name, $methodName, $propertySettings['exp']); |
|
| 57 | 57 | unset($propertySettings['exp']); |
| 58 | 58 | |
| 59 | 59 | } else { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if (isset($pConfig['expose_if'])) { |
| 110 | - $pMetadata->excludeIf = "!(" . $pConfig['expose_if'].")"; |
|
| 110 | + $pMetadata->excludeIf = "!(".$pConfig['expose_if'].")"; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if (isset($pConfig['serialized_name'])) { |
@@ -127,15 +127,15 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $colConfig = $pConfig['xml_list']; |
| 129 | 129 | if (isset($colConfig['inline'])) { |
| 130 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 130 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | if (isset($colConfig['entry_name'])) { |
| 134 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 134 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | if (isset($colConfig['skip_when_empty'])) { |
| 138 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
| 138 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
| 139 | 139 | } else { |
| 140 | 140 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 141 | 141 | } |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |(.) |
| 50 | 50 | /x', |
| 51 | 51 | array(self::T_NAME => 'T_NAME', self::T_STRING => 'T_STRING', self::T_OPEN_BRACKET => 'T_OPEN_BRACKET', |
| 52 | - self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'), |
|
| 52 | + self::T_CLOSE_BRACKET => 'T_CLOSE_BRACKET', self::T_COMMA => 'T_COMMA', self::T_NONE => 'T_NONE'), |
|
| 53 | 53 | function($value) { |
| 54 | 54 | switch ($value[0]) { |
| 55 | 55 | case '"': |
@@ -83,16 +83,16 @@ |
||
| 83 | 83 | $addition = ''; |
| 84 | 84 | |
| 85 | 85 | $lines = explode("\n", $content); |
| 86 | - for ($i=0,$c=count($lines); $i<$c; $i++) { |
|
| 86 | + for ($i = 0, $c = count($lines); $i < $c; $i++) { |
|
| 87 | 87 | if ($this->indentationLevel > 0 |
| 88 | - && !empty($lines[$i]) |
|
| 88 | + && ! empty($lines[$i]) |
|
| 89 | 89 | && ((empty($addition) && "\n" === substr($this->content, -1)) || "\n" === substr($addition, -1))) { |
| 90 | 90 | $addition .= str_repeat(' ', $this->indentationLevel * $this->indentationSpaces); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $addition .= $lines[$i]; |
| 94 | 94 | |
| 95 | - if ($i+1 < $c) { |
|
| 95 | + if ($i + 1 < $c) { |
|
| 96 | 96 | $addition .= "\n"; |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -168,8 +168,8 @@ |
||
| 168 | 168 | |
| 169 | 169 | if ( ! $metadata->inline) { |
| 170 | 170 | $this->writer |
| 171 | - ->writeln(Inline::dump($name).':') |
|
| 172 | - ->indent(); |
|
| 171 | + ->writeln(Inline::dump($name).':') |
|
| 172 | + ->indent(); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $this->setCurrentMetadata($metadata); |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | continue; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ($isList && !$isHash) { |
|
| 94 | + if ($isList && ! $isHash) { |
|
| 95 | 95 | $this->writer->writeln('-'); |
| 96 | 96 | } else { |
| 97 | 97 | $this->writer->writeln(Inline::dump($k).':'); |
@@ -226,7 +226,7 @@ |
||
| 226 | 226 | throw new RuntimeException(sprintf('You must define a type for %s::$%s.', $metadata->reflection->class, $metadata->name)); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if ($metadata->xmlAttribute) { |
|
| 229 | + if ($metadata->xmlAttribute) { |
|
| 230 | 230 | |
| 231 | 231 | $attributes = $data->attributes($metadata->xmlNamespace); |
| 232 | 232 | if (isset($attributes[$name])) { |
@@ -85,6 +85,9 @@ discard block |
||
| 85 | 85 | return $doc; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | + /** |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 88 | 91 | private function emptyStringToSpaceCharacter($data) |
| 89 | 92 | { |
| 90 | 93 | return $data === '' ? ' ' : $data; |
@@ -359,7 +362,6 @@ discard block |
||
| 359 | 362 | /** |
| 360 | 363 | * Retrieves internalSubset even in bugfixed php versions |
| 361 | 364 | * |
| 362 | - * @param \DOMDocumentType $child |
|
| 363 | 365 | * @param string $data |
| 364 | 366 | * @return string |
| 365 | 367 | */ |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | if (false !== stripos($data, '<!doctype')) { |
| 65 | 65 | $internalSubset = $this->getDomDocumentTypeEntitySubset($data); |
| 66 | - if (!in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 66 | + if ( ! in_array($internalSubset, $this->doctypeWhitelist, true)) { |
|
| 67 | 67 | throw new InvalidArgumentException(sprintf( |
| 68 | 68 | 'The document type "%s" is not allowed. If it is safe, you may add it to the whitelist configuration.', |
| 69 | 69 | $internalSubset |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if ($namespace === null && $this->objectMetadataStack->count()) { |
| 149 | 149 | $classMetadata = $this->objectMetadataStack->top(); |
| 150 | - $namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace; |
|
| 150 | + $namespace = isset($classMetadata->xmlNamespaces['']) ? $classMetadata->xmlNamespaces[''] : $namespace; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if (null !== $namespace) { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $nodes = $data->xpath($entryName); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if (!count($nodes)) { |
|
| 161 | + if ( ! count($nodes)) { |
|
| 162 | 162 | if (null === $this->result) { |
| 163 | 163 | return $this->result = array(); |
| 164 | 164 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | if ($metadata->xmlCollection) { |
| 251 | 251 | $enclosingElem = $data; |
| 252 | - if (!$metadata->xmlCollectionInline) { |
|
| 252 | + if ( ! $metadata->xmlCollectionInline) { |
|
| 253 | 253 | $enclosingElem = $data->children($metadata->xmlNamespace)->$name; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | if ($metadata->xmlNamespace) { |
| 265 | 265 | $node = $data->children($metadata->xmlNamespace)->$name; |
| 266 | - if (!$node->count()) { |
|
| 266 | + if ( ! $node->count()) { |
|
| 267 | 267 | return; |
| 268 | 268 | } |
| 269 | 269 | } else { |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | if (isset($namespaces[''])) { |
| 274 | 274 | $prefix = uniqid('ns-'); |
| 275 | 275 | $data->registerXPathNamespace($prefix, $namespaces['']); |
| 276 | - $nodes = $data->xpath('./'.$prefix. ':'.$name ); |
|
| 276 | + $nodes = $data->xpath('./'.$prefix.':'.$name); |
|
| 277 | 277 | } else { |
| 278 | - $nodes = $data->xpath('./'. $name ); |
|
| 278 | + $nodes = $data->xpath('./'.$name); |
|
| 279 | 279 | } |
| 280 | 280 | if (empty($nodes)) { |
| 281 | 281 | return; |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | \DateTimeInterface $date, |
| 73 | 73 | array $type, |
| 74 | 74 | Context $context |
| 75 | - ) |
|
| 76 | - { |
|
| 75 | + ) { |
|
| 77 | 76 | if ($visitor instanceof XmlSerializationVisitor && false === $this->xmlCData) { |
| 78 | 77 | return $visitor->visitSimpleString($date->format($this->getFormat($type)), $type, $context); |
| 79 | 78 | } |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | \DateTimeImmutable $date, |
| 97 | 96 | array $type, |
| 98 | 97 | Context $context |
| 99 | - ) |
|
| 100 | - { |
|
| 98 | + ) { |
|
| 101 | 99 | return $this->serializeDateTimeInterface($visitor, $date, $type, $context); |
| 102 | 100 | } |
| 103 | 101 | |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | |
| 19 | 19 | namespace JMS\Serializer; |
| 20 | 20 | |
| 21 | -use JMS\Serializer\Exception\LogicException; |
|
| 22 | 21 | use JMS\Serializer\Exception\RuntimeException; |
| 23 | 22 | use Metadata\MetadataFactoryInterface; |
| 24 | 23 | |