Passed
Push — master ( ea0818...92b4a6 )
by Adrian
01:28
created
src/Mapper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $mapper->entityClass = $mapperConfig->entityClass;
145 145
         }
146 146
 
147
-        if ($mapperConfig->behaviours && ! empty($mapperConfig->behaviours)) {
147
+        if ($mapperConfig->behaviours && !empty($mapperConfig->behaviours)) {
148 148
             $mapper->use(...$mapperConfig->behaviours);
149 149
         }
150 150
 
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $this->orm = $orm;
157 157
 
158
-        if (! $entityHydrator) {
158
+        if (!$entityHydrator) {
159 159
             $entityHydrator = new GenericEntityHydrator();
160 160
             $entityHydrator->setMapper($this);
161 161
             $entityHydrator->setCastingManager($orm->getCastingManager());
162 162
         }
163 163
         $this->entityHydrator = $entityHydrator;
164 164
 
165
-        if (! $queryBuilder) {
165
+        if (!$queryBuilder) {
166 166
             $queryBuilder = QueryBuilder::getInstance();
167 167
         }
168 168
         $this->queryBuilder = $queryBuilder;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $mapper = $this;
234 234
 
235 235
         $singular = Inflector::singularize($this->getTableAlias(true));
236
-        $castingManager->register($singular, function ($value) use ($mapper, $castingManager) {
236
+        $castingManager->register($singular, function($value) use ($mapper, $castingManager) {
237 237
             if ($value instanceof $this->entityClass) {
238 238
                 return $value;
239 239
             }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         });
243 243
 
244 244
         $plural = $this->getTableAlias(true);
245
-        $castingManager->register($plural, function ($values) use ($mapper, $castingManager) {
245
+        $castingManager->register($plural, function($values) use ($mapper, $castingManager) {
246 246
             if ($values instanceof Collection) {
247 247
                 return $values;
248 248
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function getTableAlias($returnTableIfNull = false)
280 280
     {
281
-        return (! $this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias;
281
+        return (!$this->tableAlias && $returnTableIfNull) ? $this->table : $this->tableAlias;
282 282
     }
283 283
 
284 284
     public function getTableReference()
@@ -347,8 +347,8 @@  discard block
 block discarded – undo
347 347
             return null;
348 348
         }
349 349
 
350
-        $receivedTracker = ! ! $tracker;
351
-        if (! $tracker) {
350
+        $receivedTracker = !!$tracker;
351
+        if (!$tracker) {
352 352
             $receivedTracker = false;
353 353
             $tracker         = new Tracker([$data]);
354 354
         }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
         $this->injectAggregates($entity, $tracker, $load);
359 359
         $entity->setPersistenceState(StateEnum::SYNCHRONIZED);
360 360
 
361
-        if (! $receivedTracker) {
361
+        if (!$receivedTracker) {
362 362
             $tracker->replaceRows([$entity]);
363 363
         }
364 364
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
             $queryCallback = $eagerLoad[$name] ?? null;
404 404
             $nextLoad      = Arr::getChildren($eagerLoad, $name);
405 405
 
406
-            if (! $tracker->hasRelation($name)) {
406
+            if (!$tracker->hasRelation($name)) {
407 407
                 $tracker->setRelation($name, $relation, $queryCallback, $nextLoad);
408 408
             }
409 409
 
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
     protected function injectAggregates(EntityInterface $entity, Tracker $tracker, array $eagerLoad = [])
421 421
     {
422 422
         foreach (array_keys($this->relations) as $name) {
423
-            $relation      = $this->getRelation($name);
423
+            $relation = $this->getRelation($name);
424 424
             if (!method_exists($relation, 'getAggregates')) {
425 425
                 continue;
426 426
             }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 
470 470
     public function getRelation($name): Relation
471 471
     {
472
-        if (! $this->hasRelation($name)) {
472
+        if (!$this->hasRelation($name)) {
473 473
             throw new \InvalidArgumentException("Relation named {$name} is not registered for this mapper");
474 474
         }
475 475
 
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             $this->relations[$name] = $this->orm->createRelation($this, $name, $this->relations[$name]);
478 478
         }
479 479
         $relation = $this->relations[$name];
480
-        if (! $relation instanceof Relation) {
480
+        if (!$relation instanceof Relation) {
481 481
             throw new \InvalidArgumentException("Relation named {$name} is not a proper Relation instance");
482 482
         }
483 483
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 
532 532
     public function newSaveAction(EntityInterface $entity, $options): BaseAction
533 533
     {
534
-        if (! $this->getEntityAttribute($entity, $this->primaryKey)) {
534
+        if (!$this->getEntityAttribute($entity, $this->primaryKey)) {
535 535
             $action = new Insert($this, $entity, $options);
536 536
         } else {
537 537
             $action = new Update($this, $entity, $options);
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
     protected function assertCanPersistEntity($entity)
570 570
     {
571
-        if (! $entity || ! $entity instanceof $this->entityClass) {
571
+        if (!$entity || !$entity instanceof $this->entityClass) {
572 572
             throw new \InvalidArgumentException(sprintf(
573 573
                 'Mapper %s can only persist entity of class %s. %s class provided',
574 574
                 __CLASS__,
Please login to merge, or discard this patch.
src/Orm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     ) {
45 45
         $this->connectionLocator = $connectionLocator;
46 46
 
47
-        if (! $castingManager) {
47
+        if (!$castingManager) {
48 48
             $castingManager = new CastingManager();
49 49
         }
50 50
         $this->castingManager = $castingManager;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             unset($this->lazyMappers[$name]);
81 81
         }
82 82
 
83
-        if (! isset($this->mappers[$name]) || ! $this->mappers[$name]) {
83
+        if (!isset($this->mappers[$name]) || !$this->mappers[$name]) {
84 84
             throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name));
85 85
         }
86 86
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         }
120 120
 
121 121
         $mapper = $mapperConfigOrFactory($this);
122
-        if (! $mapper instanceof Mapper) {
122
+        if (!$mapper instanceof Mapper) {
123 123
             throw new InvalidArgumentException(
124 124
                 'The mapper generated from the factory is not a valid `Mapper` instance'
125 125
             );
Please login to merge, or discard this patch.
src/Relation/Aggregate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
     {
85 85
         $keys = $this->relation->getKeyPairs();
86 86
         foreach ($keys as $nativeCol => $foreignCol) {
87
-            $entityValue  = $this->relation->getNativeMapper()->getEntityAttribute($entity, $nativeCol);
87
+            $entityValue = $this->relation->getNativeMapper()->getEntityAttribute($entity, $nativeCol);
88 88
             $rowValue = $row[$foreignCol];
89 89
             // if both native and foreign key values are present (not unlinked entities) they must be the same
90 90
             // otherwise we assume that the entities can be linked together
Please login to merge, or discard this patch.
src/Entity/Tracker.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function __construct(array $rows = [])
42 42
     {
43
-        $this->rows   = $rows;
43
+        $this->rows = $rows;
44 44
     }
45 45
 
46 46
     public function setRelation($name, Relation $relation, $callback, array $nextLoad = [], $overwrite = false)
47 47
     {
48
-        if ($overwrite || ! isset($this->relations[$name])) {
48
+        if ($overwrite || !isset($this->relations[$name])) {
49 49
             $this->relations[$name]        = $relation;
50 50
             $this->relationCallback[$name] = $callback;
51 51
             if (!empty($nextLoad)) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     public function getResultsForRelation($name)
63 63
     {
64
-        if (! isset($this->relations[$name])) {
64
+        if (!isset($this->relations[$name])) {
65 65
             return null;
66 66
         }
67 67
 
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         /** @var Query $query */
100
-        $query         = $aggregate->getQuery($this);
100
+        $query = $aggregate->getQuery($this);
101 101
 
102
-        $results                      = $query->fetchAll();
102
+        $results = $query->fetchAll();
103 103
         $this->aggregateResults[$name] = $results instanceof Collection ? $results->getValues() : $results;
104 104
 
105 105
         return $this->aggregateResults[$name];
Please login to merge, or discard this patch.
src/Action/Update.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@
 block discarded – undo
55 55
         if (count($columns) > 0) {
56 56
             $updateSql = new \Sirius\Sql\Update($connection);
57 57
             $updateSql->table($this->mapper->getTable())
58
-                      ->columns($columns)
59
-                      ->whereAll($conditions, false);
58
+                        ->columns($columns)
59
+                        ->whereAll($conditions, false);
60 60
             $updateSql->perform();
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
src/Action/DeletePivotRows.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
         }
40 40
 
41 41
         $delete = new \Sirius\Sql\Delete($this->mapper->getWriteConnection());
42
-        $delete->from((string) $this->relation->getOption(RelationConfig::THROUGH_TABLE));
42
+        $delete->from((string)$this->relation->getOption(RelationConfig::THROUGH_TABLE));
43 43
         $delete->whereAll($conditions, false);
44 44
 
45 45
         $delete->perform();
Please login to merge, or discard this patch.