Completed
Push — master ( 1af4f5...caaac4 )
by Andreas
03:43
created
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 >= $object->metadata->revised) {
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/classgenerator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
         }
64 64
 
65 65
         $types = $this->manager->get_types();
66
-        uasort($types, function ($a, $b) {
67
-            if (   !empty($a->extends)
66
+        uasort($types, function($a, $b) {
67
+            if (!empty($a->extends)
68 68
                 && !empty($b->extends)) {
69 69
                 return strnatcmp($a->extends, $b->extends);
70 70
             } elseif (!empty($a->extends)) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $prefix = $this->get_class_prefix($namespace);
106 106
 
107 107
         foreach ($this->manager->get_types() as $type) {
108
-            if (   $prefix !== ''
108
+            if ($prefix !== ''
109 109
                 && !class_exists($type->name)) {
110 110
                 $this->add_line('class_alias( "' . $prefix . $type->name . '", "' . $type->name . '");');
111 111
             }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
         foreach ($this->manager->get_inherited_mapping() as $child => $parent) {
115 115
             $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $prefix . $child . '");');
116
-            if (   $prefix !== ''
116
+            if ($prefix !== ''
117 117
                 && !class_exists($child)) {
118 118
                 $this->add_line('class_alias( "' . $prefix . $parent . '", "' . $child . '");');
119 119
             }
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
                     $objects[$name] = 'new midgard_datetime("0001-01-01 00:00:00")';
178 178
                     break;
179 179
             }
180
-            if (   $default !== null
180
+            if ($default !== null
181 181
                    // we need to skip working links because in this case, Doctrine expects objects as values
182
-                && (   !$property->link
182
+                && (!$property->link
183 183
                     || $this->manager->resolve_targetclass($property) === false)) {
184 184
                 $line .= ' = ' . $default;
185 185
             }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
     {
224 224
         $this->add_line('class ' . $type->name . ' extends ' . $type->extends);
225 225
         $mixins = $type->get_mixins();
226
-        $interfaces = array_filter(array_map(function ($name) {
226
+        $interfaces = array_filter(array_map(function($name) {
227 227
             if (interface_exists('\\midgard\\portable\\storage\\' . $name . '\\entity')) {
228 228
                 return '\\midgard\\portable\\storage\\' . $name . '\\entity';
229 229
             }
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(array('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.
src/api/dbobject.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $this->initialize();
65 65
         $properties = array_merge($this->cm->getFieldNames(), $this->cm->getAssociationNames(), array_keys($this->cm->midgard['field_aliases']));
66
-        $properties = array_filter($properties, function ($input) {
66
+        $properties = array_filter($properties, function($input) {
67 67
             return (strpos($input, 'metadata_') === false);
68 68
         });
69 69
         $ret = array();
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $this->initialize();
80 80
 
81
-        if (   !$this->cm->hasField($field)
81
+        if (!$this->cm->hasField($field)
82 82
             && array_key_exists($field, $this->cm->midgard['field_aliases'])) {
83 83
             $field = $this->cm->midgard['field_aliases'][$field];
84 84
         }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             if (empty($value)) {
89 89
                 $value = null;
90 90
             } else {
91
-                if (   !is_object($this->$field)
91
+                if (!is_object($this->$field)
92 92
                     || $this->$field->id != $value) {
93 93
                     $this->changed_associations[$field] = true;
94 94
                 }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         } elseif ($this->cm->hasField($field)) {
99 99
             $mapping = $this->cm->getFieldMapping($field);
100 100
 
101
-            if (   $mapping['type'] === 'string'
101
+            if ($mapping['type'] === 'string'
102 102
                 || $mapping['type'] == 'text') {
103 103
                 $value = (string) $value;
104 104
             } elseif ($mapping['type'] === 'integer') {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             } elseif ($mapping['type'] === 'float') {
109 109
                 $value = (float) $value;
110 110
             } elseif ($mapping['type'] === 'midgard_datetime') {
111
-                if (   is_string($value)
111
+                if (is_string($value)
112 112
                     && $value !== '0000-00-00 00:00:00') {
113 113
                     $value = new midgard_datetime($value);
114 114
                 } elseif (!($value instanceof midgard_datetime)) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $this->initialize();
126 126
 
127
-        if (   !$this->cm->hasField($field)
127
+        if (!$this->cm->hasField($field)
128 128
             && array_key_exists($field, $this->cm->midgard['field_aliases'])) {
129 129
             $field = $this->cm->midgard['field_aliases'][$field];
130 130
         }
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
             }
138 138
             return 0;
139 139
         }
140
-        if (   $this->$field === null
140
+        if ($this->$field === null
141 141
             && $this->cm->isIdentifier($field)) {
142 142
             return 0;
143 143
         }
144
-        if (   $this->$field instanceof midgard_datetime
144
+        if ($this->$field instanceof midgard_datetime
145 145
             && $this->$field->format('U') == -62169984000) {
146 146
             //This is mainly needed for working with converted Legacy databases. Midgard2 somehow handles this internally
147 147
             //@todo Find a nicer solution and research how QB handles this
Please login to merge, or discard this patch.
src/api/object.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     public function __get($field)
79 79
     {
80
-        if (   $field === 'metadata'
80
+        if ($field === 'metadata'
81 81
             && property_exists($this, 'metadata')
82 82
             && $this->metadata === null) {
83 83
             $this->metadata = new metadata($this);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         foreach ($candidates as $candidate) {
100 100
             if ($this->$candidate !== null) {
101 101
                 //Proxies become stale if the object itself is detached, so we have to re-fetch
102
-                if (   $this->$candidate instanceof \Doctrine\ORM\Proxy\Proxy
102
+                if ($this->$candidate instanceof \Doctrine\ORM\Proxy\Proxy
103 103
                     && $this->$candidate->__isInitialized()) {
104 104
                     try {
105 105
                         $this->$candidate->get_by_id($this->$candidate->id);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
         // According to Doctrine documentation, proxies should be transparent, but in practice,
125 125
         // there will be problems if we don't force-load
126
-        if (   $entity instanceof \Doctrine\ORM\Proxy\Proxy
126
+        if ($entity instanceof \Doctrine\ORM\Proxy\Proxy
127 127
             && !$entity->__isInitialized()) {
128 128
             try {
129 129
                 $entity->__load();
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             exception::duplicate();
170 170
             return false;
171 171
         }
172
-        if (   !$this->is_unique()
172
+        if (!$this->is_unique()
173 173
             || !$this->check_parent()) {
174 174
             return false;
175 175
         }
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
             midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE);
221 221
             return false;
222 222
         }
223
-        if (   $check_dependencies
223
+        if ($check_dependencies
224 224
             && $this->has_dependents()) {
225 225
             exception::has_dependants();
226 226
             return false;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $this->initialize();
304 304
 
305
-        if (   empty($this->cm->midgard['parentfield'])
305
+        if (empty($this->cm->midgard['parentfield'])
306 306
             || empty($this->cm->midgard['parent'])) {
307 307
             return true;
308 308
         }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $this->initialize();
320 320
 
321 321
         foreach ($this->cm->fieldMappings as $name => $field) {
322
-            if (   $field['midgard:midgard_type'] == translator::TYPE_GUID
322
+            if ($field['midgard:midgard_type'] == translator::TYPE_GUID
323 323
                 && !empty($this->$name)
324 324
                 && !mgd_is_guid($this->$name)) {
325 325
                 exception::invalid_property_value("'" . $name . "' property's value is not a guid.");
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             $stat = ($results > 0);
356 356
         }
357 357
 
358
-        if (   !$stat
358
+        if (!$stat
359 359
             && !empty($this->cm->midgard['childtypes'])) {
360 360
             foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) {
361 361
                 $qb = connection::get_em()->createQueryBuilder();
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
             exception::not_exists();
685 685
             return false;
686 686
         }
687
-        if (   $check_dependencies
687
+        if ($check_dependencies
688 688
             && $this->has_dependents()) {
689 689
             exception::has_dependants();
690 690
             return false;
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 = array(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/query.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
             $value = (array) $value;
97 97
             $value = array_merge($value, $this->get_child_ids($mapping['targetEntity'], $parentfield, $value));
98
-        } elseif (   $operator === 'IN'
98
+        } elseif ($operator === 'IN'
99 99
                  || $operator === 'NOT IN') {
100 100
             $value = array_values($value);
101 101
         } elseif (!in_array($operator, array('=', '>', '<', '<>', '<=', '>=', 'LIKE', 'NOT LIKE'))) {
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
             $parts = explode('.', $name);
255 255
             $column = array_pop($parts);
256 256
             foreach ($parts as $part) {
257
-                if (   $part === 'parameter'
257
+                if ($part === 'parameter'
258 258
                     || $part === 'attachment') {
259 259
                     $targetclass = 'midgard_' . $part;
260 260
                     $current_table = $this->add_collection_join($current_table, $targetclass);
261 261
                 } else {
262 262
                     $mrp = new \midgard_reflection_property($targetclass);
263 263
 
264
-                    if (   !$mrp->is_link($part)
264
+                    if (!$mrp->is_link($part)
265 265
                         && !$mrp->is_special_link($part)) {
266 266
                         throw exception::ok();
267 267
                     }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             $column = $cm->midgard['field_aliases'][$column];
279 279
         }
280 280
 
281
-        if (   !$cm->hasField($column)
281
+        if (!$cm->hasField($column)
282 282
             && !$cm->hasAssociation($column)) {
283 283
             throw exception::ok();
284 284
         }
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
         $parsed = $this->parse_constraint_name($name);
296 296
         $expression = $operator . ' ?' . $this->parameters;
297 297
 
298
-        if (   $operator === 'IN'
298
+        if ($operator === 'IN'
299 299
             || $operator === 'NOT IN') {
300 300
             $expression = $operator . '( ?' . $this->parameters . ')';
301 301
         }
302 302
 
303
-        if (   $value === 0
303
+        if ($value === 0
304 304
             || $value === null
305 305
             || is_array($value)) {
306 306
             $cm = connection::get_em()->getClassMetadata($parsed['targetclass']);
Please login to merge, or discard this patch.
src/storage/subscriber.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         if (!($entity instanceof repligard)) {
98 98
             $repligard_entry = $em->getRepository('midgard:midgard_repligard')->findOneBy(array('guid' => $entity->guid));
99 99
 
100
-            if (   $entity instanceof entity
100
+            if ($entity instanceof entity
101 101
                 && $entity->metadata->deleted) {
102 102
                 $repligard_entry->object_action = self::ACTION_DELETE;
103 103
             } else {
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
         foreach ($columns as $name => &$config) {
140 140
             if ($platform->getName() === 'sqlite') {
141
-                if (   !empty($config['primary'])
141
+                if (!empty($config['primary'])
142 142
                     && !empty($config['autoincrement'])) {
143 143
                     /*
144 144
                      * This is essentially a workaround for http://www.doctrine-project.org/jira/browse/DBAL-642
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                     $modified = true;
148 148
                     $config['columnDefinition'] = 'INTEGER PRIMARY KEY AUTOINCREMENT';
149 149
                 }
150
-                if (   !empty($config['comment'])
150
+                if (!empty($config['comment'])
151 151
                     && $config['comment'] == 'BINARY') {
152 152
                     $modified = true;
153 153
                     $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args)
256 256
     {
257 257
         $table = $args->getClassTable();
258
-        if (   !$table->hasOption('engine')
258
+        if (!$table->hasOption('engine')
259 259
             || $table->getOption('engine') !== 'MyISAM') {
260 260
             return;
261 261
         }
Please login to merge, or discard this patch.
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.