Test Failed
Branch master (622e79)
by Andreas
02:55
created
src/storage/connection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -213,7 +213,7 @@
 block discarded – undo
213 213
             $midgard = midgard_connection::get_instance();
214 214
             if ($midgard->config->logfilename) {
215 215
                 $logdir = dirname($midgard->config->logfilename);
216
-                if (   !is_dir($logdir)
216
+                if (!is_dir($logdir)
217 217
                     && !mkdir($logdir, 0777, true)) {
218 218
                     throw exception::user_data('Log directory could not be created');
219 219
                 }
Please login to merge, or discard this patch.
src/command/schema.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         $mgd_config = midgard_connection::get_instance()->config;
57 57
         $mgdschema_file = $mgd_config->vardir . '/mgdschema_classes.php';
58
-        if (   file_exists($mgdschema_file)
58
+        if (file_exists($mgdschema_file)
59 59
             && !unlink($mgdschema_file)) {
60 60
             throw new \RuntimeException('Could not unlink ' . $mgdschema_file);
61 61
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $cms = $em->getMetadataFactory()->getAllMetadata();
73 73
 
74 74
         // create storage
75
-        if (    !midgard_storage::create_base_storage()
75
+        if (!midgard_storage::create_base_storage()
76 76
              && midgard_connection::get_instance()->get_error_string() != 'MGD_ERR_OK') {
77 77
             throw new \Exception("Failed to create base database structures" . midgard_connection::get_instance()->get_error_string());
78 78
         }
Please login to merge, or discard this patch.
src/classgenerator.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
                     break;
175 175
             }
176 176
             if (   $default !== null
177
-                   // we need to skip working links because in this case, Doctrine expects objects as values
177
+                    // we need to skip working links because in this case, Doctrine expects objects as values
178 178
                 && (   !$property->link
179 179
                     || $this->manager->resolve_targetclass($property) === false)) {
180 180
                 $line .= ' = ' . $default;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $types = $this->manager->get_types();
71
-        uasort($types, function ($a, $b) {
72
-            if (   !empty($a->extends)
71
+        uasort($types, function($a, $b) {
72
+            if (!empty($a->extends)
73 73
                 && !empty($b->extends)) {
74 74
                 return strnatcmp($a->extends, $b->extends);
75 75
             }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $prefix = $this->get_class_prefix($namespace);
113 113
 
114 114
         foreach ($this->manager->get_types() as $type) {
115
-            if (   $prefix !== ''
115
+            if ($prefix !== ''
116 116
                 && !class_exists($type->name)) {
117 117
                 $this->add_line('class_alias( "' . $prefix . $type->name . '", "' . $type->name . '");');
118 118
             }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         foreach ($this->manager->get_inherited_mapping() as $child => $parent) {
122 122
             $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $prefix . $child . '");');
123
-            if (   $prefix !== ''
123
+            if ($prefix !== ''
124 124
                 && !class_exists($child)) {
125 125
                 $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $child . '");');
126 126
             }
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
                     $objects[$name] = 'new midgard_datetime("0001-01-01 00:00:00")';
182 182
                     break;
183 183
             }
184
-            if (   $default !== null
184
+            if ($default !== null
185 185
                    // we need to skip working links because in this case, Doctrine expects objects as values
186
-                && (   !$property->link
186
+                && (!$property->link
187 187
                     || $this->manager->resolve_targetclass($property) === false)) {
188 188
                 $line .= ' = ' . $default;
189 189
             }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $this->write_annotations($type);
244 244
         $this->add_line('class ' . $type->name . ' extends ' . $type->extends);
245 245
         $mixins = $type->get_mixins();
246
-        $interfaces = array_filter(array_map(function ($name) {
246
+        $interfaces = array_filter(array_map(function($name) {
247 247
             if (interface_exists('\\midgard\\portable\\storage\\interfaces\\' . $name)) {
248 248
                 return '\\midgard\\portable\\storage\\interfaces\\' . $name;
249 249
             }
Please login to merge, or discard this patch.
src/mgdschema/type.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         } else {
66 66
             if ($property->parentfield) {
67 67
                 $this->parentfield = $property->name;
68
-                if (   empty($this->parent)
68
+                if (empty($this->parent)
69 69
                     && $property->link) {
70 70
                     $this->parent = $property->link['target'];
71 71
                 }
Please login to merge, or discard this patch.
src/driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 
157 157
         foreach ($type->get_properties() as $name => $property) {
158 158
             // doctrine can handle id links only
159
-            if (   $property->link
159
+            if ($property->link
160 160
                 && $target_class = $this->manager->resolve_targetclass($property)) {
161 161
                 $link_mapping = [
162 162
                     'fieldName' => $property->name,
Please login to merge, or discard this patch.
src/api/config.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function read_file_at_path($path)
34 34
     {
35
-        if (   !file_exists($path)
35
+        if (!file_exists($path)
36 36
             || !is_readable($path)) {
37 37
             return false;
38 38
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         $subdirs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F'];
146 146
         foreach ($subdirs as $dir) {
147 147
             foreach ($subdirs as $subdir) {
148
-                if (   !is_dir($this->blobdir . '/' . $dir . '/' . $subdir)
148
+                if (!is_dir($this->blobdir . '/' . $dir . '/' . $subdir)
149 149
                     && !mkdir($this->blobdir . '/' . $dir . '/' . $subdir, 0777, true)) {
150 150
                     return false;
151 151
                 }
Please login to merge, or discard this patch.
src/api/user.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
     private function load_by_properties(array $properties)
63 63
     {
64
-        if (   !array_key_exists('authtype', $properties)
64
+        if (!array_key_exists('authtype', $properties)
65 65
             || !array_key_exists('login', $properties)) {
66 66
             throw exception::invalid_property_value();
67 67
         }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function &get_person()
111 111
     {
112
-        if (   $this->person_object === null
112
+        if ($this->person_object === null
113 113
             && $this->person !== null) {
114 114
             $this->person_object = connection::get_em()->getRepository('midgard:midgard_person')->findOneBy(['guid' => $this->person]);
115 115
         }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function create()
120 120
     {
121
-        if (   empty($this->authtype)
121
+        if (empty($this->authtype)
122 122
             || !empty($this->id)) {
123 123
             exception::invalid_property_value();
124 124
             return false;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
     protected function is_unique()
184 184
     {
185
-        if (   empty($this->login)
185
+        if (empty($this->login)
186 186
             || empty($this->authtype)) {
187 187
             return true;
188 188
         }
Please login to merge, or discard this patch.
api/midgard/replicator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -201,19 +201,19 @@
 block discarded – undo
201 201
                 break;
202 202
         }
203 203
 
204
-        if (   $dbobject->id > 0
204
+        if ($dbobject->id > 0
205 205
             && $dbobject->metadata->revised->format('U') >= $object->metadata->revised->format('U')) {
206 206
             midgard_connection::get_instance()->set_error(exception::OBJECT_IMPORTED);
207 207
             return false;
208 208
         }
209 209
 
210
-        if (   $dbobject->metadata->deleted
210
+        if ($dbobject->metadata->deleted
211 211
             && !$object->metadata->deleted) {
212 212
             if (!midgard_object_class::undelete($dbobject->guid)) {
213 213
                 return false;
214 214
             }
215 215
             $dbobject->metadata_deleted = false;
216
-        } elseif (   !$dbobject->metadata->deleted
216
+        } elseif (!$dbobject->metadata->deleted
217 217
                  && $object->metadata->deleted) {
218 218
             return $dbobject->delete();
219 219
         }
Please login to merge, or discard this patch.
src/api/mgdobject.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function __get($field)
82 82
     {
83
-        if (   $field === 'metadata'
83
+        if ($field === 'metadata'
84 84
             && $this->metadata === null
85 85
             && $this instanceof metadata_interface) {
86 86
             $this->metadata = new metadata($this);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         foreach ($candidates as $candidate) {
103 103
             if ($this->$candidate !== null) {
104 104
                 //Proxies become stale if the object itself is detached, so we have to re-fetch
105
-                if (   $this->$candidate instanceof Proxy
105
+                if ($this->$candidate instanceof Proxy
106 106
                     && $this->$candidate->__isInitialized()) {
107 107
                     try {
108 108
                         $this->$candidate->get_by_id($this->$candidate->id);
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         }
131 131
         // According to Doctrine documentation, proxies should be transparent, but in practice,
132 132
         // there will be problems if we don't force-load
133
-        if (   $entity instanceof Proxy
133
+        if ($entity instanceof Proxy
134 134
             && !$entity->__isInitialized()) {
135 135
             try {
136 136
                 $entity->__load();
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
             exception::duplicate();
184 184
             return false;
185 185
         }
186
-        if (   !$this->is_unique()
186
+        if (!$this->is_unique()
187 187
             || !$this->check_parent()) {
188 188
             return false;
189 189
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
             midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE);
240 240
             return false;
241 241
         }
242
-        if (   $check_dependencies
242
+        if ($check_dependencies
243 243
             && $this->has_dependents()) {
244 244
             exception::has_dependants();
245 245
             return false;
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
     {
331 331
         $this->initialize();
332 332
 
333
-        if (   empty($this->cm->midgard['parentfield'])
333
+        if (empty($this->cm->midgard['parentfield'])
334 334
             || empty($this->cm->midgard['parent'])) {
335 335
             return true;
336 336
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         $this->initialize();
348 348
 
349 349
         foreach ($this->cm->fieldMappings as $name => $field) {
350
-            if (   $field['midgard:midgard_type'] == translator::TYPE_GUID
350
+            if ($field['midgard:midgard_type'] == translator::TYPE_GUID
351 351
                 && !empty($this->$name)
352 352
                 && !mgd_is_guid($this->$name)) {
353 353
                 exception::invalid_property_value("'" . $name . "' property's value is not a guid.");
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
     private function check_upfield()
361 361
     {
362
-        if (   !empty($this->id)
362
+        if (!empty($this->id)
363 363
             && !empty($this->cm->midgard['upfield'])
364 364
             && $this->__get($this->cm->midgard['upfield']) === $this->id
365 365
             && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
             $stat = $results > 0;
397 397
         }
398 398
 
399
-        if (   !$stat
399
+        if (!$stat
400 400
             && !empty($this->cm->midgard['childtypes'])) {
401 401
             foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) {
402 402
                 $qb = connection::get_em()->createQueryBuilder();
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             exception::not_exists();
756 756
             return false;
757 757
         }
758
-        if (   $check_dependencies
758
+        if ($check_dependencies
759 759
             && $this->has_dependents()) {
760 760
             exception::has_dependants();
761 761
             return false;
Please login to merge, or discard this patch.