Completed
Push — master ( fd5422...29a652 )
by Andreas
18:38
created
lib/midcom/helper/nav/node.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 
35 35
     public function is_readable_by($user_id) : bool
36 36
     {
37
-        return (   !$user_id
37
+        return (!$user_id
38 38
                 || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, midcom_db_topic::class, $user_id));
39 39
     }
40 40
 
Please login to merge, or discard this patch.
lib/midcom/helper/nav/leaf.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function is_readable_by($user_id) : bool
30 30
     {
31
-        return (   empty($this->object)
31
+        return (empty($this->object)
32 32
                 || !$this->guid
33 33
                 || !$user_id
34 34
                 || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, $this->object->__midcom_class_name__, $user_id));
Please login to merge, or discard this patch.
lib/midcom/helper/metadata.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         if (in_array($key, $this->field_config['timebased'])) {
295 295
             // This is ugly, but seems the only possible way...
296
-            if (   isset($this->__metadata->$key)
296
+            if (isset($this->__metadata->$key)
297 297
                 && (string) $this->__metadata->$key !== "0001-01-01T00:00:00+00:00") {
298 298
                 return (int) $this->__metadata->$key->format('U');
299 299
             }
@@ -358,11 +358,11 @@  discard block
 block discarded – undo
358 358
         }
359 359
 
360 360
         $now = time();
361
-        if (   $this->get('schedulestart')
361
+        if ($this->get('schedulestart')
362 362
             && $this->get('schedulestart') > $now) {
363 363
             return false;
364 364
         }
365
-        if (   $this->get('scheduleend')
365
+        if ($this->get('scheduleend')
366 366
             && $this->get('scheduleend') < $now) {
367 367
             return false;
368 368
         }
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
     public function is_object_visible_onsite()
381 381
     {
382 382
         return
383
-        (   (   midcom::get()->config->get('show_hidden_objects')
383
+        ((midcom::get()->config->get('show_hidden_objects')
384 384
              || $this->is_visible())
385
-         && (   midcom::get()->config->get('show_unapproved_objects')
385
+         && (midcom::get()->config->get('show_unapproved_objects')
386 386
              || $this->is_approved())
387 387
         );
388 388
     }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
             $guid = $source;
471 471
         }
472 472
 
473
-        if (   $object === null
473
+        if ($object === null
474 474
             && mgd_is_guid($guid)) {
475 475
             try {
476 476
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
         }
506 506
 
507 507
         // Lock was created by the user, return "not locked"
508
-        if (   !empty(midcom::get()->auth->user->guid)
508
+        if (!empty(midcom::get()->auth->user->guid)
509 509
             && $this->get('locker') === midcom::get()->auth->user->guid) {
510 510
             return false;
511 511
         }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     {
524 524
         midcom::get()->auth->require_do('midgard:update', $this->__object);
525 525
 
526
-        if (   is_object($this->__object)
526
+        if (is_object($this->__object)
527 527
             && $this->__object->lock()) {
528 528
             $this->_cache = [];
529 529
             return true;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      */
541 541
     public function can_unlock() : bool
542 542
     {
543
-        return (   $this->__object->can_do('midcom:unlock')
543
+        return ($this->__object->can_do('midcom:unlock')
544 544
                 || midcom::get()->auth->can_user_do('midcom:unlock', null, midcom_services_auth::class));
545 545
     }
546 546
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
      */
552 552
     public function unlock() : bool
553 553
     {
554
-        if (   $this->can_unlock()
554
+        if ($this->can_unlock()
555 555
             && is_object($this->__object)
556 556
             && $this->__object->unlock()) {
557 557
             $this->_cache = [];
Please login to merge, or discard this patch.
lib/midcom/helper/toolbar.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -366,11 +366,11 @@  discard block
 block discarded – undo
366 366
 
367 367
         $item = array_replace($defaults, $item);
368 368
 
369
-        if (   !empty($item[MIDCOM_TOOLBAR_ACCESSKEY])
369
+        if (!empty($item[MIDCOM_TOOLBAR_ACCESSKEY])
370 370
             && !array_key_exists($item[MIDCOM_TOOLBAR_ACCESSKEY], $used_access_keys)) {
371 371
             // We have valid access key, add it to help text
372 372
             $prefix = 'Alt-';
373
-            if (   isset($_SERVER['HTTP_USER_AGENT'])
373
+            if (isset($_SERVER['HTTP_USER_AGENT'])
374 374
                 && strstr($_SERVER['HTTP_USER_AGENT'], 'Macintosh')) {
375 375
                 // Mac users
376 376
                 $prefix = 'Ctrl-Alt-';
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     private function set_url(array &$item, $url)
393 393
     {
394 394
         $item[MIDCOM_TOOLBAR__ORIGINAL_URL] = $url;
395
-        if (   (   empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"])
395
+        if ((empty($item[MIDCOM_TOOLBAR_OPTIONS]["rel"])
396 396
                 // Some items may want to keep their links unmutilated
397 397
                 || $item[MIDCOM_TOOLBAR_OPTIONS]["rel"] != "directlink")
398 398
             && substr($url, 0, 1) != '/'
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
         if ($index == 0) {
419 419
             array_shift($this->items);
420
-        } elseif ($index == count($this->items) -1) {
420
+        } elseif ($index == count($this->items) - 1) {
421 421
             array_pop($this->items);
422 422
         } else {
423 423
             $this->items = array_merge(array_slice($this->items, 0, $index - 1),
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
      */
548 548
     public function render() : string
549 549
     {
550
-        $visible_items = array_filter($this->items, function ($item) {
550
+        $visible_items = array_filter($this->items, function($item) {
551 551
             return !$item[MIDCOM_TOOLBAR_HIDDEN];
552 552
         });
553 553
         $this->rendered = true;
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
             // Try finding uppercase version of the accesskey first
614 614
             $accesskey = strtoupper($item[MIDCOM_TOOLBAR_ACCESSKEY]);
615 615
             $position = strpos($label, $accesskey);
616
-            if (   $position === false
616
+            if ($position === false
617 617
                 && midcom::get()->i18n->get_current_language() == 'en') {
618 618
                 // Try lowercase, too
619 619
                 $accesskey = strtolower($accesskey);
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
             $attributes['title'] = $item[MIDCOM_TOOLBAR_HELPTEXT];
678 678
         }
679 679
 
680
-        if (   $item[MIDCOM_TOOLBAR_ENABLED]
680
+        if ($item[MIDCOM_TOOLBAR_ENABLED]
681 681
             && $item[MIDCOM_TOOLBAR_ACCESSKEY] !== null) {
682 682
             $attributes['class'] = 'accesskey';
683 683
             $attributes['accesskey'] = $item[MIDCOM_TOOLBAR_ACCESSKEY];
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
     public function get_index_from_url($url)
747 747
     {
748 748
         foreach ($this->items as $i => $item) {
749
-            if (   $item[MIDCOM_TOOLBAR_URL] == $url
749
+            if ($item[MIDCOM_TOOLBAR_URL] == $url
750 750
                 || $item[MIDCOM_TOOLBAR__ORIGINAL_URL] == $url) {
751 751
                 return $i;
752 752
             }
Please login to merge, or discard this patch.
lib/midcom/helper/configuration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     private function _update_cache()
145 145
     {
146 146
         $this->_merged = $this->_global;
147
-        if (   !empty($this->_local)
147
+        if (!empty($this->_local)
148 148
             && is_array($this->_local)) {
149 149
             $this->_merged = array_merge($this->_merged, $this->_local);
150 150
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function store(array $params, $reset = true)
187 187
     {
188
-        if (   !$this->_object_stored
188
+        if (!$this->_object_stored
189 189
             && $this->_object) {
190 190
             $this->_store_from_object();
191 191
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      */
270 270
     public function get_all()
271 271
     {
272
-        if (   !$this->_object_stored
272
+        if (!$this->_object_stored
273 273
             && $this->_object) {
274 274
             $this->_store_from_object();
275 275
         }
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function exists($key) : bool
287 287
     {
288
-        if (   !$this->_object_stored
288
+        if (!$this->_object_stored
289 289
             && $this->_object) {
290 290
             $this->_store_from_object();
291 291
         }
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/nameresolver.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
         if ($name_property === null) {
37 37
             $name_property = midcom_helper_reflector::get_name_property($this->_object);
38 38
         }
39
-        if (    empty($name_property)
39
+        if (empty($name_property)
40 40
             || !midcom_helper_reflector::get($this->_object)->property_exists($name_property)) {
41 41
             // Could not resolve valid property
42 42
             return false;
43 43
         }
44 44
         // Make copy via typecast, very important or we might accidentally manipulate the given object
45
-        return (string)$this->_object->{$name_property};
45
+        return (string) $this->_object->{$name_property};
46 46
     }
47 47
 
48 48
     /**
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function name_is_unique_or_empty() : bool
129 129
     {
130 130
         $name_copy = $this->get_object_name();
131
-        if (   empty($name_copy)
131
+        if (empty($name_copy)
132 132
             && $name_copy !== false) {
133 133
             // Allow empty string name
134 134
             return true;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 
209 209
             $qb->add_constraint($child_name_property, '=', $name_copy);
210 210
             if ($qb->count()) {
211
-                debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" );
211
+                debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')");
212 212
                 return false;
213 213
             }
214 214
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
             $qb->add_constraint($child_name_property, '=', $name_copy);
241 241
             if ($qb->count()) {
242
-                debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')" );
242
+                debug_add("Name clash in sibling class {$schema_type} for " . get_class($this->_object) . " #{$this->_object->id} (path '" . midcom_helper_reflector_tree::resolve_path($this->_object, '/') . "')");
243 243
                 return false;
244 244
             }
245 245
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         $name_prop = midcom_helper_reflector::get_name_property($this->_object);
273 273
 
274 274
         if (!empty($original_name)) {
275
-            $current_name = (string)$original_name;
275
+            $current_name = (string) $original_name;
276 276
         } else {
277 277
             // Empty name, try to generate from title
278 278
             $title_copy = midcom_helper_reflector::get_object_title($this->_object, $title_property);
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         } while (!$this->name_is_unique());
317 317
 
318 318
         // Get a copy of the current, usable name
319
-        $ret = (string)$this->_object->{$name_prop};
319
+        $ret = (string) $this->_object->{$name_prop};
320 320
         // Restore the original name
321 321
         $this->_object->{$name_prop} = $original_name;
322 322
         return $ret;
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/tree.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     private static function _check_permissions($deleted) : bool
151 151
     {
152 152
         // PONDER: Check for some generic user privilege instead  ??
153
-        if (   $deleted
153
+        if ($deleted
154 154
             && !midcom_connection::is_admin()
155 155
             && !midcom::get()->auth->is_component_sudo()) {
156 156
             debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                     'target' => $ref->get_link_target($field)
235 235
                 ];
236 236
                 $linked_class = $ref->get_link_name($field);
237
-                if (   empty($linked_class)
237
+                if (empty($linked_class)
238 238
                     && $info['type'] === MGD_TYPE_GUID) {
239 239
                     // Guid link without class specification, valid for all classes
240 240
                     if (empty($info['target'])) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             $field_type = $field_data['type'];
285 285
             $field = $field_data['name'];
286 286
 
287
-            if (   !$field_target
287
+            if (!$field_target
288 288
                 || !isset($for_object->$field_target)) {
289 289
                 // Why return false ???
290 290
                 return false;
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
             $parent_property = midgard_object_class::get_property_parent($schema_type);
401 401
             $up_property = midgard_object_class::get_property_up($schema_type);
402 402
 
403
-            if (   !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
403
+            if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
404 404
                 && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) {
405 405
                 continue;
406 406
             }
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
         $ref = new midgard_reflection_property($prospect_type);
426 426
         $link_class = $ref->get_link_name($property);
427
-        if (   empty($link_class)
427
+        if (empty($link_class)
428 428
             && $ref->get_midgard_type($property) === MGD_TYPE_GUID) {
429 429
             return true;
430 430
         }
Please login to merge, or discard this patch.