Test Failed
Branch master (8d1702)
by Andreas
11:03
created
lib/midcom/helper/_dbfactory.php 1 patch
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.
lib/midcom/helper/reflector/tree.php 1 patch
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.
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/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.
lib/midcom/baseclasses/components/handler/crud.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         return;
133 133
         $indexer = midcom::get()->indexer;
134
-        $topic =& $this->_content_topic;
134
+        $topic = & $this->_content_topic;
135 135
 
136 136
         $nav = new midcom_helper_nav();
137 137
         $node = $nav->get_node($topic->id);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     {
228 228
         $prefix = $this->_get_url_prefix();
229 229
         $buttons = array();
230
-        if (   $this->_mode !== 'update'
230
+        if ($this->_mode !== 'update'
231 231
             && $this->_object->can_do('midgard:update')) {
232 232
             $workflow = $this->get_workflow('datamanager2');
233 233
             $buttons[] = $workflow->get_button($prefix . "edit/{$this->_object->guid}/", array(
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             ));
236 236
         }
237 237
 
238
-        if (   $this->_mode !== 'delete'
238
+        if ($this->_mode !== 'delete'
239 239
             && $this->_object->can_do('midgard:delete')) {
240 240
             $workflow = $this->get_workflow('delete', array('object' => $this->_object));
241 241
             $buttons[] = $workflow->get_button($prefix . "delete/{$this->_object->guid}/");
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public function _on_initialize()
263 263
     {
264
-        $this->_content_topic =& $this->_request_data['content_topic'];
264
+        $this->_content_topic = & $this->_request_data['content_topic'];
265 265
     }
266 266
 
267 267
     /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function _load_schemadb()
273 273
     {
274
-        $this->_schemadb =& $this->_request_data['schemadb'];
274
+        $this->_schemadb = & $this->_request_data['schemadb'];
275 275
     }
276 276
 
277 277
     /**
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
     public function _load_controller($type = 'simple')
323 323
     {
324 324
         $this->_controller = midcom_helper_datamanager2_controller::create($type);
325
-        $this->_controller->schemadb =& $this->_schemadb;
325
+        $this->_controller->schemadb = & $this->_schemadb;
326 326
 
327 327
         if ($type == 'create') {
328 328
             // Creation controller, give additional parameters
329 329
             $this->_controller->schemaname = $this->_schema;
330 330
             $this->_controller->defaults = $this->_defaults;
331
-            $this->_controller->callback_object =& $this;
331
+            $this->_controller->callback_object = & $this;
332 332
         } else {
333 333
             if (!$this->_object) {
334 334
                 throw new midcom_error_notfound("No object defined for DM2.");
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             // AJAX editing is possible
427 427
             $this->_load_controller('ajax');
428 428
             $this->_controller->process_ajax();
429
-            $this->_datamanager =& $this->_controller->datamanager;
429
+            $this->_datamanager = & $this->_controller->datamanager;
430 430
         } else {
431 431
             $this->_load_datamanager();
432 432
         }
Please login to merge, or discard this patch.
lib/midcom/baseclasses/components/handler/dataexport.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function _prepare_request_data()
50 50
     {
51
-        $this->_request_data['datamanagers'] =& $this->_datamanagers;
52
-        $this->_request_data['rows'] =& $this->_rows;
51
+        $this->_request_data['datamanagers'] = & $this->_datamanagers;
52
+        $this->_request_data['rows'] = & $this->_rows;
53 53
     }
54 54
 
55 55
     /**
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 
133 133
         foreach ($this->_datamanagers as $type => $datamanager) {
134 134
             foreach ($datamanager->schema->field_order as $name) {
135
-                $title =& $datamanager->schema->fields[$name]['title'];
136
-                $fieldtype =& $datamanager->schema->fields[$name]['type'];
137
-                if (   $this->include_totals
135
+                $title = & $datamanager->schema->fields[$name]['title'];
136
+                $fieldtype = & $datamanager->schema->fields[$name]['type'];
137
+                if ($this->include_totals
138 138
                     && $fieldtype == 'number') {
139 139
                     $this->_totals[$type . '-' . $name] = 0;
140 140
                 }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $row = array();
154 154
             foreach ($this->_datamanagers as $type => $datamanager) {
155 155
                 foreach ($datamanager->schema->field_order as $name) {
156
-                    $fieldtype =& $datamanager->schema->fields[$name]['type'];
156
+                    $fieldtype = & $datamanager->schema->fields[$name]['type'];
157 157
                     $value = "";
158 158
                     if ($fieldtype == 'number') {
159 159
                         $value = $this->_totals[$type . '-' . $name];
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
                     $output = array_pad($output, $target_size, '');
182 182
                     continue;
183 183
                 }
184
-                $object =& $row[$type];
184
+                $object = & $row[$type];
185 185
 
186 186
                 if (!$datamanager->set_storage($object)) {
187 187
                     // Major error, panic
188
-                    throw new midcom_error( "Could not set_storage for row #{$num} ({$type} {$object->guid})");
188
+                    throw new midcom_error("Could not set_storage for row #{$num} ({$type} {$object->guid})");
189 189
                 }
190 190
 
191
-                if (   $this->include_guid
191
+                if ($this->include_guid
192 192
                     && $type == $first_type) {
193 193
                     $output[] = $object->guid;
194 194
                 }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                 foreach ($datamanager->schema->field_order as $fieldname) {
197 197
                     $fieldtype = $datamanager->schema->fields[$fieldname]['type'];
198 198
                     $data = $datamanager->types[$fieldname]->convert_to_csv();
199
-                    if (   $this->include_totals
199
+                    if ($this->include_totals
200 200
                         && $fieldtype == 'number') {
201 201
                         $this->_totals[$type . '-' . $fieldname] += $data;
202 202
                     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         if (empty($this->csv['charset'])) {
232 232
             // Default to ISO-LATIN-15 (Latin-1 with EURO sign etc)
233 233
             $this->csv['charset'] = 'ISO-8859-15';
234
-            if (   isset($_SERVER['HTTP_USER_AGENT'])
234
+            if (isset($_SERVER['HTTP_USER_AGENT'])
235 235
                 && !preg_match('/Windows/i', $_SERVER['HTTP_USER_AGENT'])) {
236 236
                 // Excep when not on windows, then default to UTF-8
237 237
                 $this->csv['charset'] = 'UTF-8';
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
         }
260 260
 
261 261
         // Strings and numbers beginning with zero are quoted
262
-        if (   !empty($data)
263
-            && (   !is_numeric($data)
262
+        if (!empty($data)
263
+            && (!is_numeric($data)
264 264
                 || preg_match('/^[0+]/', $data))) {
265 265
             // Make sure we have only newlines in data
266 266
             $data = preg_replace("/\n\r|\r\n|\r/", "\n", $data);
Please login to merge, or discard this patch.
lib/midcom/baseclasses/components/handler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,12 +100,12 @@
 block discarded – undo
100 100
     {
101 101
         $this->_master = $master;
102 102
 
103
-        $this->_request_data =& $master->_request_data;
103
+        $this->_request_data = & $master->_request_data;
104 104
         $this->_topic = $master->_topic;
105 105
 
106 106
         // Load component specific stuff, special treatment if the handler has
107 107
         // a component different than the master handler set.
108
-        if (   $this->_component
108
+        if ($this->_component
109 109
             && $this->_component != $master->_component) {
110 110
             $this->_config->store_from_object($this->_topic, $this->_component, true);
111 111
         } else {
Please login to merge, or discard this patch.