Passed
Push — master ( 684bcb...2808dd )
by Sebastian
09:28
created
src/URLInfo/Highlighter.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             'fragment'
78 78
         );
79 79
         
80
-        foreach($parts as $part) 
80
+        foreach ($parts as $part) 
81 81
         {
82 82
             $method = 'render_'.$part;
83 83
             $result[] = (string)$this->$method();
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     
89 89
     protected function render_scheme() : string
90 90
     {
91
-        if(!$this->info->hasScheme()) {
91
+        if (!$this->info->hasScheme()) {
92 92
             return '';
93 93
         }
94 94
         
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     
104 104
     protected function render_username() : string
105 105
     {
106
-        if(!$this->info->hasUsername()) {
106
+        if (!$this->info->hasUsername()) {
107 107
             return '';
108 108
         }
109 109
         
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     
120 120
     protected function render_host() : string
121 121
     {
122
-        if(!$this->info->hasHost()) {
122
+        if (!$this->info->hasHost()) {
123 123
             return '';
124 124
         }
125 125
         
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     
132 132
     protected function render_port() : string
133 133
     {
134
-        if(!$this->info->hasPort()) {
134
+        if (!$this->info->hasPort()) {
135 135
             return '';
136 136
         }
137 137
         
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
        
145 145
     protected function render_path() : string
146 146
     {
147
-        if(!$this->info->hasPath()) {
147
+        if (!$this->info->hasPath()) {
148 148
             return '';
149 149
         }
150 150
         
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     {
170 170
         $previous = $this->info->isParamExclusionEnabled();
171 171
         
172
-        if($previous)
172
+        if ($previous)
173 173
         {
174 174
             $this->info->setParamExclusion(false);
175 175
         }
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
     {
186 186
         $params = $this->resolveParams();
187 187
         
188
-        if(empty($params)) {
188
+        if (empty($params)) {
189 189
             return '';
190 190
         }
191 191
         
192 192
         $tokens = array();
193 193
         $excluded = array();
194 194
         
195
-        if($this->info->isParamExclusionEnabled())
195
+        if ($this->info->isParamExclusionEnabled())
196 196
         {
197 197
             $excluded = $this->info->getExcludedParams();
198 198
         }
199 199
         
200
-        foreach($params as $param => $value)
200
+        foreach ($params as $param => $value)
201 201
         {
202 202
             // If the parameter is numeric, it will automatically
203 203
             // be an integer, so we need the conversion here.
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             
219 219
             $tag = $this->resolveTag($excluded, $param);
220 220
             
221
-            if(!empty($tag))
221
+            if (!empty($tag))
222 222
             {
223 223
                 $tokens[] = sprintf($tag, $parts);
224 224
             }
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
     protected function resolveTag(array $excluded, string $paramName) : string
233 233
     {
234 234
         // regular, non-excluded parameter
235
-        if(!isset($excluded[$paramName]))
235
+        if (!isset($excluded[$paramName]))
236 236
         {
237 237
             return '<span class="link-param">%s</span>';
238 238
         }
239 239
 
240 240
         // highlight excluded parameters is disabled, ignore this parameter
241
-        if(!$this->info->isHighlightExcludeEnabled())
241
+        if (!$this->info->isHighlightExcludeEnabled())
242 242
         {
243 243
             return '';
244 244
         }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      
255 255
     protected function render_fragment() : string
256 256
     {
257
-        if(!$this->info->hasFragment()) {
257
+        if (!$this->info->hasFragment()) {
258 258
             return '';
259 259
         }
260 260
         
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     {
270 270
         $cssFolder = realpath(__DIR__.'/../../css');
271 271
         
272
-        if($cssFolder === false) {
272
+        if ($cssFolder === false) {
273 273
             throw new BaseException(
274 274
                 'Cannot find package CSS folder.',
275 275
                 null,
Please login to merge, or discard this patch.
src/VariableInfo.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
     * @param mixed $value
57 57
     * @param array|null $serialized
58 58
     */
59
-    public function __construct($value, $serialized=null)
59
+    public function __construct($value, $serialized = null)
60 60
     {
61
-        if(is_array($serialized))
61
+        if (is_array($serialized))
62 62
         {
63 63
             $this->parseSerialized($serialized);
64 64
         }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     */
105 105
     protected function parseSerialized(array $serialized) : void
106 106
     {
107
-        if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
107
+        if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
108 108
         {
109 109
             throw new BaseException(
110 110
                 'Invalid variable info serialized data.',
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
         
127 127
         // Gettype will return a string like "Resource(closed)" when
128 128
         // working with a resource that has already been closed.
129
-        if(strstr($this->type, 'resource'))
129
+        if (strstr($this->type, 'resource'))
130 130
         {
131 131
             $this->type = self::TYPE_RESOURCE;
132 132
         }
133 133
         
134
-        if(is_array($value) && is_callable($value)) {
134
+        if (is_array($value) && is_callable($value)) {
135 135
             $this->type = self::TYPE_CALLABLE;
136 136
         }
137 137
         
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     * @param bool $enable
170 170
     * @return VariableInfo
171 171
     */
172
-    public function enableType(bool $enable=true) : VariableInfo
172
+    public function enableType(bool $enable = true) : VariableInfo
173 173
     {
174 174
         return $this->setOption('prepend-type', $enable);
175 175
     }
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $converted = $this->string;
180 180
         
181
-        if($this->getOption('prepend-type') === true && !$this->isNull())
181
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
182 182
         {
183
-            if($this->isString())
183
+            if ($this->isString())
184 184
             {
185 185
                 $converted = '"'.$converted.'"';
186 186
             }
Please login to merge, or discard this patch.
src/CSVHelper.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     
171 171
     public function isHeadersPosition($position)
172 172
     {
173
-        if($this->headersPosition === $position) {
173
+        if ($this->headersPosition === $position) {
174 174
             return true;
175 175
         }
176 176
         
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             self::HEADERS_TOP
198 198
         );
199 199
         
200
-        if(!in_array($position, $validPositions)) {
200
+        if (!in_array($position, $validPositions)) {
201 201
             throw new CSVHelper_Exception(
202 202
                 'Invalid headers position',
203 203
                 sprintf(
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     */
254 254
     public function getRow($index)
255 255
     {
256
-        if(isset($this->data[$index])) {
256
+        if (isset($this->data[$index])) {
257 257
             return $this->data[$index];
258 258
         }
259 259
         
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
     public function getColumn($index)
321 321
     {
322 322
         $data = array();
323
-        for($i=0; $i < $this->rowCount; $i++) {
323
+        for ($i = 0; $i < $this->rowCount; $i++) {
324 324
             $value = '';
325
-            if(isset($this->data[$i][$index])) {
325
+            if (isset($this->data[$i][$index])) {
326 326
                 $value = $this->data[$i][$index];
327 327
             }
328 328
             
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     */
340 340
     public function columnExists($index)
341 341
     {
342
-        if($index < $this->columnCount) {
342
+        if ($index < $this->columnCount) {
343 343
             return true;
344 344
         }
345 345
         
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     {
351 351
         $this->reset();
352 352
         
353
-        if(empty(trim($this->csv))) {
353
+        if (empty(trim($this->csv))) {
354 354
             $this->addError('Tried to parse an empty CSV string.');
355 355
             return;
356 356
         }
@@ -362,14 +362,14 @@  discard block
 block discarded – undo
362 362
         
363 363
         $parser = self::createParser();
364 364
 
365
-        if(!$parser->parse($this->csv)) {
365
+        if (!$parser->parse($this->csv)) {
366 366
             $this->addError('The CSV string could not be parsed.');
367 367
             return;
368 368
         }
369 369
 
370 370
         $result = $parser->data;
371 371
 
372
-        switch($this->headersPosition)
372
+        switch ($this->headersPosition)
373 373
         {
374 374
             case self::HEADERS_TOP:
375 375
                 $this->headers = array_shift($result);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             case self::HEADERS_LEFT:
379 379
                 $keep = array();
380 380
                 $total = count($result);
381
-                for($i=0; $i < $total; $i++) {
381
+                for ($i = 0; $i < $total; $i++) {
382 382
                     $row = $result[$i];
383 383
                     $this->headers[] = array_shift($row);
384 384
                     $keep[] = $row;
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
         $this->data = $result;
392 392
         $this->rowCount = count($this->data);
393 393
         
394
-        for($i=0; $i < $this->rowCount; $i++) {
394
+        for ($i = 0; $i < $this->rowCount; $i++) {
395 395
             $amount = count($this->data[$i]);
396
-            if($amount > $this->columnCount) {
396
+            if ($amount > $this->columnCount) {
397 397
                 $this->columnCount = $amount;
398 398
             }
399 399
         }
@@ -437,8 +437,8 @@  discard block
 block discarded – undo
437 437
             ',,' => ','
438 438
         );
439 439
         
440
-        foreach($search as $char => $separator) {
441
-            if(strstr($this->csv, $char)) {
440
+        foreach ($search as $char => $separator) {
441
+            if (strstr($this->csv, $char)) {
442 442
                 return $separator;
443 443
             }
444 444
         }
@@ -452,11 +452,11 @@  discard block
 block discarded – undo
452 452
      * @param string $delimiter
453 453
      * @return Csv
454 454
      */
455
-    public static function createParser(string $delimiter=self::DELIMITER_AUTO) : Csv
455
+    public static function createParser(string $delimiter = self::DELIMITER_AUTO) : Csv
456 456
     {
457 457
         $csv = new Csv();
458 458
 
459
-        if($delimiter !== self::DELIMITER_AUTO) {
459
+        if ($delimiter !== self::DELIMITER_AUTO) {
460 460
             $csv->delimiter = $delimiter;
461 461
         }
462 462
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
         $parser = self::createParser();
483 483
         $result = $parser->parse($path);
484 484
 
485
-        if($result === true) {
485
+        if ($result === true) {
486 486
             return $parser->data;
487 487
         }
488 488
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
         $parser = self::createParser();
513 513
         $result = $parser->parse($string);
514 514
 
515
-        if($result === true) {
515
+        if ($result === true) {
516 516
             return $parser->data;
517 517
         }
518 518
 
Please login to merge, or discard this patch.
localization/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     $autoload = $root.'/vendor/autoload.php';
16 16
     
17 17
     // we need the autoloader to be present
18
-    if($autoload === false) 
18
+    if ($autoload === false) 
19 19
     {
20 20
         die('<b>ERROR:</b> Autoloader not present. Run composer update first.');
21 21
     }
Please login to merge, or discard this patch.
src/URLInfo/Filter.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
         // In the case of tel URLs, we convert the syntax to use double
31 31
         // slashes to make them parsable.
32
-        if(strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) {
32
+        if (strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) {
33 33
             $url = str_replace('tel:', 'tel://', $url);
34 34
         }
35 35
 
Please login to merge, or discard this patch.
src/ConvertHelper/Array.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public static function removeKeys(array &$sourceArray, array $keys) : void
17 17
     {
18
-        foreach($keys as $key)
18
+        foreach ($keys as $key)
19 19
         {
20
-            if(array_key_exists($key, $sourceArray)) {
20
+            if (array_key_exists($key, $sourceArray)) {
21 21
                 unset($sourceArray[$key]);
22 22
             }
23 23
         }
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
      * @param bool $keepKeys Whether to maintain index association
31 31
      * @return array
32 32
      */
33
-    public static function removeValues(array $sourceArray, array $values, bool $keepKeys=false) : array
33
+    public static function removeValues(array $sourceArray, array $values, bool $keepKeys = false) : array
34 34
     {
35 35
         $result = array();
36 36
         $values = array_values($values);
37 37
 
38
-        foreach($sourceArray as $key => $value)
38
+        foreach ($sourceArray as $key => $value)
39 39
         {
40
-            if(in_array($value, $values, true)) {
40
+            if (in_array($value, $values, true)) {
41 41
                 continue;
42 42
             }
43 43
 
44
-            if($keepKeys) {
44
+            if ($keepKeys) {
45 45
                 $result[$key] = $value;
46 46
                 continue;
47 47
             }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public static function toStyleString(array $subject) : string
75 75
     {
76 76
         $tokens = array();
77
-        foreach($subject as $name => $value) {
77
+        foreach ($subject as $name => $value) {
78 78
             $tokens[] = $name.':'.strval($value);
79 79
         }
80 80
 
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
     public static function toAttributeString(array $array) : string
104 104
     {
105 105
         $tokens = array();
106
-        foreach($array as $attr => $value)
106
+        foreach ($array as $attr => $value)
107 107
         {
108 108
             $value = strval($value);
109 109
 
110
-            if($value === '') {
110
+            if ($value === '') {
111 111
                 continue;
112 112
             }
113 113
 
114 114
             $tokens[] = $attr.'="'.htmlspecialchars($value, ENT_QUOTES, 'UTF-8').'"';
115 115
         }
116 116
 
117
-        if(empty($tokens)) {
117
+        if (empty($tokens)) {
118 118
             return '';
119 119
         }
120 120
 
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
      */
136 136
     public static function implodeWithAnd(array $list, string $sep = ', ', string $conjunction = '') : string
137 137
     {
138
-        if(empty($list)) {
138
+        if (empty($list)) {
139 139
             return '';
140 140
         }
141 141
 
142
-        if(empty($conjunction)) {
142
+        if (empty($conjunction)) {
143 143
             $conjunction = ' '.t('and').' ';
144 144
         }
145 145
 
146 146
         $last = array_pop($list);
147
-        if($list) {
148
-            return implode($sep, $list) . $conjunction . $last;
147
+        if ($list) {
148
+            return implode($sep, $list).$conjunction.$last;
149 149
         }
150 150
 
151 151
         return $last;
Please login to merge, or discard this patch.
src/ConvertHelper/Bool.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function fromString($string) : bool
31 31
     {
32
-        if($string === '' || $string === null || !is_scalar($string))
32
+        if ($string === '' || $string === null || !is_scalar($string))
33 33
         {
34 34
             return false;
35 35
         }
36 36
 
37
-        if(is_bool($string))
37
+        if (is_bool($string))
38 38
         {
39 39
             return $string;
40 40
         }
41 41
 
42
-        if(array_key_exists($string, self::$booleanStrings))
42
+        if (array_key_exists($string, self::$booleanStrings))
43 43
         {
44 44
             return self::$booleanStrings[$string];
45 45
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     public static function toString($boolean, bool $yesno = false) : string
68 68
     {
69 69
         // allow 'yes', 'true', 'no', 'false' string notations as well
70
-        if(!is_bool($boolean)) {
70
+        if (!is_bool($boolean)) {
71 71
             $boolean = self::fromString($boolean);
72 72
         }
73 73
 
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public static function isBoolean($value) : bool
99 99
     {
100
-        if(is_bool($value)) {
100
+        if (is_bool($value)) {
101 101
             return true;
102 102
         }
103 103
 
104
-        if(!is_scalar($value)) {
104
+        if (!is_scalar($value)) {
105 105
             return false;
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/ConvertHelper.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param int $tabSize The amount of spaces per tab.
50 50
      * @return string
51 51
      */
52
-    public static function tabs2spaces(string $string, int $tabSize=4) : string
52
+    public static function tabs2spaces(string $string, int $tabSize = 4) : string
53 53
     {
54 54
         return ConvertHelper_String::tabs2spaces($string, $tabSize);
55 55
     }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     * @param int $tabSize The amount of spaces per tab in the source string.
62 62
     * @return string
63 63
     */
64
-    public static function spaces2tabs(string $string, int $tabSize=4) : string
64
+    public static function spaces2tabs(string $string, int $tabSize = 4) : string
65 65
     {
66 66
         return ConvertHelper_String::spaces2tabs($string, $tabSize);
67 67
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     {
109 109
          $converter = new ConvertHelper_DurationConverter();
110 110
          
111
-         if($datefrom instanceof DateTime)
111
+         if ($datefrom instanceof DateTime)
112 112
          {
113 113
              $converter->setDateFrom($datefrom);
114 114
          }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
              $converter->setDateFrom(self::timestamp2date($datefrom)); 
118 118
          }
119 119
 
120
-         if($dateto instanceof DateTime)
120
+         if ($dateto instanceof DateTime)
121 121
          {
122 122
              $converter->setDateTo($dateto);
123 123
          }
124
-         else if($dateto > 0)
124
+         else if ($dateto > 0)
125 125
          {
126 126
              $converter->setDateTo(self::timestamp2date($dateto));
127 127
          }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     * @deprecated Use the Highlighter class directly instead.
152 152
     * @see Highlighter::xml()
153 153
     */
154
-    public static function highlight_xml(string $xml, bool $formatSource=false) : string
154
+    public static function highlight_xml(string $xml, bool $formatSource = false) : string
155 155
     {
156 156
         return Highlighter::xml($xml, $formatSource);
157 157
     }
@@ -210,11 +210,11 @@  discard block
 block discarded – undo
210 210
         return ConvertHelper_String::cutText($text, $targetLength, $append);
211 211
     }
212 212
 
213
-    public static function var_dump($var, $html=true) : string
213
+    public static function var_dump($var, $html = true) : string
214 214
     {
215 215
         $info = parseVariable($var);
216 216
         
217
-        if($html) {
217
+        if ($html) {
218 218
             return $info->toHTML();
219 219
         }
220 220
         
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
     * @param bool $html Whether to style the dump as HTML.
230 230
     * @return string
231 231
     */
232
-    public static function print_r($var, bool $return=false, bool $html=true) : string
232
+    public static function print_r($var, bool $return = false, bool $html = true) : string
233 233
     {
234 234
         $result = parseVariable($var)->enableType()->toString();
235 235
         
236
-        if($html) 
236
+        if ($html) 
237 237
         {
238 238
             $result = 
239 239
             '<pre style="background:#fff;color:#333;padding:16px;border:solid 1px #bbb;border-radius:4px">'.
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
             '</pre>';
242 242
         }
243 243
         
244
-        if(!$return) 
244
+        if (!$return) 
245 245
         {
246 246
             echo $result;
247 247
         }
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
     public static function date2listLabel(DateTime $date, $includeTime = false, $shortMonth = false)
304 304
     {
305 305
         $today = new DateTime();
306
-        if($date->format('d.m.Y') == $today->format('d.m.Y')) {
306
+        if ($date->format('d.m.Y') == $today->format('d.m.Y')) {
307 307
             $label = t('Today');
308 308
         } else {
309
-            $label = $date->format('d') . '. ' . self::month2string((int)$date->format('m'), $shortMonth) . ' ';
309
+            $label = $date->format('d').'. '.self::month2string((int)$date->format('m'), $shortMonth).' ';
310 310
             if ($date->format('Y') != date('Y')) {
311 311
                 $label .= $date->format('Y');
312 312
             }
@@ -461,12 +461,12 @@  discard block
 block discarded – undo
461 461
         $output = '';
462 462
         $split = str_split($unicodeChar);
463 463
         
464
-        foreach($split as $octet) 
464
+        foreach ($split as $octet) 
465 465
         {
466 466
             $ordInt = ord($octet);
467 467
             // Convert from int (base 10) to hex (base 16), for PHP \x syntax
468 468
             $ordHex = base_convert((string)$ordInt, 10, 16);
469
-            $output .= '\x' . $ordHex;
469
+            $output .= '\x'.$ordHex;
470 470
         }
471 471
         
472 472
         return $output;
@@ -499,19 +499,19 @@  discard block
 block discarded – undo
499 499
     
500 500
     protected static function convertScalarForComparison($scalar)
501 501
     {
502
-        if($scalar === '' || is_null($scalar)) {
502
+        if ($scalar === '' || is_null($scalar)) {
503 503
             return null;
504 504
         }
505 505
         
506
-        if(is_bool($scalar)) {
506
+        if (is_bool($scalar)) {
507 507
             return self::bool2string($scalar);
508 508
         }
509 509
         
510
-        if(is_array($scalar)) {
510
+        if (is_array($scalar)) {
511 511
             $scalar = md5(serialize($scalar));
512 512
         }
513 513
         
514
-        if($scalar !== null && !is_scalar($scalar)) {
514
+        if ($scalar !== null && !is_scalar($scalar)) {
515 515
             throw new ConvertHelper_Exception(
516 516
                 'Not a scalar value in comparison',
517 517
                 null,
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
     * 
679 679
     * @see JSHelper::buildRegexStatement()
680 680
     */
681
-    public static function regex2js(string $regex, string $statementType=JSHelper::JS_REGEX_OBJECT)
681
+    public static function regex2js(string $regex, string $statementType = JSHelper::JS_REGEX_OBJECT)
682 682
     {
683 683
         return JSHelper::buildRegexStatement($regex, $statementType);
684 684
     }
@@ -695,11 +695,11 @@  discard block
 block discarded – undo
695 695
     * @throws ConvertHelper_Exception
696 696
     * @return string
697 697
     */
698
-    public static function var2json($variable, int $options=0, int $depth=512) : string
698
+    public static function var2json($variable, int $options = 0, int $depth = 512) : string
699 699
     {
700 700
         $result = json_encode($variable, $options, $depth);
701 701
         
702
-        if($result !== false) {
702
+        if ($result !== false) {
703 703
             return $result;
704 704
         }
705 705
         
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
     public static function stripUTFBom($string)
725 725
     {
726 726
         $boms = FileHelper::getUTFBOMs();
727
-        foreach($boms as $bomChars) {
727
+        foreach ($boms as $bomChars) {
728 728
             $length = mb_strlen($bomChars);
729 729
             $text = mb_substr($string, 0, $length);
730
-            if($text==$bomChars) {
730
+            if ($text == $bomChars) {
731 731
                 return mb_substr($string, $length);
732 732
             }
733 733
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
     * @param array $options
795 795
     * @return float
796 796
     */
797
-    public static function matchString($source, $target, $options=array())
797
+    public static function matchString($source, $target, $options = array())
798 798
     {
799 799
         $defaults = array(
800 800
             'maxLevenshtein' => 10,
@@ -804,12 +804,12 @@  discard block
 block discarded – undo
804 804
         $options = array_merge($defaults, $options);
805 805
         
806 806
         // avoid doing this via levenshtein
807
-        if($source == $target) {
807
+        if ($source == $target) {
808 808
             return 100;
809 809
         }
810 810
         
811 811
         $diff = levenshtein($source, $target);
812
-        if($diff > $options['maxLevenshtein']) {
812
+        if ($diff > $options['maxLevenshtein']) {
813 813
             return 0;
814 814
         }
815 815
         
@@ -893,24 +893,24 @@  discard block
 block discarded – undo
893 893
     * @see ConvertHelper::INTERVAL_HOURS
894 894
     * @see ConvertHelper::INTERVAL_DAYS
895 895
     */
896
-    public static function interval2total(\DateInterval $interval, $unit=self::INTERVAL_SECONDS) : int
896
+    public static function interval2total(\DateInterval $interval, $unit = self::INTERVAL_SECONDS) : int
897 897
     {
898 898
         $total = (int)$interval->format('%a');
899 899
         if ($unit == self::INTERVAL_DAYS) {
900 900
             return $total;
901 901
         }
902 902
         
903
-        $total = ($total * 24) + ((int)$interval->h );
903
+        $total = ($total * 24) + ((int)$interval->h);
904 904
         if ($unit == self::INTERVAL_HOURS) {
905 905
             return $total;
906 906
         }
907 907
     
908
-        $total = ($total * 60) + ((int)$interval->i );
908
+        $total = ($total * 60) + ((int)$interval->i);
909 909
         if ($unit == self::INTERVAL_MINUTES) {
910 910
             return $total;
911 911
         }
912 912
 
913
-        $total = ($total * 60) + ((int)$interval->s );
913
+        $total = ($total * 60) + ((int)$interval->s);
914 914
         if ($unit == self::INTERVAL_SECONDS) {
915 915
             return $total;
916 916
         }
@@ -939,13 +939,13 @@  discard block
 block discarded – undo
939 939
     * @param bool $short
940 940
     * @return string|NULL
941 941
     */
942
-    public static function date2dayName(DateTime $date, bool $short=false)
942
+    public static function date2dayName(DateTime $date, bool $short = false)
943 943
     {
944 944
         $day = $date->format('l');
945 945
         $invariant = self::getDayNamesInvariant();
946 946
         
947 947
         $idx = array_search($day, $invariant);
948
-        if($idx !== false) {
948
+        if ($idx !== false) {
949 949
             $localized = self::getDayNames($short);
950 950
             return $localized[$idx];
951 951
         }
@@ -968,10 +968,10 @@  discard block
 block discarded – undo
968 968
     * @param bool $short
969 969
     * @return array
970 970
     */
971
-    public static function getDayNames(bool $short=false) : array
971
+    public static function getDayNames(bool $short = false) : array
972 972
     {
973
-        if($short) {
974
-            if(!isset(self::$daysShort)) {
973
+        if ($short) {
974
+            if (!isset(self::$daysShort)) {
975 975
                 self::$daysShort = array(
976 976
                     t('Mon'),
977 977
                     t('Tue'),
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
             return self::$daysShort;
987 987
         }
988 988
         
989
-        if(!isset(self::$days)) {
989
+        if (!isset(self::$days)) {
990 990
             self::$days = array(
991 991
                 t('Monday'),
992 992
                 t('Tuesday'),
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
     * @param bool $caseInsensitive
1142 1142
     * @return ConvertHelper_StringMatch[]
1143 1143
     */
1144
-    public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
1144
+    public static function findString(string $needle, string $haystack, bool $caseInsensitive = false): array
1145 1145
     {
1146 1146
         return ConvertHelper_String::findString($needle, $haystack, $caseInsensitive);
1147 1147
     }
@@ -1191,17 +1191,17 @@  discard block
 block discarded – undo
1191 1191
     */
1192 1192
     public static function isInteger($value) : bool
1193 1193
     {
1194
-        if(is_int($value)) {
1194
+        if (is_int($value)) {
1195 1195
             return true;
1196 1196
         }
1197 1197
         
1198 1198
         // booleans get converted to numbers, so they would
1199 1199
         // actually match the regex.
1200
-        if(is_bool($value)) {
1200
+        if (is_bool($value)) {
1201 1201
             return false;
1202 1202
         }
1203 1203
         
1204
-        if(is_string($value) && $value !== '') {
1204
+        if (is_string($value) && $value !== '') {
1205 1205
             return preg_match('/\A-?\d+\z/', $value) === 1;
1206 1206
         }
1207 1207
         
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
         return new ConvertHelper_URLFinder($subject);
1260 1260
     }
1261 1261
 
1262
-    public static function arrayRemoveValues(array $sourceArray, array $values, bool $keepKeys=false) : array
1262
+    public static function arrayRemoveValues(array $sourceArray, array $values, bool $keepKeys = false) : array
1263 1263
     {
1264 1264
         return ConvertHelper_Array::removeValues($sourceArray, $values, $keepKeys);
1265 1265
     }
Please login to merge, or discard this patch.
src/FileHelper/PathsReducer.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param string[] $paths
33 33
      * @throws FileHelper_Exception
34 34
      */
35
-    public function __construct(array $paths=array())
35
+    public function __construct(array $paths = array())
36 36
     {
37 37
         $this->addPaths($paths);
38 38
     }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function addPaths(array $paths) : FileHelper_PathsReducer
48 48
     {
49
-        foreach($paths as $path) {
49
+        foreach ($paths as $path) {
50 50
             $this->addPath($path);
51 51
         }
52 52
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $path = FileHelper::normalizePath(FileHelper::requireFileExists($path));
66 66
 
67
-        if(!in_array($path, $this->paths)) {
67
+        if (!in_array($path, $this->paths)) {
68 68
             $this->paths[] = $path;
69 69
         }
70 70
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $split = $this->splitPaths();
83 83
 
84
-        if(empty($split)) {
84
+        if (empty($split)) {
85 85
             return array();
86 86
         }
87 87
 
88
-        while($this->shiftPart($split) === true) {}
88
+        while ($this->shiftPart($split) === true) {}
89 89
 
90 90
         return $this->joinPaths($split);
91 91
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $result = array();
100 100
 
101 101
         foreach ($split as $entry) {
102
-            if(!empty($entry)) {
102
+            if (!empty($entry)) {
103 103
                 $result[] = implode('/', $entry);
104 104
             }
105 105
         }
@@ -116,22 +116,22 @@  discard block
 block discarded – undo
116 116
         $current = null;
117 117
         $result = array();
118 118
 
119
-        foreach($split as $entry)
119
+        foreach ($split as $entry)
120 120
         {
121
-            if(empty($entry)) {
121
+            if (empty($entry)) {
122 122
                 return false;
123 123
             }
124 124
 
125 125
             $part = array_shift($entry);
126
-            if(empty($entry)) {
126
+            if (empty($entry)) {
127 127
                 return false;
128 128
             }
129 129
 
130
-            if($current === null) {
130
+            if ($current === null) {
131 131
                 $current = $part;
132 132
             }
133 133
 
134
-            if($part !== $current) {
134
+            if ($part !== $current) {
135 135
                 return false;
136 136
             }
137 137
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
     {
148 148
         $split = array();
149 149
 
150
-        foreach($this->paths as $path) {
150
+        foreach ($this->paths as $path) {
151 151
             $entry = ConvertHelper::explodeTrim('/', $path);
152
-            if(!empty($entry)) {
152
+            if (!empty($entry)) {
153 153
                 $split[] = $entry;
154 154
             }
155 155
         }
Please login to merge, or discard this patch.