Passed
Pull Request — master (#204)
by
unknown
23:41
created
src/midcom/datamanager/storage/mnrelation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
         $qb = midcom::get()->dbfactory->new_query_builder($this->config['type_config']['mapping_class_name']);
100 100
         $qb->add_constraint($this->config['type_config']['master_fieldname'], '=', $this->get_master_foreign_key());
101 101
 
102
-        if (   $this->config['type_config']['sortable']
102
+        if ($this->config['type_config']['sortable']
103 103
             && preg_match('/^(ASC|DESC)/i', $this->config['type_config']['sortable_sort_order'], $regs)) {
104 104
             $order = strtoupper($regs[1]);
105 105
             $qb->add_order('metadata.score', $order);
Please login to merge, or discard this patch.
lib/org/openpsa/contacts/handler/duplicates/person.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,8 @@  discard block
 block discarded – undo
66 66
             try {
67 67
                 $person1 = new org_openpsa_contacts_person_dba($param->parentguid);
68 68
                 $person2 = new org_openpsa_contacts_person_dba($param->name);
69
-            } catch (midcom_error $e) {
69
+            }
70
+            catch (midcom_error $e) {
70 71
                 $i++;
71 72
                 continue;
72 73
             }
@@ -137,7 +138,8 @@  discard block
 block discarded – undo
137 138
                 try {
138 139
                     $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config);
139 140
                     $merger->merge_delete($person1, $person2);
140
-                } catch (midcom_error $e) {
141
+                }
142
+                catch (midcom_error $e) {
141 143
                     // TODO: Localize
142 144
                     midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error');
143 145
                 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     private function load_next()
42 42
     {
43
-        $i =& $this->_request_data['loop_i'];
43
+        $i = & $this->_request_data['loop_i'];
44 44
         while ($i < 100) {
45 45
             debug_add("Loop iteration {$i}");
46 46
             $qb = new midgard_query_builder('midgard_parameter');
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 continue;
69 69
             }
70 70
             // Make sure we actually have enough rights to do this
71
-            if (   !$person1->can_do('midgard:update')
71
+            if (!$person1->can_do('midgard:update')
72 72
                 || !$person1->can_do('midgard:delete')
73 73
                 || !$person2->can_do('midgard:update')
74 74
                 || !$person2->can_do('midgard:delete')) {
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
                 continue;
78 78
             }
79 79
             // Extra sanity check (in case of semi-successful not-duplicate mark)
80
-            if (   $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid)
80
+            if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid)
81 81
                 || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) {
82 82
                 debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN);
83 83
                 $i++;
84 84
                 continue;
85 85
             }
86 86
 
87
-            $this->_request_data['probability'] = (float)$param->value;
87
+            $this->_request_data['probability'] = (float) $param->value;
88 88
             $this->_request_data['person1'] = $person1;
89 89
             $this->_request_data['person2'] = $person2;
90 90
             break;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             if ($keep == 'both') {
103 103
                 $option1->require_do('midgard:update');
104 104
                 $option2->require_do('midgard:update');
105
-                if (   $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time())
105
+                if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time())
106 106
                     && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) {
107 107
                     // Clear the possible duplicate parameters
108 108
                     $option1->delete_parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid);
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
                 }
121 121
             } else {
122 122
                 if ($keep == $option1->guid) {
123
-                    $person1 =& $option1;
124
-                    $person2 =& $option2;
123
+                    $person1 = & $option1;
124
+                    $person2 = & $option2;
125 125
                 } elseif ($keep == $option2->guid) {
126
-                    $person1 =& $option2;
127
-                    $person2 =& $option1;
126
+                    $person1 = & $option2;
127
+                    $person2 = & $option1;
128 128
                 } else {
129 129
                     throw new midcom_error('Something weird happened (basically we got bogus data)');
130 130
                 }
Please login to merge, or discard this patch.
lib/midcom/helper/imagefilter.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -380,7 +380,8 @@  discard block
 block discarded – undo
380 380
         try {
381 381
             $cmd = midcom::get()->config->get('utility_imagemagick_base') . "identify " . escapeshellarg($filename);
382 382
             $this->_run_command($cmd);
383
-        } catch (midcom_error $e) {
383
+        }
384
+        catch (midcom_error $e) {
384 385
             return false;
385 386
         }
386 387
         return true;
@@ -406,7 +407,8 @@  discard block
 block discarded – undo
406 407
                 debug_add("EXIF information missing or without orientation tag. Skipping.", MIDCOM_LOG_INFO);
407 408
                 return;
408 409
             }
409
-        } catch (Exception $e) {
410
+        }
411
+        catch (Exception $e) {
410 412
             debug_add("Could not read EXIF data: " . $e->getMessage() . ", skipping.", MIDCOM_LOG_WARN);
411 413
             return;
412 414
         }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             debug_add("The File {$filename} is not writable.", MIDCOM_LOG_ERROR);
191 191
             return false;
192 192
         }
193
-        if (   !empty($this->_filename)
193
+        if (!empty($this->_filename)
194 194
             && $this->_filename !== $filename) {
195 195
             $this->_tmpfiles[] = $this->_filename;
196 196
         }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
         $tmpfile = null;
412 412
         $imagesize = getimagesize($this->_filename);
413 413
 
414
-        if (   $imagesize[2] == IMAGETYPE_JPEG
414
+        if ($imagesize[2] == IMAGETYPE_JPEG
415 415
             && $this->_jpegtran_available()) {
416 416
             /* jpegtran */
417 417
             $operations = [
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         $imagesize = getimagesize($this->_filename);
480 480
 
481 481
         // Try lossless jpegtran rotation if possible
482
-        if (   $imagesize[2] == IMAGETYPE_JPEG
482
+        if ($imagesize[2] == IMAGETYPE_JPEG
483 483
             && ($rotate % 90 == 0)
484 484
             && $this->_jpegtran_available()) {
485 485
             $tmpfile = $this->_get_tempfile();
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      */
610 610
     public function fill($x = null, $y = null, $color = null, $gravity = 'center')
611 611
     {
612
-        if (   empty($x)
612
+        if (empty($x)
613 613
             || empty($y)
614 614
             || empty($color)) {
615 615
             //This is a bit silly, but here for backwards compatibility...
Please login to merge, or discard this patch.
lib/midcom/services/rcs/backend/rcs.php 3 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -453,7 +453,8 @@  discard block
 block discarded – undo
453 453
 
454 454
         try {
455 455
             @exec($command, $output, $status);
456
-        } catch (Exception $e) {
456
+        }
457
+        catch (Exception $e) {
457 458
             debug_add($e->getMessage());
458 459
         }
459 460
 
@@ -549,7 +550,8 @@  discard block
 block discarded – undo
549 550
 
550 551
         try {
551 552
             $object = midcom::get()->dbfactory->get_object_by_guid($this->_guid);
552
-        } catch (midcom_error $e) {
553
+        }
554
+        catch (midcom_error $e) {
553 555
             debug_add("{$this->_guid} could not be resolved to object", MIDCOM_LOG_ERROR);
554 556
             return false;
555 557
         }
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,12 +105,12 @@
 block discarded – undo
105 105
         return $status;
106 106
     }
107 107
 
108
-   /**
109
-    * Get the object of a revision
110
-    *
111
-    * @param string $revision identifier of revision wanted
112
-    * @return array array representation of the object
113
-    */
108
+    /**
109
+     * Get the object of a revision
110
+     *
111
+     * @param string $revision identifier of revision wanted
112
+     * @return array array representation of the object
113
+     */
114 114
     public function get_revision($revision) : array
115 115
     {
116 116
         if (empty($this->_guid)) {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
                 $i += 3;
279 279
 
280
-                while (   $i < $total
280
+                while ($i < $total
281 281
                        && substr($lines[$i], 0, 4) != '----'
282 282
                        && substr($lines[$i], 0, 5) != '=====') {
283 283
                     $i++;
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      */
316 316
     private function rcs_writefile(string $guid, $data)
317 317
     {
318
-        if (   !is_writable($this->_config->get_rcs_root())
318
+        if (!is_writable($this->_config->get_rcs_root())
319 319
             || empty($guid)) {
320 320
             return false;
321 321
         }
Please login to merge, or discard this patch.
lib/midcom/db/attachment.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@
 block discarded – undo
336 336
     public function update_cache()
337 337
     {
338 338
         // Check if the attachment can be read anonymously
339
-        if (   midcom::get()->config->get('attachment_cache_enabled')
339
+        if (midcom::get()->config->get('attachment_cache_enabled')
340 340
             && !$this->can_do('midgard:read', 'EVERYONE')) {
341 341
             // Not public file, ensure it is removed
342 342
             $filename = $this->get_cache_path();
Please login to merge, or discard this patch.
lib/midcom/helper/_styleloader.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,8 @@  discard block
 block discarded – undo
166 166
                     break;
167 167
                 }
168 168
             }
169
-        } catch (midcom_error $e) {
169
+        }
170
+        catch (midcom_error $e) {
170 171
         }
171 172
 
172 173
         $path_parts = array_reverse($path_parts);
@@ -410,7 +411,8 @@  discard block
 block discarded – undo
410 411
                 && $db_style = $this->get_style_id_from_path($root_topic->style)) {
411 412
                 $_style = $this->_get_element_in_styletree($db_style, $_element);
412 413
             }
413
-        } catch (midcom_error_forbidden $e) {
414
+        }
415
+        catch (midcom_error_forbidden $e) {
414 416
             $e->log();
415 417
         }
416 418
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             $element = $matches[2];
308 308
         }
309 309
 
310
-        if (   isset($stylepath)
310
+        if (isset($stylepath)
311 311
             && $styleid = $this->get_style_id_from_path($stylepath)) {
312 312
             array_unshift($this->_scope, $styleid);
313 313
         }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         // This is a bit of a hack to allow &(); tags
342 342
         $preparsed = midcom_helper_misc::preparse($style);
343 343
         if (midcom_core_context::get()->has_custom_key('request_data')) {
344
-            $data =& midcom_core_context::get()->get_custom_key('request_data');
344
+            $data = & midcom_core_context::get()->get_custom_key('request_data');
345 345
         }
346 346
 
347 347
         if (eval('?>' . $preparsed) === false) {
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         try {
377 377
             $root_topic = $context->get_key(MIDCOM_CONTEXT_ROOTTOPIC);
378
-            if (   $root_topic->style
378
+            if ($root_topic->style
379 379
                 && $db_style = $this->get_style_id_from_path($root_topic->style)) {
380 380
                 $_style = $this->_get_element_in_styletree($db_style, $_element);
381 381
             }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
             if (array_key_exists($src, $this->_styles)) {
411 411
                 return $this->_styles[$src];
412 412
             }
413
-            if (   $this->_scope[0] != ''
413
+            if ($this->_scope[0] != ''
414 414
                 && $result = $this->_get_element_in_styletree($this->_scope[0], $_element)) {
415 415
                 $this->_styles[$src] = $result;
416 416
                 return $this->_styles[$src];
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         if (array_key_exists($src, $this->_snippets)) {
429 429
             return $this->_snippets[$src];
430 430
         }
431
-        if (   midcom::get()->config->get('theme')
431
+        if (midcom::get()->config->get('theme')
432 432
             && $content = midcom_helper_misc::get_element_content($_element)) {
433 433
             $this->_snippets[$src] = $content;
434 434
             return $content;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             }
488 488
         } else {
489 489
             $style = $topic->style ?: midcom_core_context::get()->get_inherited_style();
490
-            if (   is_string($style)
490
+            if (is_string($style)
491 491
                 && substr($style, 0, 6) === 'theme:') {
492 492
                 $theme_dir = OPENPSA2_THEME_ROOT . midcom::get()->config->get('theme') . '/style';
493 493
                 $parts = explode('/', str_replace('theme:/', '', $style));
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
             $this->_styledirs_append[$context->id] = [];
667 667
         }
668 668
 
669
-        if (   $this->_topic
669
+        if ($this->_topic
670 670
             && $_st = $this->_get_component_style($this->_topic)) {
671 671
             array_unshift($this->_scope, $_st);
672 672
         }
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
      */
685 685
     public function leave_context()
686 686
     {
687
-        if (   $this->_topic
687
+        if ($this->_topic
688 688
             && $this->_get_component_style($this->_topic)) {
689 689
             array_shift($this->_scope);
690 690
         }
Please login to merge, or discard this patch.
lib/org/openpsa/documents/midcom/interfaces.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 
40 40
     public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object)
41 41
     {
42
-        if (   $object instanceof org_openpsa_documents_document_dba
42
+        if ($object instanceof org_openpsa_documents_document_dba
43 43
             && $object->topic == $topic->id) {
44 44
             return "document/{$object->guid}/";
45 45
         }
Please login to merge, or discard this patch.
lib/net/nehmer/static/midcom/interfaces.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         }
69 69
 
70 70
         $config = $this->get_config_for_topic($topic);
71
-        if (   $object->name == 'index'
71
+        if ($object->name == 'index'
72 72
             && !$config->get('autoindex')) {
73 73
             return '';
74 74
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@
 block discarded – undo
29 29
         foreach ($qb->execute() as $article) {
30 30
             try {
31 31
                 $datamanager->set_storage($article);
32
-            } catch (midcom_error $e) {
32
+            }
33
+            catch (midcom_error $e) {
33 34
                 $e->log(MIDCOM_LOG_WARN);
34 35
                 continue;
35 36
             }
Please login to merge, or discard this patch.
lib/net/nemein/tag/handler.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -384,7 +384,8 @@  discard block
 block discarded – undo
384 384
                 $value = $link->value;
385 385
 
386 386
                 $tags[$key] = $value;
387
-            } catch (midcom_error $e) {
387
+            }
388
+            catch (midcom_error $e) {
388 389
                 $e->log();
389 390
             }
390 391
         }
@@ -443,7 +444,8 @@  discard block
 block discarded – undo
443 444
             try {
444 445
                 $tag = net_nemein_tag_tag_dba::get_cached($link->tag);
445 446
                 $link_object_map[$link->fromGuid][$tag->tag] = $link;
446
-            } catch (midcom_error $e) {
447
+            }
448
+            catch (midcom_error $e) {
447 449
                 $e->log();
448 450
             }
449 451
         }
@@ -472,7 +474,8 @@  discard block
 block discarded – undo
472 474
                     $tmpobject = midcom::get()->dbfactory->convert_midgard_to_midcom($tmpobject);
473 475
                 }
474 476
                 $return[] = $tmpobject;
475
-            } catch (midcom_error $e) {
477
+            }
478
+            catch (midcom_error $e) {
476 479
                 $e->log();
477 480
             }
478 481
         }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function copy_tags($from, $to) : bool
186 186
     {
187
-        if (   !is_object($from)
187
+        if (!is_object($from)
188 188
             || !is_object($to)) {
189 189
             return false;
190 190
         }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         $strlen = strlen($tags_string);
489 489
         for ($i = 0; $i < $strlen; $i++) {
490 490
             $char = $tags_string[$i];
491
-            if (   (   $char == ' '
491
+            if (($char == ' '
492 492
                     && !$quote_open)
493 493
                 || $i == $strlen) {
494 494
                 $tags[] = $current_tag;
Please login to merge, or discard this patch.