Passed
Push — dev_2x ( 20ede0...c439ba )
by Adrian
07:41
created
src/CodeGenerator/MapperBaseGenerator.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $this->namespace->addUse($this->mapper->getEntityNamespace() . '\\' . $this->mapper->getEntityClass());
144 144
         $method = $this->class->addMethod('find')
145
-                              ->setReturnNullable(true)
146
-                              ->setReturnType($this->mapper->getEntityClass());
145
+                                ->setReturnNullable(true)
146
+                                ->setReturnType($this->mapper->getEntityClass());
147 147
         $method->addParameter('pk');
148 148
         $method->addParameter('load', [])->setType('array');
149 149
         $method->setBody('return $this->newQuery()->find($pk, $load);');
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     protected function addNewQueryMethod()
153 153
     {
154 154
         $method = $this->class->addMethod('newQuery')
155
-                              ->setReturnType($this->mapper->getQueryClass());
155
+                                ->setReturnType($this->mapper->getQueryClass());
156 156
         $method->addBody(sprintf('$query = new %s($this->getReadConnection(), $this);', $this->mapper->getQueryClass()));
157 157
         $method->addBody('return $this->behaviours->apply($this, __FUNCTION__, $query);');
158 158
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $this->namespace->addUse(StateEnum::class);
167 167
 
168 168
         $method = $this->class->addMethod('save')
169
-                              ->setReturnType('bool');
169
+                                ->setReturnType('bool');
170 170
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
171 171
         $method->addParameter('withRelations', false);
172 172
         $method->setBody('
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     protected function addDeleteMethod()
205 205
     {
206 206
         $method = $this->class->addMethod('delete')
207
-                              ->setReturnType('bool');
207
+                                ->setReturnType('bool');
208 208
         $method->addParameter('entity')->setType($this->mapper->getEntityClass());
209 209
         $method->addParameter('withRelations', false);
210 210
         $method->setBody('
Please login to merge, or discard this patch.
src/CodeGenerator/EntityBaseGenerator.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         }
57 57
 
58 58
         $constructor = $this->class->addMethod('__construct')
59
-                                   ->setBody('parent::__construct($attributes, $state);');
59
+                                    ->setBody('parent::__construct($attributes, $state);');
60 60
         $constructor->addParameter('attributes')
61 61
                     ->setType('array')
62 62
                     ->setDefaultValue([]);
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Relation/ManyToOneObserver.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $name          = $this->relation->getName();
51 51
         $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper());
52 52
         $type          = $foreignMapper->getEntityNamespace()
53
-                         . '\\' . $foreignMapper->getEntityClass();
53
+                            . '\\' . $foreignMapper->getEntityClass();
54 54
 
55 55
         $class->getNamespace()->addUse($type, null, $type);
56 56
 
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
             $setter = $class->addMethod(Str::methodName($name, 'set'));
71 71
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
72 72
             $setter->addParameter('value')
73
-                   ->setType($type)
74
-                   ->setNullable(true);
73
+                    ->setType($type)
74
+                    ->setNullable(true);
75 75
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
76 76
 
77 77
             $getter = $class->addMethod(Str::methodName($name, 'get'));
78 78
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
79 79
             $getter->addBody('return $this->get(\'' . $name . '\');');
80 80
             $getter->setReturnType($type)
81
-                   ->setReturnNullable(true);
81
+                    ->setReturnNullable(true);
82 82
         }
83 83
 
84 84
         return $class;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function with(Relation $relation)
23 23
     {
24
-        $clone         = clone($this);
24
+        $clone = clone($this);
25 25
         $clone->relation = $relation;
26 26
 
27 27
         return $clone;
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Relation/OneToManyObserver.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $name          = $this->relation->getName();
54 54
         $foreignMapper = $mapper->getOrm()->getMapper($this->relation->getForeignMapper());
55 55
         $type          = $foreignMapper->getEntityNamespace()
56
-                         . '\\' . $foreignMapper->getEntityClass();
56
+                            . '\\' . $foreignMapper->getEntityClass();
57 57
 
58 58
         $class->getNamespace()->addUse(Collection::class);
59 59
         $class->getNamespace()->addUse($type, null, $type);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $adder = $class->addMethod(Str::methodName(Inflector::singularize($name), 'add'));
62 62
         $adder->setVisibility(ClassType::VISIBILITY_PUBLIC);
63 63
         $adder->addParameter('value')
64
-              ->setType($type);
64
+                ->setType($type);
65 65
         $adder->addBody('
66 66
 $this->attributes[\'' . $name . '\']->addElement($value);        
67 67
         ');
@@ -72,14 +72,14 @@  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('Collection');
75
+                    ->setType('Collection');
76 76
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
77 77
 
78 78
             $getter = $class->addMethod(Str::methodName($name, 'get'));
79 79
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
80 80
             $getter->addBody('return $this->get(\'' . $name . '\');');
81 81
             $getter->setReturnType('Collection')
82
-                   ->setReturnNullable(true);
82
+                    ->setReturnNullable(true);
83 83
         }
84 84
 
85 85
         return $class;
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/ComputedPropertyObserver.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@
 block discarded – undo
68 68
                 $setter = $class->addMethod(Str::methodName($name . ' Attribute', 'set'));
69 69
                 $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
70 70
                 $setter->addParameter('value')
71
-                       ->setType($type)
72
-                       ->setNullable($this->property->getNullable());
71
+                        ->setType($type)
72
+                        ->setNullable($this->property->getNullable());
73 73
                 $setter->setBody($body);
74 74
                 $setter->addComment($this->property->getSetterComment());
75 75
             }
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/ColumnObserver.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,14 +78,14 @@
 block discarded – undo
78 78
             $setter->setVisibility(ClassType::VISIBILITY_PUBLIC);
79 79
             $setter->addParameter('value')
80 80
                     ->setType($type)
81
-                   ->setNullable($this->attributeIsNullable());
81
+                    ->setNullable($this->attributeIsNullable());
82 82
             $setter->addBody('$this->set(\'' . $name . '\', $value);');
83 83
 
84 84
             $getter = $class->addMethod(Str::methodName($name, 'get'));
85 85
             $getter->setVisibility(ClassType::VISIBILITY_PUBLIC);
86 86
             $getter->addBody('return $this->get(\'' . $name . '\');');
87 87
             $getter->setReturnType($type)
88
-                   ->setReturnNullable($this->attributeIsNullable());
88
+                    ->setReturnNullable($this->attributeIsNullable());
89 89
         }
90 90
 
91 91
         return $class;
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Behaviour/SoftDeleteObserver.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Delete::class, 'DeleteAction');
52 52
         $class->getNamespace()->addUse(\Sirius\Orm\Action\Update::class, 'UpdateAction');
53 53
         $class->addProperty('deletedAtColumn', $this->behaviour->getDeletedAtColumn())
54
-              ->setVisibility('protected');
54
+                ->setVisibility('protected');
55 55
 
56 56
         //
57 57
         $method = $class->addMethod('newDeleteAction');
@@ -116,21 +116,21 @@  discard block
 block discarded – undo
116 116
     public function observeBaseQueryClass(ClassType $class): ClassType
117 117
     {
118 118
         $class->addProperty('deletedAtColumn', $this->behaviour->getDeletedAtColumn())
119
-              ->setVisibility('protected');
119
+                ->setVisibility('protected');
120 120
 
121 121
         // add guard
122 122
         if ( ! $class->hasMethod('init')) {
123 123
             $class->addMethod('init')
124
-                  ->setVisibility(ClassType::VISIBILITY_PROTECTED)
125
-                  ->setBody('parent::init();' . PHP_EOL);
124
+                    ->setVisibility(ClassType::VISIBILITY_PROTECTED)
125
+                    ->setBody('parent::init();' . PHP_EOL);
126 126
         }
127 127
         $init = $class->getMethod('init');
128 128
         $init->addBody('$this->guards[] = $this->deletedAtColumn . \' IS NULL\';' . PHP_EOL);
129 129
 
130 130
         // add withTrashed()
131 131
         $class->addMethod('withTrashed')
132
-              ->setVisibility(ClassType::VISIBILITY_PUBLIC)
133
-              ->setBody('
132
+                ->setVisibility(ClassType::VISIBILITY_PUBLIC)
133
+                ->setBody('
134 134
 $guards = [];
135 135
 foreach ($this->guards as $k => $v) {
136 136
     if ($v != $this->deletedAtColumn . \' IS NULL\') {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
               ->setVisibility('protected');
120 120
 
121 121
         // add guard
122
-        if ( ! $class->hasMethod('init')) {
122
+        if (!$class->hasMethod('init')) {
123 123
             $class->addMethod('init')
124 124
                   ->setVisibility(ClassType::VISIBILITY_PROTECTED)
125 125
                   ->setBody('parent::init();' . PHP_EOL);
Please login to merge, or discard this patch.
src/CodeGenerator/Observer/Behaviour/TimestampsObserver.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
     public function observeBaseMapperClass(ClassType $class): ClassType
46 46
     {
47 47
         $class->addProperty('createdAtColumn', $this->behaviour->getCreatedAtColumn())
48
-              ->setVisibility('protected');
48
+                ->setVisibility('protected');
49 49
         $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn())
50
-              ->setVisibility('protected');
50
+                ->setVisibility('protected');
51 51
 
52 52
         if ( ! $class->hasMethod('init')) {
53 53
             $class->addMethod('init')->setVisibility('public')
54
-                  ->setBody('parent::init();' . PHP_EOL);
54
+                    ->setBody('parent::init();' . PHP_EOL);
55 55
         }
56 56
         $class->getNamespace()->addUse(\Sirius\Orm\Behaviour\Timestamps::class);
57 57
         $method = $class->getMethod('init');
@@ -64,35 +64,35 @@  discard block
 block discarded – undo
64 64
     public function observeBaseQueryClass(ClassType $class): ClassType
65 65
     {
66 66
         $class->addProperty('createdAtColumn', $this->behaviour->getCreatedAtColumn())
67
-              ->setVisibility('protected');
67
+                ->setVisibility('protected');
68 68
         $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn())
69
-              ->setVisibility('protected');
69
+                ->setVisibility('protected');
70 70
 
71 71
         // add methods
72 72
         $class->addMethod('orderByFirstCreated')
73
-              ->setVisibility('public')
74
-              ->setBody('
73
+                ->setVisibility('public')
74
+                ->setBody('
75 75
 $this->orderBy($this->createdAtColumn . \' ASC\');
76 76
 
77 77
 return $this;            
78 78
             ');
79 79
         $class->addMethod('orderByLastCreated')
80
-              ->setVisibility('public')
81
-              ->setBody('
80
+                ->setVisibility('public')
81
+                ->setBody('
82 82
 $this->orderBy($this->createdAtColumn . \' DESC\');
83 83
 
84 84
 return $this;            
85 85
             ');
86 86
         $class->addMethod('orderByFirstUpdated')
87
-              ->setVisibility('public')
88
-              ->setBody('
87
+                ->setVisibility('public')
88
+                ->setBody('
89 89
 $this->orderBy($this->updatedAtColumn . \' ASC\');
90 90
 
91 91
 return $this;            
92 92
             ');
93 93
         $class->addMethod('orderByLastCreated')
94
-              ->setVisibility('public')
95
-              ->setBody('
94
+                ->setVisibility('public')
95
+                ->setBody('
96 96
 $this->orderBy($this->updatedAtColumn . \' DESC\');
97 97
 
98 98
 return $this;            
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         $class->addProperty('updatedAtColumn', $this->behaviour->getUpdatedAtColumn())
50 50
               ->setVisibility('protected');
51 51
 
52
-        if ( ! $class->hasMethod('init')) {
52
+        if (!$class->hasMethod('init')) {
53 53
             $class->addMethod('init')->setVisibility('public')
54 54
                   ->setBody('parent::init();' . PHP_EOL);
55 55
         }
Please login to merge, or discard this patch.
src/Orm.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             unset($this->lazyMappers[$name]);
106 106
         }
107 107
 
108
-        if ( ! isset($this->mappers[$name]) || ! $this->mappers[$name]) {
108
+        if (!isset($this->mappers[$name]) || !$this->mappers[$name]) {
109 109
             throw new InvalidArgumentException(sprintf('Mapper named %s is not registered', $name));
110 110
         }
111 111
 
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
     {
139 139
         $foreignMapper = $options[RelationConfig::FOREIGN_MAPPER];
140 140
         if ($this->has($foreignMapper)) {
141
-            if ( ! $foreignMapper instanceof Mapper) {
141
+            if (!$foreignMapper instanceof Mapper) {
142 142
                 $foreignMapper = $this->get($foreignMapper);
143 143
             }
144 144
         }
145 145
         $type          = $options[RelationConfig::TYPE];
146 146
         $relationClass = 'Sirius\\Orm\\Relation\\' . Str::className($type);
147 147
 
148
-        if ( ! class_exists($relationClass)) {
148
+        if (!class_exists($relationClass)) {
149 149
             throw new InvalidArgumentException("{$relationClass} does not exist");
150 150
         }
151 151
 
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
             $mapper = $this->mapperLocator->get($mapperConfigOrFactory);
173 173
         }
174 174
 
175
-        if (! $mapper) {
175
+        if (!$mapper) {
176 176
             throw new InvalidArgumentException(
177 177
                 'The mapper could not be generated/retrieved.'
178 178
             );
179 179
         }
180 180
 
181
-        if (! $mapper instanceof Mapper) {
181
+        if (!$mapper instanceof Mapper) {
182 182
             throw new InvalidArgumentException(
183 183
                 'The mapper generated from the factory is not a valid `Mapper` instance.'
184 184
             );
Please login to merge, or discard this patch.