Passed
Branch master (fbe441)
by Andreas
03:53
created
Category
src/ClonerServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function register()
15 15
     {
16
-        $this->app->singleton(Cloner::class, function () {
16
+        $this->app->singleton(Cloner::class, function() {
17 17
             return new Cloner(new CloneService, new PersistenceService);
18 18
         });
19 19
 
Please login to merge, or discard this patch.
src/PersistenceService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
      */
29 29
     private function persistRecursive($parent)
30 30
     {
31
-        NullWrapper::from($parent)->each(function ($model) {
32
-            NullWrapper::from($model->getRelations())->filter(function ($relationModel) {
31
+        NullWrapper::from($parent)->each(function($model) {
32
+            NullWrapper::from($model->getRelations())->filter(function($relationModel) {
33 33
                 return ! is_a($relationModel, Pivot::class);
34
-            })->each(function ($relationModel, $relationName) use ($model) {
34
+            })->each(function($relationModel, $relationName) use ($model) {
35 35
                 $className = \get_class((new ReflectionObject($model))->newInstance()->{$relationName}());
36 36
                 $strategy = $this->getPersistenceStrategy($className);
37 37
                 (new $strategy($model))->persist($relationName, $relationModel);
Please login to merge, or discard this patch.
src/CloneService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     private function cloneRecursive($model)
30 30
     {
31
-        NullWrapper::from($model)->each(function ($item) {
32
-            NullWrapper::from($item->getRelations())->each(function ($method, $relation) use ($item) {
31
+        NullWrapper::from($model)->each(function($item) {
32
+            NullWrapper::from($item->getRelations())->each(function($method, $relation) use ($item) {
33 33
                 $collection = $this->getFreshInstance($this->cloneRecursive($method), $item);
34 34
 
35 35
                 $item->setRelation(
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private function getFreshInstance($model, $parent) : Collection
66 66
     {
67
-        return NullWrapper::from($model)->map(function ($original) use ($parent) {
68
-            return tap(new $original, function ($instance) use ($original, $parent) {
67
+        return NullWrapper::from($model)->map(function($original) use ($parent) {
68
+            return tap(new $original, function($instance) use ($original, $parent) {
69 69
                 $filter = [
70 70
                     $original->getForeignKey(),
71 71
                     $original->getKeyName(),
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                     $original->getUpdatedAtColumn(),
74 74
                 ];
75 75
 
76
-                if (! is_a($instance, Pivot::class)) {
76
+                if ( ! is_a($instance, Pivot::class)) {
77 77
                     array_push($filter, $parent->getForeignKey());
78 78
                 }
79 79
 
Please login to merge, or discard this patch.
src/Strategies/PersistBelongsToManyRelationStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function persist(string $relationName, $models) : void
25 25
     {
26
-        NullWrapper::from($models)->each(function ($model) use ($relationName) {
26
+        NullWrapper::from($models)->each(function($model) use ($relationName) {
27 27
             $this->baseModel->{$relationName}()->attach([$this->baseModel->id => $model->pivot->getAttributes()]);
28 28
         });
29 29
     }
Please login to merge, or discard this patch.
src/Strategies/PersistHasManyRelationStrategy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function persist(string $relationName, $models) : void
25 25
     {
26
-        NullWrapper::from($models)->each(function ($model) use ($relationName) {
26
+        NullWrapper::from($models)->each(function($model) use ($relationName) {
27 27
             $this->baseModel->{$relationName}()->save($model);
28 28
         });
29 29
     }
Please login to merge, or discard this patch.