Passed
Push — dev_2x ( d7ecbe...3e8772 )
by Adrian
01:43
created
src/CodeGenerator/ClassGenerator.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
         return [
75 75
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
76 76
             'contents' => $this->classPrinter->printFile($file)
77
-                          . PHP_EOL
78
-                          . $namespace
79
-                          . $this->classPrinter->printClass($class)
77
+                            . PHP_EOL
78
+                            . $namespace
79
+                            . $this->classPrinter->printClass($class)
80 80
         ];
81 81
     }
82 82
 
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
         return [
97 97
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
98 98
             'contents' => $this->classPrinter->printFile($file)
99
-                          . PHP_EOL
100
-                          . $namespace
101
-                          . $this->classPrinter->printClass($class)
99
+                            . PHP_EOL
100
+                            . $namespace
101
+                            . $this->classPrinter->printClass($class)
102 102
         ];
103 103
     }
104 104
 
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
         return [
114 114
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
115 115
             'contents' => $this->classPrinter->printFile($file)
116
-                          . PHP_EOL
117
-                          . $namespace
118
-                          . $this->classPrinter->printClass($class)
116
+                            . PHP_EOL
117
+                            . $namespace
118
+                            . $this->classPrinter->printClass($class)
119 119
         ];
120 120
     }
121 121
 
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
         return [
138 138
             'path'     => $mapper->getDestination() . $class->getName() . '.php',
139 139
             'contents' => $this->classPrinter->printFile($file)
140
-                          . PHP_EOL
141
-                          . $namespace
142
-                          . $this->classPrinter->printClass($class)
140
+                            . PHP_EOL
141
+                            . $namespace
142
+                            . $this->classPrinter->printClass($class)
143 143
         ];
144 144
     }
145 145
 
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
         return [
156 156
             'path'     => $mapper->getEntityDestination() . $class->getName() . '.php',
157 157
             'contents' => $this->classPrinter->printFile($file)
158
-                          . PHP_EOL
159
-                          . $namespace
160
-                          . $this->classPrinter->printClass($class)
158
+                            . PHP_EOL
159
+                            . $namespace
160
+                            . $this->classPrinter->printClass($class)
161 161
         ];
162 162
     }
163 163
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
         return [
180 180
             'path'     => $mapper->getEntityDestination() . $class->getName() . '.php',
181 181
             'contents' => $this->classPrinter->printFile($file)
182
-                          . PHP_EOL
183
-                          . $namespace
184
-                          . $this->classPrinter->printClass($class)
182
+                            . PHP_EOL
183
+                            . $namespace
184
+                            . $this->classPrinter->printClass($class)
185 185
         ];
186 186
     }
187 187
 }
Please login to merge, or discard this patch.
src/CodeGenerator/MapperBaseGenerator.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $this->namespace->addUse($this->mapper->getEntityNamespace() . '\\' . $this->mapper->getEntityClass());
147 147
         $method = $this->class->addMethod('find')
148
-                              ->setReturnNullable(true)
149
-                              ->setReturnType($this->mapper->getEntityClass());
148
+                                ->setReturnNullable(true)
149
+                                ->setReturnType($this->mapper->getEntityClass());
150 150
         $method->addParameter('pk');
151 151
         $method->addParameter('load', [])->setType('array');
152 152
         $method->setBody('return $this->newQuery()->find($pk, $load);');
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     protected function addNewQueryMethod()
156 156
     {
157 157
         $method = $this->class->addMethod('newQuery')
158
-                              ->setReturnType($this->mapper->getQueryClass());
158
+                                ->setReturnType($this->mapper->getQueryClass());
159 159
         $method->addBody(sprintf('$query = new %s($this->getReadConnection(), $this);', $this->mapper->getQueryClass()));
160 160
         $method->addBody('return $this->behaviours->apply($this, __FUNCTION__, $query);');
161 161
     }
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
     protected function addNewSubselectQueryMethod()
164 164
     {
165 165
         $method = $this->class->addMethod('newSubselectQuery')
166
-                              ->setReturnType($this->mapper->getQueryClass());
166
+                                ->setReturnType($this->mapper->getQueryClass());
167 167
         /** @scrutinizer ignore-deprecated */ $this->class->getNamespace()->addUse(Connection::class, null, $connectionAlias);
168 168
         $method->addParameter('connection')
169
-               ->setType($connectionAlias);
169
+                ->setType($connectionAlias);
170 170
 
171 171
         /** @scrutinizer ignore-deprecated */ $this->class->getNamespace()->addUse(Bindings::class, null, $bindingsAlias);
172 172
         $method->addParameter('bindings')
173
-               ->setType($bindingsAlias);
173
+                ->setType($bindingsAlias);
174 174
 
175 175
         $method->addParameter('indent')
176
-               ->setType('string');
176
+                ->setType('string');
177 177
 
178 178
         $method->addBody(sprintf('$query = new %s($this->getReadConnection(), $this, $bindings, $indent);', $this->mapper->getQueryClass()));
179 179
         $method->addBody('return $this->behaviours->apply($this, __FUNCTION__, $query);');
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $this->namespace->addUse(StateEnum::class);
187 187
 
188 188
         $method = $this->class->addMethod('save')
189
-                              ->setReturnType('bool');
189
+                                ->setReturnType('bool');
190 190
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
191 191
         $method->addParameter('withRelations', false);
192 192
         $method->setBody('
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     protected function addDeleteMethod()
225 225
     {
226 226
         $method = $this->class->addMethod('delete')
227
-                              ->setReturnType('bool');
227
+                                ->setReturnType('bool');
228 228
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
229 229
         $method->addParameter('withRelations', false);
230 230
         $method->setBody('
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Behaviour/TimestampsObserver.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
     public function observeBaseMapperClass(ClassType $class): ClassType
48 48
     {
49 49
         $class->addProperty('createdAtColumn', $this->behaviour->getCreatedAtColumn())
50
-              ->setVisibility('protected');
50
+                ->setVisibility('protected');
51 51
         $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn())
52
-              ->setVisibility('protected');
52
+                ->setVisibility('protected');
53 53
 
54 54
         if (! $class->hasMethod('init')) {
55 55
             $class->addMethod('init')->setVisibility('public')
56
-                  ->setBody('parent::init();' . PHP_EOL);
56
+                    ->setBody('parent::init();' . PHP_EOL);
57 57
         }
58 58
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse(\Sirius\Orm\Behaviour\Timestamps::class);
59 59
         $method = $class->getMethod('init');
@@ -66,35 +66,35 @@  discard block
 block discarded – undo
66 66
     public function observeBaseQueryClass(ClassType $class): ClassType
67 67
     {
68 68
         $class->addProperty('createdAtColumn', $this->behaviour->getCreatedAtColumn())
69
-              ->setVisibility('protected');
69
+                ->setVisibility('protected');
70 70
         $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn())
71
-              ->setVisibility('protected');
71
+                ->setVisibility('protected');
72 72
 
73 73
         // add methods
74 74
         $class->addMethod('orderByFirstCreated')
75
-              ->setVisibility('public')
76
-              ->setBody('
75
+                ->setVisibility('public')
76
+                ->setBody('
77 77
 $this->orderBy($this->createdAtColumn . \' ASC\');
78 78
 
79 79
 return $this;            
80 80
             ');
81 81
         $class->addMethod('orderByLastCreated')
82
-              ->setVisibility('public')
83
-              ->setBody('
82
+                ->setVisibility('public')
83
+                ->setBody('
84 84
 $this->orderBy($this->createdAtColumn . \' DESC\');
85 85
 
86 86
 return $this;            
87 87
             ');
88 88
         $class->addMethod('orderByFirstUpdated')
89
-              ->setVisibility('public')
90
-              ->setBody('
89
+                ->setVisibility('public')
90
+                ->setBody('
91 91
 $this->orderBy($this->updatedAtColumn . \' ASC\');
92 92
 
93 93
 return $this;            
94 94
             ');
95 95
         $class->addMethod('orderByLastCreated')
96
-              ->setVisibility('public')
97
-              ->setBody('
96
+                ->setVisibility('public')
97
+                ->setBody('
98 98
 $this->orderBy($this->updatedAtColumn . \' DESC\');
99 99
 
100 100
 return $this;            
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Behaviour/SoftDeleteObserver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse(\Sirius\Orm\Action\Delete::class, 'DeleteAction');
55 55
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse(\Sirius\Orm\Action\Update::class, 'UpdateAction');
56 56
         $class->addProperty('deletedAtColumn', $this->behaviour->getDeletedAtColumn())
57
-              ->setVisibility('protected');
57
+                ->setVisibility('protected');
58 58
 
59 59
         //
60 60
         $method = $class->addMethod('newDeleteAction');
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
     public function observeBaseQueryClass(ClassType $class): ClassType
120 120
     {
121 121
         $class->addProperty('deletedAtColumn', $this->behaviour->getDeletedAtColumn())
122
-              ->setVisibility('protected');
122
+                ->setVisibility('protected');
123 123
 
124 124
         // add guard
125 125
         if (! $class->hasMethod('init')) {
126 126
             $class->addMethod('init')
127
-                  ->setVisibility(ClassType::VISIBILITY_PROTECTED)
128
-                  ->setBody('parent::init();' . PHP_EOL);
127
+                    ->setVisibility(ClassType::VISIBILITY_PROTECTED)
128
+                    ->setBody('parent::init();' . PHP_EOL);
129 129
         }
130 130
         $init = $class->getMethod('init');
131 131
         $init->addBody('$this->withoutTrashed();' . PHP_EOL);
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Relation/ManyToOneObserver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $name          = $this->relation->getName();
53 53
         $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper());
54 54
         $type          = $foreignMapper->getEntityNamespace()
55
-                         . '\\' . $foreignMapper->getEntityClass();
55
+                            . '\\' . $foreignMapper->getEntityClass();
56 56
 
57 57
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse($type, null, $type);
58 58
 
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
             $setter = $class->addMethod(Str::methodName($name, 'set'));
73 73
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
74 74
             $setter->addParameter('value')
75
-                   ->setType($type)
76
-                   ->setNullable(true);
75
+                    ->setType($type)
76
+                    ->setNullable(true);
77 77
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
78 78
 
79 79
             $getter = $class->addMethod(Str::methodName($name, 'get'));
80 80
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
81 81
             $getter->addBody('return $this->get(\'' . $name . '\');');
82 82
             $getter->setReturnType($type)
83
-                   ->setReturnNullable(true);
83
+                    ->setReturnNullable(true);
84 84
         }
85 85
 
86 86
         return $class;
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Relation/OneToManyObserver.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $name          = $this->relation->getName();
56 56
         $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper());
57 57
         $type          = $foreignMapper->getEntityNamespace()
58
-                         . '\\' . $foreignMapper->getEntityClass();
58
+                            . '\\' . $foreignMapper->getEntityClass();
59 59
 
60 60
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse(Collection::class);
61 61
         /** @scrutinizer ignore-deprecated */ $class->getNamespace()->addUse($type, null, $type);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $setter = $class->addMethod(Str::methodName($name, 'set'));
67 67
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
68 68
             $setter->addParameter('value')
69
-                   ->setType('Collection');
69
+                    ->setType('Collection');
70 70
             $setter->setBody('$this->set(\'' . $name . '\', $value);');
71 71
 
72 72
             $getter = $class->addMethod(Str::methodName($name, 'get'));
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $adder    = $class->addMethod(Str::methodName($singular, 'add'));
81 81
         $adder->setVisibility(ClassType::VISIBILITY_PUBLIC);
82 82
         $adder->addParameter($singular)
83
-              ->setType($type);
83
+                ->setType($type);
84 84
         $adder->setBody(sprintf('$this->get(\'%s\')->add($%s);', $name, $singular));
85 85
 
86 86
         $class = $this->addAggregates($class);
Please login to merge, or discard this patch.