@@ -194,25 +194,25 @@ |
||
| 194 | 194 | $value = $repository->extractOne($entity, $attribute); |
| 195 | 195 | |
| 196 | 196 | if ($isUninitialized) { |
| 197 | - $this->fail($message . ': Expected attribute "'.$path.'" to be not initialised'); |
|
| 197 | + $this->fail($message.': Expected attribute "'.$path.'" to be not initialised'); |
|
| 198 | 198 | } |
| 199 | 199 | } catch (UninitializedPropertyException $e) { |
| 200 | 200 | if (!$isUninitialized) { |
| 201 | - $this->fail($message . ': The attribute "'.$path.'" is not initialised'); |
|
| 201 | + $this->fail($message.': The attribute "'.$path.'" is not initialised'); |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if (!is_object($expectedValue)) { |
| 206 | - $this->assertSame($expectedValue, $value, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
| 206 | + $this->assertSame($expectedValue, $value, $message.': Expected attribute "'.$path.'" is not the same'); |
|
| 207 | 207 | continue; |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if ($expectedValue instanceof Constraint) { |
| 211 | - $this->assertThat($value, $expectedValue, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
| 211 | + $this->assertThat($value, $expectedValue, $message.': Expected attribute "'.$path.'" is not the same'); |
|
| 212 | 212 | } elseif ($expectedValue instanceof \DateTimeInterface) { |
| 213 | - $this->assertEqualsWithDelta($expectedValue, $value, $dateTimeDelta, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
| 213 | + $this->assertEqualsWithDelta($expectedValue, $value, $dateTimeDelta, $message.': Expected attribute "'.$path.'" is not the same'); |
|
| 214 | 214 | } else { |
| 215 | - $this->assertEquals($expectedValue, $value, $message . ': Expected attribute "'.$path.'" is not the same'); |
|
| 215 | + $this->assertEquals($expectedValue, $value, $message.': Expected attribute "'.$path.'" is not the same'); |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct(string $entity, string $field) |
| 17 | 17 | { |
| 18 | - parent::__construct('The field "' . $field . '" is not declared for the entity ' . $entity); |
|
| 18 | + parent::__construct('The field "'.$field.'" is not declared for the entity '.$entity); |
|
| 19 | 19 | } |
| 20 | 20 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - throw new HydratorGenerationException($this->className, 'Cannot get the value of property "' . $attribute . '"'); |
|
| 92 | + throw new HydratorGenerationException($this->className, 'Cannot get the value of property "'.$attribute.'"'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | return $varName.'->set'.ucfirst($attribute).'('.$value.')'; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - throw new HydratorGenerationException($this->className, 'Cannot access to attribute "' . $attribute . '" on write'); |
|
| 121 | + throw new HydratorGenerationException($this->className, 'Cannot access to attribute "'.$attribute.'" on write'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } catch (ReflectionException $e) { |
| 167 | - throw new HydratorGenerationException($this->className, 'Cannot access to the property ' . $prop, $e); |
|
| 167 | + throw new HydratorGenerationException($this->className, 'Cannot access to the property '.$prop, $e); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | return true; |
@@ -327,7 +327,7 @@ |
||
| 327 | 327 | return array_unique($classes); |
| 328 | 328 | |
| 329 | 329 | default: |
| 330 | - throw new HydratorGenerationException($this->mapper->getEntityClass(), 'Cannot handle relation type ' . $relation['type']); |
|
| 330 | + throw new HydratorGenerationException($this->mapper->getEntityClass(), 'Cannot handle relation type '.$relation['type']); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $values = []; |
| 47 | 47 | $attributes = array_flip($attributes); |
| 48 | 48 | |
| 49 | - $privatePrefix = "\0" . get_class($object) . "\0"; |
|
| 49 | + $privatePrefix = "\0".get_class($object)."\0"; |
|
| 50 | 50 | $privatePrefixLen = strlen($privatePrefix); |
| 51 | 51 | |
| 52 | 52 | foreach ((array) $object as $name => $property) { |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | return $this->hydratorsCache[$entityClass]; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $hydrator = static function ($object, array $data) { |
|
| 86 | + $hydrator = static function($object, array $data) { |
|
| 87 | 87 | foreach ($data as $property => $value) { |
| 88 | 88 | try { |
| 89 | 89 | if (isset($object->$property) && $object->$property instanceof ImportableInterface && is_array($value)) { |
| 90 | 90 | $object->$property->import($value); |
| 91 | - } elseif (method_exists($object, 'set' . ucfirst($property))) { |
|
| 92 | - $object->{'set' . ucfirst($property)}($value); |
|
| 91 | + } elseif (method_exists($object, 'set'.ucfirst($property))) { |
|
| 92 | + $object->{'set'.ucfirst($property)}($value); |
|
| 93 | 93 | } elseif (property_exists($object, $property)) { |
| 94 | 94 | $object->$property = $value; |
| 95 | 95 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function hydratorClassName() |
| 127 | 127 | { |
| 128 | - return 'Hydrator_' . str_replace('\\', '_', $this->className); |
|
| 128 | + return 'Hydrator_'.str_replace('\\', '_', $this->className); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function hydratorFullClassName() |
| 137 | 137 | { |
| 138 | - return $this->hydratorNamespace() . '\\' . $this->hydratorClassName(); |
|
| 138 | + return $this->hydratorNamespace().'\\'.$this->hydratorClassName(); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if (!isset($classes[$class])) { |
| 168 | 168 | $classes[$class] = true; |
| 169 | 169 | |
| 170 | - $property = '__' . str_replace('\\', '_', $class) . '_hydrator'; |
|
| 170 | + $property = '__'.str_replace('\\', '_', $class).'_hydrator'; |
|
| 171 | 171 | $this->embeddedHydrators[$class] = $property; |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | protected function generateEmbeddedHydrate(AttributeInfo $attribute) |
| 274 | 274 | { |
| 275 | 275 | // We can have multiple entity classes for one attribute : morph |
| 276 | - $varName = '$__rel_' . str_replace('.', '_', $attribute->name()); |
|
| 276 | + $varName = '$__rel_'.str_replace('.', '_', $attribute->name()); |
|
| 277 | 277 | |
| 278 | 278 | $hydrators = []; |
| 279 | 279 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | return '$this'; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - return '$this->' . $this->embeddedHydrators[$class]; |
|
| 311 | + return '$this->'.$this->embeddedHydrators[$class]; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected function normalizeClassName($className) |
| 322 | 322 | { |
| 323 | - return '\\' . ltrim($className, '\\'); |
|
| 323 | + return '\\'.ltrim($className, '\\'); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -373,11 +373,11 @@ discard block |
||
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | if (empty($possiblyNotInitialized)) { |
| 376 | - return 'return [' . implode(', ', $lines) . '];'; |
|
| 376 | + return 'return ['.implode(', ', $lines).'];'; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return '$values = [' . implode(', ', $lines) . '];' . PHP_EOL . PHP_EOL . |
|
| 380 | - implode(PHP_EOL, $possiblyNotInitialized) . PHP_EOL . PHP_EOL . |
|
| 379 | + return '$values = ['.implode(', ', $lines).'];'.PHP_EOL.PHP_EOL. |
|
| 380 | + implode(PHP_EOL, $possiblyNotInitialized).PHP_EOL.PHP_EOL. |
|
| 381 | 381 | 'return $values;' |
| 382 | 382 | ; |
| 383 | 383 | } |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | $line = ''; |
| 440 | 440 | |
| 441 | 441 | if ($attribute->isEmbedded()) { |
| 442 | - $varName = '$__rel_' . str_replace('.', '_', $attribute->name()); |
|
| 443 | - $line .= '(' . $varName . ' = '.$this->accessor->getter('$object', $attribute->property()) . ") === null ? null : "; |
|
| 442 | + $varName = '$__rel_'.str_replace('.', '_', $attribute->name()); |
|
| 443 | + $line .= '('.$varName.' = '.$this->accessor->getter('$object', $attribute->property()).") === null ? null : "; |
|
| 444 | 444 | |
| 445 | 445 | foreach ($attribute->embedded()->classes() as $class) { |
| 446 | 446 | if ($this->resolver->isImportable($class)) { |
@@ -733,13 +733,13 @@ discard block |
||
| 733 | 733 | */ |
| 734 | 734 | protected function generateExtractOneCaseEmbedded(EmbeddedInfo $embedded) |
| 735 | 735 | { |
| 736 | - $varName = '$__' . str_replace('.', '_', $embedded->path()); |
|
| 736 | + $varName = '$__'.str_replace('.', '_', $embedded->path()); |
|
| 737 | 737 | $code = $this->accessors->embedded($embedded)->getEmbedded($varName, false); |
| 738 | 738 | $className = $embedded->isRoot() ? $this->mapper->getEntityClass() : $embedded->parent()->class(); |
| 739 | 739 | |
| 740 | 740 | return <<<PHP |
| 741 | 741 | try { |
| 742 | -{$this->code->indent($this->code->lines([$code, 'return ' . $varName . ';']), 1)} |
|
| 742 | +{$this->code->indent($this->code->lines([$code, 'return '.$varName.';']), 1)} |
|
| 743 | 743 | } catch (\Error \$e) { |
| 744 | 744 | throw new \Bdf\Prime\Entity\Hydrator\Exception\UninitializedPropertyException('{$className}', '{$embedded->property()}'); |
| 745 | 745 | } |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | ->fullSetter($attribute->property(), '$value', '$__embedded').';' |
| 795 | 795 | ; |
| 796 | 796 | } else { |
| 797 | - $code = $this->accessor->setter('$object', $attribute->property(), '$value', false) . ';'; |
|
| 797 | + $code = $this->accessor->setter('$object', $attribute->property(), '$value', false).';'; |
|
| 798 | 798 | } |
| 799 | 799 | |
| 800 | 800 | // Always surround with try catch because setter can also be typed |