Passed
Branch master (122414)
by Einar-Johan
09:02
created
src/HasNestedSets.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -105,30 +105,30 @@  discard block
 block discarded – undo
105 105
     }
106 106
 
107 107
     /**
108
-    * Get the parent column name.
109
-    *
110
-    * @return string
111
-    */
108
+     * Get the parent column name.
109
+     *
110
+     * @return string
111
+     */
112 112
     public function getParentColumnName(): string
113 113
     {
114 114
         return $this->parentColumn;
115 115
     }
116 116
 
117 117
     /**
118
-    * Get the table qualified parent column name.
119
-    *
120
-    * @return string
121
-    */
118
+     * Get the table qualified parent column name.
119
+     *
120
+     * @return string
121
+     */
122 122
     public function getQualifiedParentColumnName(): string
123 123
     {
124 124
         return $this->getTable().'.'.$this->getParentColumnName();
125 125
     }
126 126
 
127 127
     /**
128
-    * Get the value of the models "parent_id" field.
129
-    *
130
-    * @return int|string
131
-    */
128
+     * Get the value of the models "parent_id" field.
129
+     *
130
+     * @return int|string
131
+     */
132 132
     public function getParentId()
133 133
     {
134 134
         return $this->getAttribute($this->getparentColumnName());
@@ -294,20 +294,20 @@  discard block
 block discarded – undo
294 294
     }
295 295
 
296 296
     /**
297
-    * Parent relation (self-referential) 1-1.
298
-    *
299
-    * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
300
-    */
297
+     * Parent relation (self-referential) 1-1.
298
+     *
299
+     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
300
+     */
301 301
     public function parent(): BelongsTo
302 302
     {
303 303
         return $this->belongsTo(get_class($this), $this->getParentColumnName());
304 304
     }
305 305
 
306 306
     /**
307
-    * Children relation (self-referential) 1-N.
308
-    *
309
-    * @return \Illuminate\Database\Eloquent\Relations\HasMany
310
-    */
307
+     * Children relation (self-referential) 1-N.
308
+     *
309
+     * @return \Illuminate\Database\Eloquent\Relations\HasMany
310
+     */
311 311
     public function children(): HasMany
312 312
     {
313 313
         return $this->hasMany(get_class($this), $this->getParentColumnName())
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
     }
822 822
 
823 823
     /**
824
-    * Returns the level of this node in the tree.
825
-    * Root level is 0.
826
-    *
827
-    * @return int
828
-    */
824
+     * Returns the level of this node in the tree.
825
+     * Root level is 0.
826
+     *
827
+     * @return int
828
+     */
829 829
     public function getLevel(): int
830 830
     {
831 831
         if (is_null($this->getParentId())) {
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
     public function isDescendantOf($other): bool
845 845
     {
846 846
         return (
847
-      $this->getLeft() > $other->getLeft() &&
847
+        $this->getLeft() > $other->getLeft() &&
848 848
       $this->getLeft() < $other->getRight() &&
849 849
       $this->inSameScope($other)
850 850
     );
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     public function isSelfOrDescendantOf($other): bool
860 860
     {
861 861
         return (
862
-      $this->getLeft() >= $other->getLeft() &&
862
+        $this->getLeft() >= $other->getLeft() &&
863 863
       $this->getLeft() < $other->getRight() &&
864 864
       $this->inSameScope($other)
865 865
     );
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
     public function isAncestorOf($other): bool
875 875
     {
876 876
         return (
877
-      $this->getLeft() < $other->getLeft() &&
877
+        $this->getLeft() < $other->getLeft() &&
878 878
       $this->getRight() > $other->getLeft() &&
879 879
       $this->inSameScope($other)
880 880
     );
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     public function isSelfOrAncestorOf($other): bool
890 890
     {
891 891
         return (
892
-      $this->getLeft() <= $other->getLeft() &&
892
+        $this->getLeft() <= $other->getLeft() &&
893 893
       $this->getRight() > $other->getLeft() &&
894 894
       $this->inSameScope($other)
895 895
     );
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
         ->where($self->getLeftColumnName(), '>', $self->getLeft())
1262 1262
         ->where($self->getRightColumnName(), '<', $self->getRight())
1263 1263
         ->update([
1264
-          $self->getDeletedAtColumn() => null,
1265
-          $self->getUpdatedAtColumn() => $self->{$self->getUpdatedAtColumn()},
1264
+            $self->getDeletedAtColumn() => null,
1265
+            $self->getUpdatedAtColumn() => $self->{$self->getUpdatedAtColumn()},
1266 1266
         ]);
1267 1267
         });
1268 1268
     }
@@ -1354,12 +1354,12 @@  discard block
 block discarded – undo
1354 1354
     }
1355 1355
 
1356 1356
     /**
1357
-         * Reloads the model from the database.
1358
-         *
1359
-         * @return \Baum\Node
1360
-         *
1361
-         * @throws ModelNotFoundException
1362
-         */
1357
+     * Reloads the model from the database.
1358
+     *
1359
+     * @return \Baum\Node
1360
+     *
1361
+     * @throws ModelNotFoundException
1362
+     */
1363 1363
     public function reload(): Model
1364 1364
     {
1365 1365
         if ($this->exists || ($this->areSoftDeletesEnabled() && $this->trashed())) {
Please login to merge, or discard this patch.
src/Move.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
       ELSE ${wrappedParent} END";
136 136
 
137 137
         $updateConditions = [
138
-      $leftColumn => $connection->raw($lftSql),
139
-      $rightColumn => $connection->raw($rgtSql),
140
-      $parentColumn => $connection->raw($parentSql),
138
+        $leftColumn => $connection->raw($lftSql),
139
+        $rightColumn => $connection->raw($rgtSql),
140
+        $parentColumn => $connection->raw($parentSql),
141 141
     ];
142 142
 
143 143
         if ($this->node->timestamps) {
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
         }
221 221
 
222 222
         switch ($this->position) {
223
-      case 'child':
223
+        case 'child':
224 224
         $this->_bound1 = $this->target->getRight();
225 225
 
226 226
         break;
227 227
 
228
-      case 'left':
228
+        case 'left':
229 229
         $this->_bound1 = $this->target->getLeft();
230 230
 
231 231
         break;
232 232
 
233
-      case 'right':
233
+        case 'right':
234 234
         $this->_bound1 = $this->target->getRight() + 1;
235 235
 
236 236
         break;
237 237
 
238
-      case 'root':
238
+        case 'root':
239 239
         $this->_bound1 = $this->node->newNestedSetQuery()->max($this->node->getRightColumnName()) + 1;
240 240
 
241 241
         break;
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
         // we have defined the boundaries of two non-overlapping intervals,
278 278
         // so sorting puts both the intervals and their boundaries in order
279 279
         $this->_boundaries = [
280
-      $this->node->getLeft(),
281
-      $this->node->getRight(),
282
-      $this->bound1(),
283
-      $this->bound2(),
280
+        $this->node->getLeft(),
281
+        $this->node->getRight(),
282
+        $this->bound1(),
283
+        $this->bound2(),
284 284
     ];
285 285
         sort($this->_boundaries);
286 286
 
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
     protected function parentId()
296 296
     {
297 297
         switch ($this->position) {
298
-      case 'root':
298
+        case 'root':
299 299
         return null;
300 300
 
301
-      case 'child':
301
+        case 'child':
302 302
         return $this->target->getKey();
303 303
 
304
-      default:
304
+        default:
305 305
         return $this->target->getParentId();
306 306
     }
307 307
     }
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
     protected function applyLockBetween(int $lft, int $rgt): void
400 400
     {
401 401
         $this->node->newQuery()
402
-      ->where($this->node->getLeftColumnName(), '>=', $lft)
403
-      ->where($this->node->getRightColumnName(), '<=', $rgt)
404
-      ->select($this->node->getKeyName())
405
-      ->lockForUpdate()
406
-      ->get();
402
+        ->where($this->node->getLeftColumnName(), '>=', $lft)
403
+        ->where($this->node->getRightColumnName(), '<=', $rgt)
404
+        ->select($this->node->getKeyName())
405
+        ->lockForUpdate()
406
+        ->get();
407 407
     }
408 408
 }
Please login to merge, or discard this patch.