@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __construct(ConnectionLocator $connectionLocator, CastingManager $castingManager = null) |
| 30 | 30 | { |
| 31 | 31 | $this->connectionLocator = $connectionLocator; |
| 32 | - if (! $castingManager) { |
|
| 32 | + if (!$castingManager) { |
|
| 33 | 33 | $castingManager = new CastingManager(); |
| 34 | 34 | } |
| 35 | 35 | $this->castingManager = $castingManager; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | unset($this->lazyMappers[$mapperName]); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (! isset($this->mappers[$mapperName]) || ! $this->mappers[$mapperName]) { |
|
| 66 | + if (!isset($this->mappers[$mapperName]) || !$this->mappers[$mapperName]) { |
|
| 67 | 67 | throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $mapperName)); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | { |
| 95 | 95 | $foreignMapper = $options[RelationOption::FOREIGN_MAPPER]; |
| 96 | 96 | if ($this->has($foreignMapper)) { |
| 97 | - if (! $foreignMapper instanceof Mapper) { |
|
| 97 | + if (!$foreignMapper instanceof Mapper) { |
|
| 98 | 98 | $foreignMapper = $this->get($foreignMapper); |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | $type = $options[RelationOption::TYPE]; |
| 102 | 102 | $relationClass = __NAMESPACE__ . '\\Relation\\' . Str::className($type); |
| 103 | 103 | |
| 104 | - if (! class_exists($relationClass)) { |
|
| 104 | + if (!class_exists($relationClass)) { |
|
| 105 | 105 | throw new InvalidArgumentException("{$relationClass} does not exist"); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $mapper = $mapperConfigOrFactory($this); |
| 118 | - if (! $mapper instanceof Mapper) { |
|
| 118 | + if (!$mapper instanceof Mapper) { |
|
| 119 | 119 | throw new InvalidArgumentException( |
| 120 | 120 | 'The mapper generated from the factory is not a valid `Mapper` instance' |
| 121 | 121 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $mapper->entityClass = $mapperConfig->entityClass; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ($mapperConfig->behaviours && ! empty($mapperConfig->behaviours)) { |
|
| 139 | + if ($mapperConfig->behaviours && !empty($mapperConfig->behaviours)) { |
|
| 140 | 140 | $mapper->use(...$mapperConfig->behaviours); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | public function __construct(Orm $orm, FactoryInterface $entityFactory = null, QueryBuilder $queryBuilder = null) |
| 147 | 147 | { |
| 148 | 148 | $this->orm = $orm; |
| 149 | - if (! $entityFactory) { |
|
| 149 | + if (!$entityFactory) { |
|
| 150 | 150 | $entityFactory = new GenericEntityFactory($orm, $this); |
| 151 | 151 | } |
| 152 | - if (! $queryBuilder) { |
|
| 152 | + if (!$queryBuilder) { |
|
| 153 | 153 | $this->queryBuilder = QueryBuilder::getInstance(); |
| 154 | 154 | } |
| 155 | 155 | $this->entityFactory = $entityFactory; |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $mapper = $this; |
| 221 | 221 | |
| 222 | 222 | $singular = Inflector::singularize($this->getTableAlias(true)); |
| 223 | - $castingManager->register($singular, function ($value) use ($mapper, $castingManager) { |
|
| 223 | + $castingManager->register($singular, function($value) use ($mapper, $castingManager) { |
|
| 224 | 224 | if ($value instanceof $this->entityClass) { |
| 225 | 225 | return $value; |
| 226 | 226 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | }); |
| 229 | 229 | |
| 230 | 230 | $plural = $this->getTableAlias(true); |
| 231 | - $castingManager->register($plural, function ($values) use ($mapper, $castingManager) { |
|
| 231 | + $castingManager->register($plural, function($values) use ($mapper, $castingManager) { |
|
| 232 | 232 | if ($values instanceof Collection) { |
| 233 | 233 | return $values; |
| 234 | 234 | } |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function getTableAlias($returnTableIfNull = false) |
| 264 | 264 | { |
| 265 | - return (! $this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias; |
|
| 265 | + return (!$this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | public function getTableReference() |
@@ -327,8 +327,8 @@ discard block |
||
| 327 | 327 | return null; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $receivedTracker = ! ! $tracker; |
|
| 331 | - if (! $tracker) { |
|
| 330 | + $receivedTracker = !!$tracker; |
|
| 331 | + if (!$tracker) { |
|
| 332 | 332 | $receivedTracker = false; |
| 333 | 333 | $tracker = new Tracker($this, [$data]); |
| 334 | 334 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $this->injectRelations($entity, $tracker, $load); |
| 338 | 338 | $entity->setPersistanceState(StateEnum::SYNCHRONIZED); |
| 339 | 339 | |
| 340 | - if (! $receivedTracker) { |
|
| 340 | + if (!$receivedTracker) { |
|
| 341 | 341 | $tracker->replaceRows([$entity]); |
| 342 | 342 | if ($tracker->isDisposable()) { |
| 343 | 343 | unset($tracker); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $queryCallback = $eagerLoad[$name] ?? null; |
| 393 | 393 | $nextLoad = Arr::getChildren($eagerLoad, $name); |
| 394 | 394 | |
| 395 | - if (! $tracker->hasRelation($name)) { |
|
| 395 | + if (!$tracker->hasRelation($name)) { |
|
| 396 | 396 | $tracker->setRelation($name, $relation, $queryCallback); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | public function getRelation($name): Relation |
| 431 | 431 | { |
| 432 | - if (! $this->hasRelation($name)) { |
|
| 432 | + if (!$this->hasRelation($name)) { |
|
| 433 | 433 | throw new \InvalidArgumentException("Relation named {$name} is not registered for this mapper"); |
| 434 | 434 | } |
| 435 | 435 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | $this->relations[$name] = $this->orm->createRelation($this, $name, $this->relations[$name]); |
| 438 | 438 | } |
| 439 | 439 | $relation = $this->relations[$name]; |
| 440 | - if (! $relation instanceof Relation) { |
|
| 440 | + if (!$relation instanceof Relation) { |
|
| 441 | 441 | throw new \InvalidArgumentException("Relation named {$name} is not a proper Relation instance"); |
| 442 | 442 | } |
| 443 | 443 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | public function newSaveAction(EntityInterface $entity, $options): BaseAction |
| 482 | 482 | { |
| 483 | - if (! $entity->getPk()) { |
|
| 483 | + if (!$entity->getPk()) { |
|
| 484 | 484 | $action = new Insert($this, $entity, $options); |
| 485 | 485 | } else { |
| 486 | 486 | $action = new Update($this, $entity, $options); |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | protected function assertCanPersistEntity($entity) |
| 509 | 509 | { |
| 510 | - if (! $entity || ! $entity instanceof $this->entityClass) { |
|
| 510 | + if (!$entity || !$entity instanceof $this->entityClass) { |
|
| 511 | 511 | throw new \InvalidArgumentException(sprintf( |
| 512 | 512 | 'Mapper %s can only persist entity of class %s. %s class provided', |
| 513 | 513 | __CLASS__, |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function register($name, callable $func) |
| 11 | 11 | { |
| 12 | - if ( ! $name) { |
|
| 12 | + if (!$name) { |
|
| 13 | 13 | return; // ignore |
| 14 | 14 | } |
| 15 | 15 | $this->casts[$name] = $func; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function bool($value) |
| 45 | 45 | { |
| 46 | - return ! ! $value; |
|
| 46 | + return !!$value; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | public function int($value) |