Passed
Branch master (056094)
by Andreas
04:07
created
src/api/blob.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -31,6 +31,9 @@
 block discarded – undo
31 31
         return null;
32 32
     }
33 33
 
34
+    /**
35
+     * @param string $content
36
+     */
34 37
     public function write_content($content)
35 38
     {
36 39
         return file_put_contents($this->get_path(), $content) !== false;
Please login to merge, or discard this patch.
src/storage/connection.php 2 patches
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.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
     /**
125 125
      * Toggle autostart
126
+     * @param boolean $autostart
126 127
      */
127 128
     public static function set_autostart($autostart)
128 129
     {
@@ -156,6 +157,9 @@  discard block
 block discarded – undo
156 157
         }
157 158
     }
158 159
 
160
+    /**
161
+     * @param string $name
162
+     */
159 163
     public static function get_parameter($name)
160 164
     {
161 165
         if (!array_key_exists($name, self::$parameters)) {
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.
api/midgard/storage.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -56,6 +56,9 @@  discard block
 block discarded – undo
56 56
         return true;
57 57
     }
58 58
 
59
+    /**
60
+     * @param string $classname
61
+     */
59 62
     public static function create_class_storage($classname)
60 63
     {
61 64
         $em = connection::get_em();
@@ -87,6 +90,11 @@  discard block
 block discarded – undo
87 90
         $generator->generateProxyClass($cm, $filename);
88 91
     }
89 92
 
93
+    /**
94
+     * @param Doctrine\ORM\EntityManager $em
95
+     *
96
+     * @return ClassMetadata
97
+     */
90 98
     private static function get_cm($em, $classname)
91 99
     {
92 100
         if (!class_exists($classname)) {
Please login to merge, or discard this patch.
api/midgard/connection.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@
 block discarded – undo
29 29
 
30 30
     private $replication_enabled = true;
31 31
 
32
+    /**
33
+     * @return integer
34
+     */
32 35
     public static function get_instance()
33 36
     {
34 37
         if (self::$instance === null) {
Please login to merge, or discard this patch.
api/midgard/object/class.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -96,6 +96,9 @@
 block discarded – undo
96 96
         return true;
97 97
     }
98 98
 
99
+    /**
100
+     * @param string $guid
101
+     */
99 102
     public static function get_object_by_guid($guid)
100 103
     {
101 104
         if (!mgd_is_guid($guid)) {
Please login to merge, or discard this patch.
api/midgard/replicator.php 2 patches
Doc Comments   +11 added lines, -2 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
     }
241 241
 
242 242
     /**
243
-     * @return boolean Indicating success
243
+     * @return boolean|null Indicating success
244 244
      */
245 245
     public static function import_from_xml($xml, $force = false)
246 246
     {
@@ -264,6 +264,9 @@  discard block
 block discarded – undo
264 264
         $blob->write_content($blob->content);
265 265
     }
266 266
 
267
+    /**
268
+     * @return string|null
269
+     */
267 270
     private static function resolve_link_id(ClassMetadata $cm, dbobject $object, $name)
268 271
     {
269 272
         if ($object->$name == 0) {
@@ -339,7 +342,7 @@  discard block
 block discarded – undo
339 342
      *
340 343
      * @param SimpleXMLElement $node
341 344
      * @param boolean $force
342
-     * @return dbobject
345
+     * @return blob
343 346
      */
344 347
     private static function blob_from_xml(SimpleXMLElement $node, $force)
345 348
     {
@@ -350,6 +353,9 @@  discard block
 block discarded – undo
350 353
         return $blob;
351 354
     }
352 355
 
356
+    /**
357
+     * @param string $guid
358
+     */
353 359
     private static function get_object_action($guid)
354 360
     {
355 361
         $result = connection::get_em()
@@ -376,6 +382,9 @@  discard block
 block discarded – undo
376 382
         }
377 383
     }
378 384
 
385
+    /**
386
+     * @return string|null
387
+     */
379 388
     private static function convert_value($value)
380 389
     {
381 390
         if ($value instanceof midgard_datetime) {
Please login to merge, or discard this 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/config.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -30,6 +30,9 @@  discard block
 block discarded – undo
30 30
     public $cachedir = '/var/cache/midgard2';
31 31
     public $gdathreads = false;
32 32
 
33
+    /**
34
+     * @param string $path
35
+     */
33 36
     public function read_file_at_path($path)
34 37
     {
35 38
         if (   !file_exists($path)
@@ -122,6 +125,9 @@  discard block
 block discarded – undo
122 125
         return true;
123 126
     }
124 127
 
128
+    /**
129
+     * @param string $key
130
+     */
125 131
     private function convert_to_storage($key, $value)
126 132
     {
127 133
         if (is_bool($value)) {
Please login to merge, or discard this 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/query.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -205,6 +205,9 @@  discard block
 block discarded – undo
205 205
         }
206 206
     }
207 207
 
208
+    /**
209
+     * @param string $targetclass
210
+     */
208 211
     protected function add_collection_join($current_table, $targetclass)
209 212
     {
210 213
         if (!array_key_exists($targetclass, $this->join_tables)) {
@@ -215,6 +218,9 @@  discard block
 block discarded – undo
215 218
         return $this->join_tables[$targetclass];
216 219
     }
217 220
 
221
+    /**
222
+     * @param \midgard_reflection_property $mrp
223
+     */
218 224
     protected function add_join($current_table, $mrp, $property)
219 225
     {
220 226
         $targetclass = $mrp->get_link_name($property);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
             $value = (array) $value;
105 105
             $value = array_merge($value, $this->get_child_ids($mapping['targetEntity'], $parentfield, $value));
106
-        } elseif (   $operator === 'IN'
106
+        } elseif ($operator === 'IN'
107 107
                  || $operator === 'NOT IN') {
108 108
             $value = array_values($value);
109 109
         } elseif (!in_array($operator, ['=', '>', '<', '<>', '<=', '>=', 'LIKE', 'NOT LIKE'])) {
@@ -257,14 +257,14 @@  discard block
 block discarded – undo
257 257
             $parts = explode('.', $name);
258 258
             $column = array_pop($parts);
259 259
             foreach ($parts as $part) {
260
-                if (   $part === 'parameter'
260
+                if ($part === 'parameter'
261 261
                     || $part === 'attachment') {
262 262
                     $targetclass = 'midgard_' . $part;
263 263
                     $current_table = $this->add_collection_join($current_table, $targetclass);
264 264
                 } else {
265 265
                     $mrp = new \midgard_reflection_property($targetclass);
266 266
 
267
-                    if (   !$mrp->is_link($part)
267
+                    if (!$mrp->is_link($part)
268 268
                         && !$mrp->is_special_link($part)) {
269 269
                         throw exception::ok();
270 270
                     }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             $column = $cm->midgard['field_aliases'][$column];
282 282
         }
283 283
 
284
-        if (   !$cm->hasField($column)
284
+        if (!$cm->hasField($column)
285 285
             && !$cm->hasAssociation($column)) {
286 286
             throw exception::ok();
287 287
         }
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
         $parsed = $this->parse_constraint_name($name);
299 299
         $expression = $operator . ' ?' . $this->parameters;
300 300
 
301
-        if (   $operator === 'IN'
301
+        if ($operator === 'IN'
302 302
             || $operator === 'NOT IN') {
303 303
             $expression = $operator . '( ?' . $this->parameters . ')';
304 304
         }
305 305
 
306
-        if (   $value === 0
306
+        if ($value === 0
307 307
             || $value === null
308 308
             || is_array($value)) {
309 309
             $cm = connection::get_em()->getClassMetadata($parsed['targetclass']);
Please login to merge, or discard this patch.