Passed
Branch master (f83f0c)
by Andreas
17:25
created
lib/midcom/services/rcs/backend/rcs.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         }
87 87
 
88 88
         $filename = $this->_generate_rcs_filename($object->guid);
89
-        $rcsfilename =  "{$filename},v";
89
+        $rcsfilename = "{$filename},v";
90 90
 
91 91
         if (!file_exists($rcsfilename)) {
92 92
             // The methods return basically what the RCS unix level command returns, so nonzero value is error and zero is ok...
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         // , must become . to work. Therefore this:
122 122
         str_replace(',', '.', $revision);
123 123
 
124
-        $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) .  " {$filepath} 2>/dev/null");
124
+        $this->exec('co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null");
125 125
 
126 126
         $data = $this->rcs_readfile($this->_guid);
127 127
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             if ($message_array[0] != 'Object') {
263 263
                 $history['user'] = $message_array[0];
264 264
             }
265
-            $history['ip']   = $message_array[1];
265
+            $history['ip'] = $message_array[1];
266 266
             $history['message'] = $message_array[2];
267 267
         }
268 268
         return $history;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
                 $i += 3;
296 296
 
297
-                while (   $i < $total
297
+                while ($i < $total
298 298
                        && substr($lines[$i], 0, 4) != '----'
299 299
                        && substr($lines[$i], 0, 5) != '=====') {
300 300
                     $i++;
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      */
333 333
     private function rcs_writefile($guid, $data)
334 334
     {
335
-        if (   !is_writable($this->_config->get_rcs_root())
335
+        if (!is_writable($this->_config->get_rcs_root())
336 336
             || empty($guid)) {
337 337
             return false;
338 338
         }
Please login to merge, or discard this patch.
lib/midcom/services/i18n/main.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         $rawdata = base64_decode($_COOKIE['midcom_services_i18n']);
130 130
         $array = unserialize($rawdata);
131 131
 
132
-        if (   !array_key_exists('language', $array)
132
+        if (!array_key_exists('language', $array)
133 133
             || !array_key_exists('charset', $array)) {
134 134
             debug_add("Rejecting cookie, it seems invalid.");
135 135
             return;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $lang = substr($lang, 0, 2);
159 159
                 $q = $this->_get_q($params);
160 160
 
161
-                if (   !isset($http_langs[$lang])
161
+                if (!isset($http_langs[$lang])
162 162
                     || $http_langs[$lang] < $q) {
163 163
                     $http_langs[$lang] = $q;
164 164
                 }
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     private function iconv($source_charset, $destination_charset, $string)
422 422
     {
423 423
         $result = @iconv($source_charset, $destination_charset, $string);
424
-        if (   $result === false
424
+        if ($result === false
425 425
             && strlen($string) > 0) {
426 426
             debug_add("Iconv returned failed to convert a string, returning an empty string.", MIDCOM_LOG_WARN);
427 427
             debug_print_r("Tried to convert this string from {$source_charset} to {$destination_charset}:", $string);
Please login to merge, or discard this patch.
lib/midcom/services/rcs/handler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $this->object = midcom::get()->dbfactory->get_object_by_guid($guid);
48 48
 
49
-        if (   !midcom::get()->config->get('midcom_services_rcs_enable')
49
+        if (!midcom::get()->config->get('midcom_services_rcs_enable')
50 50
             || !$this->object->_use_rcs) {
51 51
             throw new midcom_error_notfound("Revision control not supported for " . get_class($this->object) . ".");
52 52
         }
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
     public function _handler_history($handler_id, array $args, array &$data)
184 184
     {
185 185
         // Check if the comparison request is valid
186
-        if (    !empty($_GET['first']) && !empty($_GET['last'])
187
-            && $_GET['first']  !== $_GET['last']) {
186
+        if (!empty($_GET['first']) && !empty($_GET['last'])
187
+            && $_GET['first'] !== $_GET['last']) {
188 188
             return new midcom_response_relocate($this->url_prefix . "diff/{$args[0]}/{$_GET['first']}/{$_GET['last']}/");
189 189
         }
190 190
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     {
219 219
         $this->load_object($args[0]);
220 220
 
221
-        if (   !$this->backend->version_exists($args[1])
221
+        if (!$this->backend->version_exists($args[1])
222 222
             || !$this->backend->version_exists($args[2])) {
223 223
             throw new midcom_error_notfound("One of the revisions {$args[1]} or {$args[2]} does not exist.");
224 224
         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $this->object->require_do('midgard:update');
293 293
         // TODO: set another privilege for restoring?
294 294
 
295
-        if (   $this->backend->version_exists($args[1])
295
+        if ($this->backend->version_exists($args[1])
296 296
             && $this->backend->restore_to_revision($args[1])) {
297 297
             midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.rcs'), sprintf($this->_l10n->get('restore to version %s successful'), $args[1]));
298 298
             return new midcom_response_relocate($this->get_object_url());
Please login to merge, or discard this patch.
lib/org/openpsa/projects/task/resource.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
     private function find_duplicates()
27 27
     {
28 28
         $qb = org_openpsa_projects_task_resource_dba::new_query_builder();
29
-        $qb->add_constraint('person', '=', (int)$this->person);
30
-        $qb->add_constraint('task', '=', (int)$this->task);
31
-        $qb->add_constraint('orgOpenpsaObtype', '=', (int)$this->orgOpenpsaObtype);
29
+        $qb->add_constraint('person', '=', (int) $this->person);
30
+        $qb->add_constraint('task', '=', (int) $this->task);
31
+        $qb->add_constraint('orgOpenpsaObtype', '=', (int) $this->orgOpenpsaObtype);
32 32
 
33 33
         if ($this->id) {
34
-            $qb->add_constraint('id', '<>', (int)$this->id);
34
+            $qb->add_constraint('id', '<>', (int) $this->id);
35 35
         }
36 36
 
37 37
         return ($qb->count() > 0);
Please login to merge, or discard this patch.
lib/midcom/core/query.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
     protected function _add_visibility_checks()
130 130
     {
131
-        if (   $this->hide_invisible
131
+        if ($this->hide_invisible
132 132
             && !$this->_visibility_checks_added) {
133 133
             if (!midcom::get()->config->get('show_hidden_objects')) {
134 134
                 $this->add_constraint('metadata.hidden', '=', false);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         // Deal with empty arrays, which would produce invalid queries
195 195
         // This is done here to avoid repetitive code in callers, and because
196 196
         // it's easy enough to generalize: IN empty set => always false, NOT IN empty set => always true
197
-        if (   is_array($value)
197
+        if (is_array($value)
198 198
             && empty($value)) {
199 199
             if ($operator == 'NOT IN') {
200 200
                 return true;
Please login to merge, or discard this patch.
lib/midcom/core/querybuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         $this->_add_visibility_checks();
107 107
 
108
-        if (   empty($this->_limit)
108
+        if (empty($this->_limit)
109 109
             && empty($this->_offset)) {
110 110
             // No point to do windowing
111 111
             $newresult = $this->_execute_and_check_privileges();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         }
151 151
         $this->_query->set_limit($window_size);
152 152
 
153
-        while (    ($resultset = $this->_execute_and_check_privileges())
153
+        while (($resultset = $this->_execute_and_check_privileges())
154 154
                 || $this->denied > $denied) {
155 155
             $size = count($resultset);
156 156
             $total_size = $size + ($this->denied - $denied);
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 (is_null($name_property)) {
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
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     public function name_is_unique_or_empty()
130 130
     {
131 131
         $name_copy = $this->get_object_name();
132
-        if (   empty($name_copy)
132
+        if (empty($name_copy)
133 133
             && $name_copy !== false) {
134 134
             // Allow empty string name
135 135
             return true;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
             $qb->add_constraint($child_name_property, '=', $name_copy);
212 212
             if ($qb->count()) {
213
-                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, '/') . "')" );
213
+                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, '/') . "')");
214 214
                 return false;
215 215
             }
216 216
         }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
             $qb->add_constraint($child_name_property, '=', $name_copy);
243 243
             if ($qb->count()) {
244
-                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, '/') . "')" );
244
+                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, '/') . "')");
245 245
                 return false;
246 246
             }
247 247
         }
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $name_prop = midcom_helper_reflector::get_name_property($this->_object);
275 275
 
276 276
         if (!empty($original_name)) {
277
-            $current_name = (string)$original_name;
277
+            $current_name = (string) $original_name;
278 278
         } else {
279 279
             // Empty name, try to generate from title
280 280
             $title_copy = midcom_helper_reflector::get_object_title($this->_object, $title_property);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         } while (!$this->name_is_unique());
320 320
 
321 321
         // Get a copy of the current, usable name
322
-        $ret = (string)$this->_object->{$name_prop};
322
+        $ret = (string) $this->_object->{$name_prop};
323 323
         // Restore the original name
324 324
         $this->_object->{$name_prop} = $original_name;
325 325
         return $ret;
Please login to merge, or discard this patch.
lib/midcom/helper/reflector/main.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 
432 432
         $label_prop = $this->get_label_property();
433 433
 
434
-        if (    is_string($label_prop)
434
+        if (is_string($label_prop)
435 435
              && $label_prop != 'guid'
436 436
              && $this->_mgd_reflector->property_exists($label_prop)) {
437 437
             $search_properties[$label_prop] = true;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
                 continue;
493 493
             }
494 494
 
495
-            if (   !$ref->is_link($property)
495
+            if (!$ref->is_link($property)
496 496
                 && $ref->get_midgard_type($property) != MGD_TYPE_GUID) {
497 497
                 continue;
498 498
             }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
                 return $schema_type;
557 557
             }
558 558
         }
559
-        if (   isset($extends[$schema_type])
559
+        if (isset($extends[$schema_type])
560 560
             && class_exists($extends[$schema_type])) {
561 561
             return $extends[$schema_type];
562 562
         }
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
     {
577 577
         $one = self::resolve_baseclass($class_one);
578 578
         $two = self::resolve_baseclass($class_two);
579
-        return (   $one == $two
579
+        return ($one == $two
580 580
                 || self::class_rewrite($one) == $two
581 581
                 || $one == self::class_rewrite($two));
582 582
     }
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
         // Check for decorators first
636 636
         if (!empty($class_instance->__mgdschema_class_name__)) {
637 637
             $parent_class = $class_instance->__mgdschema_class_name__;
638
-            if (   !empty($class_instance->__object)
638
+            if (!empty($class_instance->__object)
639 639
                 && !$class_instance->__object instanceof $class_instance->__mgdschema_class_name__) {
640 640
                 $parent_class = get_class($class_instance->__object);
641 641
                 debug_add('mgdschema object class ' . $parent_class . ' is not an instance of ' . $class_instance->__mgdschema_class_name__, MIDCOM_LOG_INFO);
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         $name_exceptions = $this->_config->get('name_exceptions');
671 671
         foreach ($name_exceptions as $class => $property) {
672 672
             if (midcom::get()->dbfactory->is_a($object, $class)) {
673
-                if (   $property !== false
673
+                if ($property !== false
674 674
                     && !$this->_mgd_reflector->property_exists($property)) {
675 675
                     debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR);
676 676
                     self::$_cache['name'][$key] = false;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
         if (is_null($title_property)) {
727 727
             $title_property = self::get_title_property($object);
728 728
         }
729
-        if (   empty($title_property)
729
+        if (empty($title_property)
730 730
             || !self::get($object)->property_exists($title_property)) {
731 731
             // Could not resolve valid property
732 732
             return false;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 
774 774
         foreach ($title_exceptions as $class => $property) {
775 775
             if (midcom::get()->dbfactory->is_a($object, $class)) {
776
-                if (   $property !== false
776
+                if ($property !== false
777 777
                     && !$this->_mgd_reflector->property_exists($property)) {
778 778
                     debug_add("Matched class '{$key}' to '{$class}' via is_a but property '{$property}' does not exist", MIDCOM_LOG_ERROR);
779 779
                     self::$_cache['title'][$key] = false;
Please login to merge, or discard this patch.
lib/midcom/services/i18n/formatter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
     public function number($value, $precision = 2)
31 31
     {
32
-        if (   is_float($value)
32
+        if (is_float($value)
33 33
             && version_compare(Intl::getIcuVersion(), '49', '<')) {
34 34
             // workaround for http://bugs.icu-project.org/trac/ticket/8561
35 35
             if ($precision == 0) {
Please login to merge, or discard this patch.