Passed
Push — develop ( 38bf9c...4f6606 )
by nguereza
12:50
created
src/Mapper/DataMapper.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
         }
260 260
 
261 261
         $primaryKey = $this->mapper->getPrimaryKey();
262
-        if ($name === (string)$primaryKey) {
262
+        if ($name === (string) $primaryKey) {
263 263
             return $this->columns[$name] = $value;
264 264
         }
265 265
 
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
         }
318 318
     }
319 319
 
320
-     /**
321
-     * {@inheritedoc}
322
-     */
320
+        /**
321
+         * {@inheritedoc}
322
+         */
323 323
     public function hasColumn(string $column): bool
324 324
     {
325 325
         return array_key_exists($column, $this->columns)
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
         $this->rawColumns[$name] = $value;
353 353
     }
354 354
 
355
-     /**
356
-     * {@inheritedoc}
357
-     */
355
+        /**
356
+         * {@inheritedoc}
357
+         */
358 358
     public function getRelated(string $name, callable $callback = null): mixed
359 359
     {
360 360
         if (array_key_exists($name, $this->relations)) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@
 block discarded – undo
66 66
  * @template TEntity as Entity
67 67
  * @implements DataMapperInterface<TEntity>
68 68
  */
69
-class DataMapper implements DataMapperInterface
70
-{
69
+class DataMapper implements DataMapperInterface {
71 70
     /**
72 71
      * The raw columns data
73 72
      * @var array<string, mixed>
Please login to merge, or discard this patch.
src/Repository.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -155,7 +155,7 @@
 block discarded – undo
155 155
 
156 156
         if ($this->offset >= 0 && $this->limit >= 0) {
157 157
             $query->offset($this->offset)
158
-                  ->limit($this->limit);
158
+                    ->limit($this->limit);
159 159
 
160 160
             $this->offset = -1;
161 161
             $this->limit = 0;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * The order by column(s)
84 84
      * @var string|Closure|Expression|string[]|Expression[]|Closure[]
85 85
      */
86
-    protected string|Closure|Expression|array $orderColumns = '';
86
+    protected string | Closure | Expression | array $orderColumns = '';
87 87
 
88 88
     /**
89 89
      * The order direction
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     /**
124 124
      * {@inheritedoc}
125 125
      */
126
-    public function query(string|array $with = [], bool $immediate = false): EntityQuery
126
+    public function query(string | array $with = [], bool $immediate = false): EntityQuery
127 127
     {
128 128
         if (is_string($with)) {
129 129
             $with = [$with];
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      * {@inheritedoc}
165 165
      * @return self<TEntity>
166 166
      */
167
-    public function with(string|array $with, bool $immediate = false): self
167
+    public function with(string | array $with, bool $immediate = false): self
168 168
     {
169 169
         if (!is_array($with)) {
170 170
             $with = [$with];
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @return self<TEntity>
181 181
      */
182 182
     public function orderBy(
183
-        string|Closure|Expression|array $columns,
183
+        string | Closure | Expression | array $columns,
184 184
         string $order = 'ASC'
185 185
     ): self {
186 186
         $this->orderColumns = $columns;
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * {@inheritedoc}
206 206
      * @return self<TEntity>
207 207
      */
208
-    public function filters(string|array $filters = []): self
208
+    public function filters(string | array $filters = []): self
209 209
     {
210 210
         if (is_string($filters)) {
211 211
             $filters = [$filters => true];
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
     /**
245 245
      * {@inheritedoc}
246 246
      */
247
-    public function find(array|string|int|float $id): ?Entity
247
+    public function find(array | string | int | float $id): ?Entity
248 248
     {
249 249
         return $this->query()->find($id);
250 250
     }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
     /**
285 285
      * {@inheritedoc}
286 286
      */
287
-    public function save(Entity $entity): array|string|int|float|bool|null
287
+    public function save(Entity $entity): array | string | int | float | bool | null
288 288
     {
289 289
         $data = Proxy::instance()->getEntityDataMapper($entity);
290 290
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     /**
299 299
      * {@inheritedoc}
300 300
      */
301
-    public function insert(Entity $entity): array|string|int|float|false|null
301
+    public function insert(Entity $entity): array | string | int | float | false | null
302 302
     {
303 303
         $data = Proxy::instance()->getEntityDataMapper($entity);
304 304
         $mapper = $data->getEntityMapper();
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         }
314 314
 
315 315
         $connection = $this->manager->getConnection();
316
-        $id = $connection->transaction(function (Connection $connection) use ($data, $mapper) {
316
+        $id = $connection->transaction(function(Connection $connection) use ($data, $mapper) {
317 317
             $columns = $data->getRawColumns();
318 318
             $pkGenerator = $mapper->getPrimaryKeyGenerator();
319 319
             if ($pkGenerator !== null) {
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         $modified = $data->getModifiedColumns();
384 384
         if (!empty($modified)) {
385 385
             $connection = $this->manager->getConnection();
386
-            $result = $connection->transaction(function (Connection $connection) use ($data, $mapper, $modified) {
386
+            $result = $connection->transaction(function(Connection $connection) use ($data, $mapper, $modified) {
387 387
                 $columns = array_intersect_key($data->getRawColumns(), array_flip($modified));
388 388
 
389 389
                 $updatedAt = null;
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
         }
421 421
 
422 422
         $connection = $this->manager->getConnection();
423
-        return $connection->transaction(function (Connection $connection) use ($data) {
423
+        return $connection->transaction(function(Connection $connection) use ($data) {
424 424
             $data->executePendingLinkage();
425 425
 
426 426
             return true;
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
         $eventsHandlers = $mapper->getEventHandlers();
438 438
         $connection = $this->manager->getConnection();
439 439
 
440
-        $result = $connection->transaction(function () use ($data, $mapper, $force) {
440
+        $result = $connection->transaction(function() use ($data, $mapper, $force) {
441 441
             if ($data->isDeleted()) {
442 442
                 throw new EntityStateException('The record was deleted');
443 443
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
  * @template TEntity as Entity
66 66
  * @implements RepositoryInterface<TEntity>
67 67
  */
68
-class Repository implements RepositoryInterface
69
-{
68
+class Repository implements RepositoryInterface {
70 69
     /**
71 70
      * The list of relation to load with the query
72 71
      * @var array<int, string>|array<string, Closure>
Please login to merge, or discard this patch.
src/RepositoryInterface.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
55 55
  * @package Platine\Orm
56 56
  * @template TEntity as Entity
57 57
  */
58
-interface RepositoryInterface
59
-{
58
+interface RepositoryInterface {
60 59
     /**
61 60
      * Return the instance of EntityQuery
62 61
      * @param string|array<int, string>|array<string, Closure> $with
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      * @param bool $immediate
64 64
      * @return EntityQuery<TEntity>
65 65
      */
66
-    public function query(string|array $with = [], bool $immediate = false): EntityQuery;
66
+    public function query(string | array $with = [], bool $immediate = false): EntityQuery;
67 67
 
68 68
     /**
69 69
      * Load with relation
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      * @param bool $immediate
72 72
      * @return self<TEntity>
73 73
      */
74
-    public function with(string|array $with, bool $immediate = false): self;
74
+    public function with(string | array $with, bool $immediate = false): self;
75 75
 
76 76
     /**
77 77
      * Set order
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @return self<TEntity>
81 81
      */
82 82
     public function orderBy(
83
-        string|Closure|Expression|array $columns,
83
+        string | Closure | Expression | array $columns,
84 84
         string $order = 'ASC'
85 85
     ): self;
86 86
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param string|array<string, mixed> $filters
98 98
      * @return self<TEntity>
99 99
      */
100
-    public function filters(string|array $filters = []): self;
100
+    public function filters(string | array $filters = []): self;
101 101
 
102 102
     /**
103 103
      * Create the instance of Entity
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
      * @param TEntity $entity
112 112
      * @return array<mixed>|string|int|float|bool|null
113 113
      */
114
-    public function save(Entity $entity): array|string|int|float|bool|null;
114
+    public function save(Entity $entity): array | string | int | float | bool | null;
115 115
 
116 116
     /**
117 117
      * Save the new entity in data store
118 118
      * @param TEntity $entity
119 119
      * @return array<mixed>|string|int|float|false|null the primary key(s) value(s)
120 120
      */
121
-    public function insert(Entity $entity): array|string|int|float|false|null;
121
+    public function insert(Entity $entity): array | string | int | float | false | null;
122 122
 
123 123
     /**
124 124
      * Update the existing entity in data store
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      *
149 149
      * @return TEntity|null
150 150
      */
151
-    public function find(array|string|int|float $id): ?Entity;
151
+    public function find(array | string | int | float $id): ?Entity;
152 152
 
153 153
     /**
154 154
      * Find one entity instance using some conditions
Please login to merge, or discard this patch.
src/Relation/ShareOne.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
52 52
  * @template TEntity as \Platine\Orm\Entity
53 53
  * @extends ShareRelation<TEntity>
54 54
  */
55
-class ShareOne extends ShareRelation
56
-{
55
+class ShareOne extends ShareRelation {
57 56
     /**
58 57
      * {@inheritedoc}
59 58
      */
Please login to merge, or discard this patch.
src/Relation/HasOne.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
52 52
  * @template TEntity as \Platine\Orm\Entity
53 53
  * @extends HasRelation<TEntity>
54 54
  */
55
-class HasOne extends HasRelation
56
-{
55
+class HasOne extends HasRelation {
57 56
     /**
58 57
      * {@inheritedoc}
59 58
      */
Please login to merge, or discard this patch.
src/Relation/HasMany.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
52 52
  * @template TEntity as \Platine\Orm\Entity
53 53
  * @extends HasRelation<TEntity>
54 54
  */
55
-class HasMany extends HasRelation
56
-{
55
+class HasMany extends HasRelation {
57 56
     /**
58 57
      * {@inheritedoc}
59 58
      */
Please login to merge, or discard this patch.
src/Relation/ShareMany.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
52 52
  * @template TEntity as \Platine\Orm\Entity
53 53
  * @extends ShareRelation<TEntity>
54 54
  */
55
-class ShareMany extends ShareRelation
56
-{
55
+class ShareMany extends ShareRelation {
57 56
     /**
58 57
      * {@inheritedoc}
59 58
      */
Please login to merge, or discard this patch.
src/Relation/ShareRelation.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
     }
99 99
 
100 100
         /**
101
-     *
102
-     * @param DataMapper<TEntity> $mapper
103
-     * @param TEntity $entity
104
-     *
105
-     * @return bool
106
-     */
101
+         *
102
+         * @param DataMapper<TEntity> $mapper
103
+         * @param TEntity $entity
104
+         *
105
+         * @return bool
106
+         */
107 107
     public function link(DataMapper $mapper, Entity $entity): bool
108 108
     {
109 109
         $manager = $mapper->getEntityManager();
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
             }
385 385
         });
386 386
 
387
-         $foreignKeys = $this->foreignKey->getValue($mapper->getRawColumns(), true);
387
+            $foreignKeys = $this->foreignKey->getValue($mapper->getRawColumns(), true);
388 388
         if (is_array($foreignKeys)) {
389 389
             foreach ($foreignKeys as $fkColumn => $value) {
390 390
                 $select->where($junctionTable . '.' . $fkColumn)->is($value);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
             }
270 270
         };
271 271
 
272
-        $linkKey = new ForeignKey(array_map(function ($value) use ($junctionTable) {
272
+        $linkKey = new ForeignKey(array_map(function($value) use ($junctionTable) {
273 273
             return 'hidden_' . $junctionTable . $value;
274 274
         }, $this->foreignKey->columns()));
275 275
 
276
-        $select->join($joinTable, function (Join $join) use ($junctionTable, $joinTable) {
276
+        $select->join($joinTable, function(Join $join) use ($junctionTable, $joinTable) {
277 277
             if ($this->junction !== null) {
278 278
                 foreach ($this->junction->columns() as $pkColumn => $fkColumn) {
279 279
                     $join->on($junctionTable . '.' . $fkColumn, $joinTable . '.' . $pkColumn);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @return TEntity|array<TEntity>|null
322 322
      */
323
-    public function getResult(DataMapper $mapper, ?callable $callback = null): Entity|array|null
323
+    public function getResult(DataMapper $mapper, ?callable $callback = null): Entity | array | null
324 324
     {
325 325
         $manager = $mapper->getEntityManager();
326 326
         $owner = $mapper->getEntityMapper();
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             }
386 386
         };
387 387
 
388
-        $select->join($joinTable, function (Join $join) use ($junctionTable, $joinTable) {
388
+        $select->join($joinTable, function(Join $join) use ($junctionTable, $joinTable) {
389 389
             if ($this->junction !== null) {
390 390
                 foreach ($this->junction->columns() as $pkColumn => $fkColumn) {
391 391
                     $join->on($junctionTable . '.' . $fkColumn, $joinTable . '.' . $pkColumn);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@  discard block
 block discarded – undo
68 68
  * @template TEntity as Entity
69 69
  * @extends Relation<TEntity>
70 70
  */
71
-abstract class ShareRelation extends Relation
72
-{
71
+abstract class ShareRelation extends Relation {
73 72
     /**
74 73
      * Whether is many or not
75 74
      * @var bool
@@ -222,8 +221,7 @@  discard block
 block discarded – undo
222 221
 
223 222
         $queryStatement = new QueryStatement();
224 223
 
225
-        $select = new class ($manager, $related, $queryStatement, $junctionTable) extends EntityQuery
226
-        {
224
+        $select = new class ($manager, $related, $queryStatement, $junctionTable) extends EntityQuery {
227 225
             /**
228 226
              *
229 227
              * @var string
@@ -338,8 +336,7 @@  discard block
 block discarded – undo
338 336
         $joinTable = $related->getTable();
339 337
 
340 338
         $queryStatement = new QueryStatement();
341
-        $select = new class ($manager, $related, $queryStatement, $junctionTable) extends EntityQuery
342
-        {
339
+        $select = new class ($manager, $related, $queryStatement, $junctionTable) extends EntityQuery {
343 340
             /**
344 341
              *
345 342
              * @var string
@@ -435,15 +432,13 @@  discard block
 block discarded – undo
435 432
      */
436 433
     protected function buildJunction(EntityMapper $owner, EntityMapper $related): Junction
437 434
     {
438
-        return new class ($owner, $related) extends Junction
439
-        {
435
+        return new class ($owner, $related) extends Junction {
440 436
             /**
441 437
              *
442 438
              * @param EntityMapper<TEntity> $owner
443 439
              * @param EntityMapper<TEntity> $related
444 440
              */
445
-            public function __construct(EntityMapper $owner, EntityMapper $related)
446
-            {
441
+            public function __construct(EntityMapper $owner, EntityMapper $related) {
447 442
                 $table = [$owner->getTable(), $related->getTable()];
448 443
                 sort($table);
449 444
                 parent::__construct(implode('_', $table), $related->getForeignKey()->columns());
Please login to merge, or discard this patch.
src/Entity.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -199,9 +199,9 @@
 block discarded – undo
199 199
     }
200 200
 
201 201
         /**
202
-     * Map the entity information
203
-     * @param EntityMapperInterface<TEntity> $mapper
204
-     */
202
+         * Map the entity information
203
+         * @param EntityMapperInterface<TEntity> $mapper
204
+         */
205 205
     abstract public static function mapEntity(EntityMapperInterface $mapper): void;
206 206
 
207 207
     /**
Please login to merge, or discard this patch.