@@ -76,7 +76,7 @@ |
||
76 | 76 | */ |
77 | 77 | public function setSerializer($serializer) : void |
78 | 78 | { |
79 | - if (! is_string($serializer) && ! $serializer instanceof SerializerAdapter) { |
|
79 | + if (!is_string($serializer) && !$serializer instanceof SerializerAdapter) { |
|
80 | 80 | throw new InvalidArgumentException(sprintf( |
81 | 81 | '%s expects either a string serializer name or Zend\Serializer\Adapter\AdapterInterface instance; ' |
82 | 82 | . 'received "%s"', |
@@ -112,7 +112,7 @@ |
||
112 | 112 | return $value; |
113 | 113 | } |
114 | 114 | |
115 | - if (! is_string($value)) { |
|
115 | + if (!is_string($value)) { |
|
116 | 116 | throw new Exception\InvalidArgumentException(sprintf( |
117 | 117 | 'Unable to hydrate. Expected null, string, or DateTimeInterface; %s was given.', |
118 | 118 | is_object($value) ? get_class($value) : gettype($value) |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function extract(object $object) : array |
28 | 28 | { |
29 | - if (! method_exists($object, 'getArrayCopy') || ! is_callable([$object, 'getArrayCopy'])) { |
|
29 | + if (!method_exists($object, 'getArrayCopy') || !is_callable([$object, 'getArrayCopy'])) { |
|
30 | 30 | throw new Exception\BadMethodCallException( |
31 | 31 | sprintf('%s expects the provided object to implement getArrayCopy()', __METHOD__) |
32 | 32 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | foreach ($data as $name => $value) { |
39 | 39 | $name = (string) $name; |
40 | 40 | |
41 | - if (! $filter->filter($name)) { |
|
41 | + if (!$filter->filter($name)) { |
|
42 | 42 | unset($data[$name]); |
43 | 43 | continue; |
44 | 44 | } |
@@ -51,8 +51,8 @@ |
||
51 | 51 | |
52 | 52 | $mandatoryParameters = array_filter( |
53 | 53 | $reflectionMethod->getParameters(), |
54 | - function (ReflectionParameter $parameter) { |
|
55 | - return ! $parameter->isOptional(); |
|
54 | + function(ReflectionParameter $parameter) { |
|
55 | + return !$parameter->isOptional(); |
|
56 | 56 | } |
57 | 57 | ); |
58 | 58 |
@@ -173,7 +173,7 @@ |
||
173 | 173 | */ |
174 | 174 | private function validateFilter($filter, string $name) : void |
175 | 175 | { |
176 | - if (! is_callable($filter) && ! $filter instanceof FilterInterface) { |
|
176 | + if (!is_callable($filter) && !$filter instanceof FilterInterface) { |
|
177 | 177 | throw new InvalidArgumentException(sprintf( |
178 | 178 | 'The value of %s should be either a callable or an instance of %s', |
179 | 179 | $name, |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | return substr($property, $pos) === $this->method |
51 | - ? ! $this->exclude |
|
51 | + ? !$this->exclude |
|
52 | 52 | : $this->exclude; |
53 | 53 | } |
54 | 54 | } |
@@ -55,7 +55,7 @@ |
||
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - if (! class_exists($prototype)) { |
|
58 | + if (!class_exists($prototype)) { |
|
59 | 59 | throw new InvalidArgumentException( |
60 | 60 | sprintf('Method %s was passed an invalid class name: %s', __METHOD__, $prototype) |
61 | 61 | ); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | // pass 1 - finding out which properties can be extracted, with which methods (populate hydration cache) |
149 | - if (! isset($this->extractionMethodsCache[$objectClass])) { |
|
149 | + if (!isset($this->extractionMethodsCache[$objectClass])) { |
|
150 | 150 | $this->extractionMethodsCache[$objectClass] = []; |
151 | 151 | $filter = $this->getCompositeFilter(); |
152 | 152 | $methods = get_class_methods($object); |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | foreach ($methods as $method) { |
162 | - $methodFqn = $objectClass . '::' . $method; |
|
162 | + $methodFqn = $objectClass.'::'.$method; |
|
163 | 163 | |
164 | - if (! ($filter->filter($methodFqn) && $this->callableMethodFilter->filter($methodFqn))) { |
|
164 | + if (!($filter->filter($methodFqn) && $this->callableMethodFilter->filter($methodFqn))) { |
|
165 | 165 | continue; |
166 | 166 | } |
167 | 167 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | if (strpos($method, 'get') === 0) { |
171 | 171 | $attribute = substr($method, 3); |
172 | - if (! property_exists($object, $attribute)) { |
|
172 | + if (!property_exists($object, $attribute)) { |
|
173 | 173 | $attribute = lcfirst($attribute); |
174 | 174 | } |
175 | 175 | } |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | $objectClass = get_class($object); |
206 | 206 | |
207 | 207 | foreach ($data as $property => $value) { |
208 | - $propertyFqn = $objectClass . '::$' . $property; |
|
208 | + $propertyFqn = $objectClass.'::$'.$property; |
|
209 | 209 | |
210 | - if (! isset($this->hydrationMethodsCache[$propertyFqn])) { |
|
211 | - $setterName = 'set' . ucfirst($this->hydrateName($property, $data)); |
|
210 | + if (!isset($this->hydrationMethodsCache[$propertyFqn])) { |
|
211 | + $setterName = 'set'.ucfirst($this->hydrateName($property, $data)); |
|
212 | 212 | |
213 | 213 | $this->hydrationMethodsCache[$propertyFqn] = is_callable([$object, $setterName]) |
214 | - && (! $this->methodExistsCheck || method_exists($object, $setterName)) |
|
214 | + && (!$this->methodExistsCheck || method_exists($object, $setterName)) |
|
215 | 215 | ? $setterName |
216 | 216 | : false; |
217 | 217 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | foreach ($data as $name => $value) { |
38 | 38 | // Filter keys, removing any we don't want |
39 | - if (! $filter->filter($name)) { |
|
39 | + if (!$filter->filter($name)) { |
|
40 | 40 | unset($data[$name]); |
41 | 41 | continue; |
42 | 42 | } |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function hydrate(array $data, object $object) |
66 | 66 | { |
67 | - $properties =& self::$skippedPropertiesCache[get_class($object)] ?? null; |
|
67 | + $properties = & self::$skippedPropertiesCache[get_class($object)] ?? null; |
|
68 | 68 | |
69 | 69 | if (null === $properties) { |
70 | 70 | $reflection = new ReflectionClass($object); |
71 | 71 | $properties = array_fill_keys( |
72 | 72 | array_map( |
73 | - function (ReflectionProperty $property) { |
|
73 | + function(ReflectionProperty $property) { |
|
74 | 74 | return $property->getName(); |
75 | 75 | }, |
76 | 76 | $reflection->getProperties( |