Test Failed
Branch master (8d1702)
by Andreas
11:03
created
lib/midcom/helper/toolbar/node.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,8 @@
 block discarded – undo
88 88
                         $style = midcom_db_style::get_cached($style_id);
89 89
                         $styleeditor_url = midcom_connection::get_url('self') . "__mfa/asgard/object/view/{$style->guid}/";
90 90
                         $enabled = true;
91
-                    } catch (midcom_error $e) {
91
+                    }
92
+                    catch (midcom_error $e) {
92 93
                         $e->log();
93 94
                     }
94 95
                 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         }
38 38
         $buttons = array();
39 39
         $workflow = new midcom\workflow\datamanager2;
40
-        if (   $this->topic->can_do('midgard:update')
40
+        if ($this->topic->can_do('midgard:update')
41 41
             && $this->topic->can_do('midcom.admin.folder:topic_management')) {
42 42
             $buttons[] = $workflow->get_button("__ais/folder/edit/", array(
43 43
                 MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('edit folder', 'midcom.admin.folder'),
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             ));
50 50
         }
51 51
 
52
-        if (   $urltopic->can_do('midgard:update')
52
+        if ($urltopic->can_do('midgard:update')
53 53
             && $urltopic->can_do('midcom.admin.folder:topic_management')) {
54 54
             // Allow to move other than root folder
55 55
             if ($urltopic->guid !== midcom::get()->config->get('midcom_root_topic_guid')) {
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             }
62 62
         }
63 63
 
64
-        if (   $this->topic->can_do('midgard:update')
64
+        if ($this->topic->can_do('midgard:update')
65 65
             && $this->topic->can_do('midcom.admin.folder:topic_management')) {
66 66
             $buttons[] = array(
67 67
                 MIDCOM_TOOLBAR_URL => "__ais/folder/order/",
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             );
79 79
         }
80 80
         $buttons = array_merge($buttons, $this->get_approval_controls($this->topic, false));
81
-        if (   $this->topic->can_do('midcom.admin.folder:template_management')
81
+        if ($this->topic->can_do('midcom.admin.folder:template_management')
82 82
             && midcom::get()->auth->can_user_do('midgard.admin.asgard:manage_objects', null, 'midgard_admin_asgard_plugin')) {
83 83
             $enabled = false;
84 84
             $styleeditor_url = '';
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             );
104 104
         }
105 105
 
106
-        if (   $this->topic->can_do('midgard:create')
106
+        if ($this->topic->can_do('midgard:create')
107 107
             && $this->topic->can_do('midcom.admin.folder:topic_management')) {
108 108
             $buttons[] = $workflow->get_button("__ais/folder/create/", array(
109 109
                 MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('create subfolder', 'midcom.admin.folder'),
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
                 MIDCOM_TOOLBAR_ACCESSKEY => 'f',
112 112
             ));
113 113
         }
114
-        if (   $urltopic->guid !== midcom::get()->config->get('midcom_root_topic_guid')
114
+        if ($urltopic->guid !== midcom::get()->config->get('midcom_root_topic_guid')
115 115
             && $urltopic->can_do('midgard:delete')
116 116
             && $urltopic->can_do('midcom.admin.folder:topic_management')) {
117 117
             $workflow = new midcom\workflow\delete(array('object' => $urltopic, 'recursive' => true));
Please login to merge, or discard this patch.
lib/midcom/helper/toolbar/view.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             ));
54 54
         }
55 55
 
56
-        if (   midcom::get()->config->get('midcom_services_rcs_enable')
56
+        if (midcom::get()->config->get('midcom_services_rcs_enable')
57 57
             && $object->can_do('midgard:update')
58 58
             && $object->_use_rcs) {
59 59
             $buttons[] = array(
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             }
84 84
 
85 85
             $icon = 'stock-icons/16x16/page-' . $icontype . '.png';
86
-            if (   !midcom::get()->config->get('show_hidden_objects')
86
+            if (!midcom::get()->config->get('show_hidden_objects')
87 87
                 && !$object->metadata->is_visible()) {
88 88
                 // Take scheduling into account
89 89
                 $icon = 'stock-icons/16x16/page-' . $icontype . '-notpublished.png';
Please login to merge, or discard this patch.
lib/midcom/helper/_dbfactory.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
             throw new midcom_error_midgard($e, $guid);
51 51
         }
52
-        $person_class =  midcom::get()->config->get('person_class');
53
-        if (   get_class($tmp) == 'midgard_person'
52
+        $person_class = midcom::get()->config->get('person_class');
53
+        if (get_class($tmp) == 'midgard_person'
54 54
             && $person_class != 'midgard_person') {
55 55
             $tmp = new $person_class($guid);
56 56
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         }
82 82
         $object = new $classname($src);
83 83
         $cache[$classname][$object->guid] = $object;
84
-        $cache[$classname][$object->id] =& $cache[$classname][$object->guid];
84
+        $cache[$classname][$object->id] = & $cache[$classname][$object->guid];
85 85
         return $cache[$classname][$object->guid];
86 86
     }
87 87
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             throw new midcom_error("Cannot cast the object to an MgdSchema type, it is not a MidCOM DBA object");
175 175
         }
176 176
 
177
-        if (   !isset($object->__object)
177
+        if (!isset($object->__object)
178 178
             || !is_object($object->__object)) {
179 179
             debug_print_r("Object dump:", $object);
180 180
             throw new midcom_error("Cannot cast the object to an MgdSchema type, as it doesn't contain it");
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
             return true;
199 199
         }
200 200
 
201
-        if (   isset($object->__object)
201
+        if (isset($object->__object)
202 202
             && is_object($object->__object)
203 203
             && is_a($object->__object, $class)) {
204 204
             // Decorator whose MgdSchema object matches
205 205
             return true;
206 206
         }
207 207
 
208
-        if (   isset($object->__mgdschema_class_name__)
208
+        if (isset($object->__mgdschema_class_name__)
209 209
             && $object->__mgdschema_class_name__ == $class) {
210 210
             // Decorator without object instantiated, check class match
211 211
             return true;
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         if (is_object($object)) {
228 228
             $helper = new helper;
229 229
             // We're dealing with either MgdSchema or MidCOM DBA object
230
-            if (   isset($object->__object)
230
+            if (isset($object->__object)
231 231
                 && is_object($object->__object)) {
232 232
                 // MidCOM DBA decorator
233 233
                 return $helper->property_exists($object->__object, $property);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             return $helper->property_exists($object, $property);
237 237
         }
238 238
 
239
-        if (   !is_string($object)
239
+        if (!is_string($object)
240 240
             || !class_exists($object)) {
241 241
             // TODO: Raise exception?
242 242
             debug_add("\$object is not string or class_exists() returned false", MIDCOM_LOG_WARN);
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $parent_data = $this->_get_parent_guid_cached($object->guid, $object);
262 262
 
263 263
         $parent_guid = current($parent_data);
264
-        if (   empty($parent_guid)
264
+        if (empty($parent_guid)
265 265
             || $parent_guid === $object->guid) {
266 266
             return null;
267 267
         }
@@ -464,11 +464,11 @@  discard block
 block discarded – undo
464 464
                 );
465 465
             }
466 466
 
467
-            if (   $parent_property
467
+            if ($parent_property
468 468
                 && $reflector->get_link_target($parent_property)) {
469 469
                 $target_class = $reflector->get_link_name($parent_property);
470 470
                 if ($target_class == 'midgard_person') {
471
-                    $person_class =  midcom::get()->config->get('person_class');
471
+                    $person_class = midcom::get()->config->get('person_class');
472 472
                     if ($person_class != 'midgard_person') {
473 473
                         $target_class = $person_class;
474 474
                     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,8 @@  discard block
 block discarded – undo
44 44
     {
45 45
         try {
46 46
             $tmp = midgard_object_class::get_object_by_guid($guid);
47
-        } catch (midgard_error_exception $e) {
47
+        }
48
+        catch (midgard_error_exception $e) {
48 49
             debug_add('Loading object by GUID ' . $guid . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_INFO);
49 50
 
50 51
             throw new midcom_error_midgard($e, $guid);
@@ -274,7 +275,8 @@  discard block
 block discarded – undo
274 275
                 $parent_data = array(
275 276
                     $parent->__midcom_class_name__ => $parent_guid
276 277
                 );
277
-            } catch (midcom_error $e) {
278
+            }
279
+            catch (midcom_error $e) {
278 280
                 $parent_data = array(
279 281
                     '' => null
280 282
                 );
@@ -288,7 +290,8 @@  discard block
 block discarded – undo
288 290
 
289 291
         try {
290 292
             return $this->get_cached($classname, $parent_guid);
291
-        } catch (midcom_error $e) {
293
+        }
294
+        catch (midcom_error $e) {
292 295
             return null;
293 296
         }
294 297
     }
@@ -347,7 +350,8 @@  discard block
 block discarded – undo
347 350
                 if ($the_object === null) {
348 351
                     try {
349 352
                         $the_object = $this->get_object_by_guid($object_guid);
350
-                    } catch (midcom_error $e) {
353
+                    }
354
+                    catch (midcom_error $e) {
351 355
                         return array('' => null);
352 356
                     }
353 357
                 }
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/tree.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     private static function _check_permissions($deleted)
159 159
     {
160 160
         // PONDER: Check for some generic user privilege instead  ??
161
-        if (   $deleted
161
+        if ($deleted
162 162
             && !midcom_connection::is_admin()
163 163
             && !midcom::get()->auth->is_component_sudo()) {
164 164
             debug_add('Non-admins are not allowed to list deleted objects', MIDCOM_LOG_ERROR);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                     'target' => $ref->get_link_target($field)
249 249
                 );
250 250
                 $linked_class = $ref->get_link_name($field);
251
-                if (   empty($linked_class)
251
+                if (empty($linked_class)
252 252
                     && $info['type'] === MGD_TYPE_GUID) {
253 253
                     // Guid link without class specification, valid for all classes
254 254
                     if (empty($info['target'])) {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
             $field_type = $field_data['type'];
299 299
             $field = $field_data['name'];
300 300
 
301
-            if (   !$field_target
301
+            if (!$field_target
302 302
                 || !isset($for_object->$field_target)) {
303 303
                 // Why return false ???
304 304
                 return false;
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
             $parent_property = midgard_object_class::get_property_parent($schema_type);
415 415
             $up_property = midgard_object_class::get_property_up($schema_type);
416 416
 
417
-            if (   !$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
417
+            if (!$this->_resolve_child_classes_links_back($parent_property, $schema_type, $this->mgdschema_class)
418 418
                 && !$this->_resolve_child_classes_links_back($up_property, $schema_type, $this->mgdschema_class)) {
419 419
                 continue;
420 420
             }
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
         $ref = new midgard_reflection_property($prospect_type);
441 441
         $link_class = $ref->get_link_name($property);
442
-        if (   empty($link_class)
442
+        if (empty($link_class)
443 443
             && $ref->get_midgard_type($property) === MGD_TYPE_GUID) {
444 444
             return true;
445 445
         }
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
         $ref = self::get($schema_type);
535 535
         $dummy = new $schema_type();
536 536
         $title_property = $ref->get_title_property($dummy);
537
-        if (   is_string($title_property)
537
+        if (is_string($title_property)
538 538
             && midcom::get()->dbfactory->property_exists($schema_type, $title_property)) {
539 539
             $qb->add_order($title_property);
540 540
         }
541 541
         $name_property = $ref->get_name_property($dummy);
542
-        if (   is_string($name_property)
542
+        if (is_string($name_property)
543 543
             && midcom::get()->dbfactory->property_exists($schema_type, $name_property)) {
544 544
             $qb->add_order($name_property);
545 545
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -557,7 +557,8 @@
 block discarded – undo
557 557
         $tree = array();
558 558
         try {
559 559
             $children = self::get_child_objects($parent);
560
-        } catch (midcom_error $e) {
560
+        }
561
+        catch (midcom_error $e) {
561 562
             return $tree;
562 563
         }
563 564
 
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/copy.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         }
347 347
 
348 348
         // Override requested root object properties
349
-        if (   !empty($this->target->guid)
349
+        if (!empty($this->target->guid)
350 350
             && $target->guid === $this->target->guid) {
351 351
             foreach ($this->root_object_values as $name => $value) {
352 352
                 $target->$name = $value;
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         // Store for later use - if ever needed
392 392
         $this->new_objects[] = $target;
393 393
 
394
-        if (   !$this->_copy_data('parameters', $source, $target)
394
+        if (!$this->_copy_data('parameters', $source, $target)
395 395
             || !$this->_copy_data('metadata', $source, $target)
396 396
             || !$this->_copy_data('attachments', $source, $target)
397 397
             || !$this->_copy_data('privileges', $source, $target)) {
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     private function _copy_data($type, $source, &$target)
413 413
     {
414 414
         $method = 'copy_' . $type;
415
-        if (   !$this->$method($source, $target)
415
+        if (!$this->$method($source, $target)
416 416
             && $this->halt_on_errors) {
417 417
             $this->errors[] = $this->_l10n->get('failed to copy ' . $type);
418 418
             return false;
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
     public static function copy_object_tree($source, $parent, $exclude = array(), $copy_parameters = true, $copy_metadata = true, $copy_attachments = true)
565 565
     {
566 566
         $copy = new midcom_helper_reflector_copy();
567
-        $copy->source =& $source;
568
-        $copy->target =& $parent;
567
+        $copy->source = & $source;
568
+        $copy->target = & $parent;
569 569
         $copy->copy_parameters = $copy_parameters;
570 570
         $copy->copy_metadata = $copy_metadata;
571 571
         $copy->copy_attachments = $copy_attachments;
Please login to merge, or discard this patch.
lib/midcom/helper/search/handler/search.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $node = $nap->get_node($node_id);
55 55
 
56
-        if (   !array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components'])
56
+        if (!array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components'])
57 57
             && $node[MIDCOM_NAV_COMPONENT] != 'midcom.helper.search') {
58 58
             $l10n = $this->_i18n->get_l10n($node[MIDCOM_NAV_COMPONENT]);
59 59
             $this->_request_data['components'][$node[MIDCOM_NAV_COMPONENT]] = $l10n->get($node[MIDCOM_NAV_COMPONENT]);
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $this->prepare_query_data();
113 113
         $this->prepare_formdata($_REQUEST['type']);
114 114
 
115
-        if (   count(explode(' ', $data['query'])) == 1
115
+        if (count(explode(' ', $data['query'])) == 1
116 116
             && strpos($data['query'], '*') === false
117 117
             && $this->_config->get('single_term_auto_wilcard')) {
118 118
             //If there is only one search term append * to the query if auto_wildcard is enabled
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
             $this->_request_data['last_document_number'] = $last_document_id + 1;
193 193
             $this->_request_data['shown_documents'] = $last_document_id - $first_document_id + 1;
194 194
             $this->_request_data['results_per_page'] = $results_per_page;
195
-            $this->_request_data['all_results'] =& $result;
195
+            $this->_request_data['all_results'] = & $result;
196 196
             $this->_request_data['result'] = array_slice($result, $first_document_id, $results_per_page);
197 197
 
198 198
             // Register GUIDs for cache engine
199 199
             foreach ($this->_request_data['result'] as $doc) {
200
-                if (   !isset($doc->source)
200
+                if (!isset($doc->source)
201 201
                     || !mgd_is_guid($doc->source)) {
202 202
                     // Non-Midgard results don't need to go through cache registration
203 203
                     continue;
Please login to merge, or discard this patch.
lib/midcom/baseclasses/components/configuration.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,8 @@
 block discarded – undo
143 143
 
144 144
         try {
145 145
             $data = file_get_contents($filename);
146
-        } catch (Exception $e) {
146
+        }
147
+        catch (Exception $e) {
147 148
             return false;
148 149
         }
149 150
 
Please login to merge, or discard this patch.
lib/midcom/baseclasses/components/request.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
                 $this->_request_switch[$key]['handler'] = array(&$this, $value['handler']);
434 434
             }
435 435
 
436
-            if (   !array_key_exists('expires', $value)
436
+            if (!array_key_exists('expires', $value)
437 437
                 || !is_integer($value['expires'])
438 438
                 || $value['expires'] < -1) {
439 439
                 $this->_request_switch[$key]['expires'] = -1;
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
         }
466 466
 
467 467
         // Check if we need to start up a plugin.
468
-        if (   $argc > 1
468
+        if ($argc > 1
469 469
             && array_key_exists($argv[0], self::$_plugin_namespace_config)
470 470
             && array_key_exists($argv[1], self::$_plugin_namespace_config[$argv[0]])) {
471 471
             $namespace = $argv[0];
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 continue;
482 482
             }
483 483
             $fixed_args_count = count($request['fixed_args']);
484
-            $this->_handler =& $this->_request_switch[$key];
484
+            $this->_handler = & $this->_request_switch[$key];
485 485
 
486 486
             $this->_handler['id'] = $key;
487 487
             $this->_handler['args'] = array_slice($argv, $fixed_args_count);
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
             $this->_prepare_handler();
491 491
 
492 492
             // If applicable, run the _can_handle check for the handler in question.
493
-            $handler =& $this->_handler['handler'][0];
493
+            $handler = & $this->_handler['handler'][0];
494 494
             $method = "_can_handle_{$this->_handler['handler'][1]}";
495 495
 
496
-            if (   method_exists($handler, $method)
496
+            if (method_exists($handler, $method)
497 497
                 && !$handler->$method($this->_handler['id'], $this->_handler['args'], $this->_request_data)) {
498 498
                 // This can_handle failed, allow next one to take over if there is one
499 499
                 continue;
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
         $variable_args_count = $request['variable_args'];
511 511
         $total_args_count = $fixed_args_count + $variable_args_count;
512 512
 
513
-        if (   ($argc != $total_args_count && ($variable_args_count >= 0))
513
+        if (($argc != $total_args_count && ($variable_args_count >= 0))
514 514
             || $fixed_args_count > $argc) {
515 515
             return false;
516 516
         }
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                 $success = false;
531 531
                 foreach ($request['validation'][$i] as $rule) {
532 532
                     // rule is a callable function, like mgd_is_guid or is_int
533
-                    if (   is_callable($rule)
533
+                    if (is_callable($rule)
534 534
                         && $success = call_user_func($rule, $param)) {
535 535
                         break;
536 536
                     }
Please login to merge, or discard this patch.
lib/midcom/baseclasses/components/handler/configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         midcom::get()->head->set_pagetitle($this->_l10n_midcom->get('component configuration'));
91 91
 
92 92
         $workflow = $this->get_workflow('datamanager2', array('controller' => $this->_controller));
93
-        if (   method_exists($this, '_load_datamanagers')
93
+        if (method_exists($this, '_load_datamanagers')
94 94
             && method_exists($this, '_load_objects')) {
95 95
             $workflow->add_post_button('config/recreate/', $this->_l10n_midcom->get('recreate images'), array(
96 96
                 'midcom_baseclasses_components_handler_configuration_recreateok' => true,
Please login to merge, or discard this patch.