@@ -162,6 +162,9 @@ |
||
| 162 | 162 | ; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $format |
|
| 167 | + */ |
|
| 165 | 168 | private function visit(VisitorInterface $visitor, Context $context, $data, $format, array $type = null) |
| 166 | 169 | { |
| 167 | 170 | $context->initialize( |
@@ -23,17 +23,11 @@ |
||
| 23 | 23 | use JMS\Serializer\Handler\PhpCollectionHandler; |
| 24 | 24 | use JMS\Serializer\Handler\PropelCollectionHandler; |
| 25 | 25 | use JMS\Serializer\Exception\RuntimeException; |
| 26 | -use Metadata\Driver\DriverInterface; |
|
| 27 | 26 | use Metadata\MetadataFactory; |
| 28 | -use JMS\Serializer\Metadata\Driver\AnnotationDriver; |
|
| 29 | 27 | use JMS\Serializer\Handler\HandlerRegistry; |
| 30 | 28 | use JMS\Serializer\Construction\UnserializeObjectConstructor; |
| 31 | 29 | use PhpCollection\Map; |
| 32 | 30 | use JMS\Serializer\EventDispatcher\EventDispatcher; |
| 33 | -use Metadata\Driver\DriverChain; |
|
| 34 | -use JMS\Serializer\Metadata\Driver\YamlDriver; |
|
| 35 | -use JMS\Serializer\Metadata\Driver\XmlDriver; |
|
| 36 | -use Metadata\Driver\FileLocator; |
|
| 37 | 31 | use JMS\Serializer\Handler\DateHandler; |
| 38 | 32 | use JMS\Serializer\Handler\ArrayCollectionHandler; |
| 39 | 33 | use JMS\Serializer\Construction\ObjectConstructorInterface; |
@@ -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 | } |
@@ -113,15 +113,15 @@ |
||
| 113 | 113 | |
| 114 | 114 | $colConfig = $pConfig['xml_list']; |
| 115 | 115 | if (isset($colConfig['inline'])) { |
| 116 | - $pMetadata->xmlCollectionInline = (Boolean)$colConfig['inline']; |
|
| 116 | + $pMetadata->xmlCollectionInline = (Boolean) $colConfig['inline']; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | if (isset($colConfig['entry_name'])) { |
| 120 | - $pMetadata->xmlEntryName = (string)$colConfig['entry_name']; |
|
| 120 | + $pMetadata->xmlEntryName = (string) $colConfig['entry_name']; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if (isset($colConfig['skip_when_empty'])) { |
| 124 | - $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean)$colConfig['skip_when_empty']; |
|
| 124 | + $pMetadata->xmlCollectionSkipWhenEmpty = (Boolean) $colConfig['skip_when_empty']; |
|
| 125 | 125 | } else { |
| 126 | 126 | $pMetadata->xmlCollectionSkipWhenEmpty = true; |
| 127 | 127 | } |
@@ -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); |
@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | private $dataStack; |
| 33 | 33 | private $data; |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param Naming\PropertyNamingStrategyInterface $namingStrategy |
|
| 37 | + */ |
|
| 35 | 38 | public function __construct($namingStrategy) |
| 36 | 39 | { |
| 37 | 40 | parent::__construct($namingStrategy); |
@@ -194,7 +197,6 @@ discard block |
||
| 194 | 197 | /** |
| 195 | 198 | * Allows you to remove data from the current object based on name. |
| 196 | 199 | * |
| 197 | - * @param string $key |
|
| 198 | 200 | * @throws Exception\InvalidArgumentException |
| 199 | 201 | */ |
| 200 | 202 | public function removeDataPropertyName($propertyName) |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $propMetadata->name = $propertyName; |
| 207 | 207 | $key = $this->namingStrategy->translateName($propMetadata); |
| 208 | 208 | |
| 209 | - if (!array_key_exists($key, $this->data)) { |
|
| 209 | + if ( ! array_key_exists($key, $this->data)) { |
|
| 210 | 210 | throw new InvalidArgumentException(sprintf('There is no data for "%s".', $key)); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | public function removeData($key) |
| 225 | 225 | { |
| 226 | - if (!array_key_exists($key, $this->data)) { |
|
| 226 | + if ( ! array_key_exists($key, $this->data)) { |
|
| 227 | 227 | throw new InvalidArgumentException(sprintf('There is no data for "%s".', $key)); |
| 228 | 228 | } |
| 229 | 229 | |