Passed
Push — master ( e76473...8d6fb4 )
by Sebastian
09:39
created
src/ConvertHelper/TimeConverter.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     */
49 49
     private function initUnits() : void
50 50
     {
51
-        if(isset(self::$units))
51
+        if (isset(self::$units))
52 52
         {
53 53
             return;
54 54
         }
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
     public function toString() : string
91 91
     {
92 92
         // specifically handle zero
93
-        if($this->seconds <= 0) 
93
+        if ($this->seconds <= 0) 
94 94
         {
95
-            return '0 ' . t('seconds');
95
+            return '0 '.t('seconds');
96 96
         }
97 97
         
98
-        if($this->seconds < 1) 
98
+        if ($this->seconds < 1) 
99 99
         {
100 100
             return t('less than a second');
101 101
         }
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 
105 105
         $last = array_pop($tokens);
106 106
         
107
-        if(empty($tokens)) 
107
+        if (empty($tokens)) 
108 108
         {
109 109
             return $last;
110 110
         }
111 111
         
112
-        return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last;
112
+        return implode(', ', $tokens).' '.t('and').' '.$last;
113 113
     }
114 114
     
115 115
    /**
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
         $seconds = $this->seconds;
123 123
         $tokens = array();
124 124
         
125
-        foreach(self::$units as $def)
125
+        foreach (self::$units as $def)
126 126
         {
127 127
             $unitValue = intval($seconds / $def['value']);
128 128
             
129
-            if($unitValue <= 0)
129
+            if ($unitValue <= 0)
130 130
             {
131 131
                 continue;
132 132
             }
133 133
             
134
-            $item = strval($unitValue) . ' ';
134
+            $item = strval($unitValue).' ';
135 135
             
136
-            if(abs($unitValue) > 1)
136
+            if (abs($unitValue) > 1)
137 137
             {
138 138
                 $item .= $def['plural'];
139 139
             }
Please login to merge, or discard this patch.
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/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/ConvertHelper/EOL.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public static function detect(string $subjectString) : ?ConvertHelper_EOL
123 123
     {
124
-        if(empty($subjectString)) {
124
+        if (empty($subjectString)) {
125 125
             return null;
126 126
         }
127 127
 
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
         $results = array();
130 130
         $chars = self::getEOLChars();
131 131
 
132
-        foreach($chars as $def)
132
+        foreach ($chars as $def)
133 133
         {
134 134
             $amount = substr_count($subjectString, $def['char']);
135 135
 
136
-            if($amount > $max)
136
+            if ($amount > $max)
137 137
             {
138 138
                 $max = $amount;
139 139
                 $results[] = $def;
140 140
             }
141 141
         }
142 142
 
143
-        if(empty($results)) {
143
+        if (empty($results)) {
144 144
             return null;
145 145
         }
146 146
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public static function getEOLChars() : array
158 158
     {
159
-        if(isset(self::$eolChars)) {
159
+        if (isset(self::$eolChars)) {
160 160
             return self::$eolChars;
161 161
         }
162 162
 
Please login to merge, or discard this patch.
src/functions.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
  * @param bool $forceNew
13 13
  * @return NumberInfo
14 14
  */
15
-function parseNumber($value, bool $forceNew=false)
15
+function parseNumber($value, bool $forceNew = false)
16 16
 {
17
-    if($value instanceof NumberInfo && $forceNew !== true) {
17
+    if ($value instanceof NumberInfo && $forceNew !== true) {
18 18
         return $value;
19 19
     }
20 20
     
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     $args = func_get_args();
96 96
     
97 97
     // is the localization package installed?
98
-    if(function_exists('\AppLocalize\t'))
98
+    if (function_exists('\AppLocalize\t'))
99 99
     {
100 100
         return call_user_func_array('\AppLocalize\t', $args);
101 101
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
  * @param bool $initial The initial boolean value to use.
111 111
  * @return Value_Bool
112 112
  */
113
-function valBool(bool $initial=false) : Value_Bool
113
+function valBool(bool $initial = false) : Value_Bool
114 114
 {
115 115
     return new Value_Bool($initial);
116 116
 }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
  * @param bool $initial
124 124
  * @return Value_Bool_True
125 125
  */
126
-function valBoolTrue(bool $initial=false) : Value_Bool_True
126
+function valBoolTrue(bool $initial = false) : Value_Bool_True
127 127
 {
128 128
     return new Value_Bool_True($initial);
129 129
 }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  * @param bool $initial
137 137
  * @return Value_Bool_False
138 138
  */
139
-function valBoolFalse(bool $initial=true) : Value_Bool_False
139
+function valBoolFalse(bool $initial = true) : Value_Bool_False
140 140
 {
141 141
     return new Value_Bool_False($initial);
142 142
 }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
  */
168 168
 function init()
169 169
 {
170
-    if(!class_exists('\AppLocalize\Localization')) {
170
+    if (!class_exists('\AppLocalize\Localization')) {
171 171
         return;
172 172
     }
173 173
     
Please login to merge, or discard this patch.
src/URLInfo/ConnectionTester.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     * @param bool $verifySSL
49 49
     * @return URLInfo_ConnectionTester
50 50
     */
51
-    public function setVerifySSL(bool $verifySSL=true) : URLInfo_ConnectionTester
51
+    public function setVerifySSL(bool $verifySSL = true) : URLInfo_ConnectionTester
52 52
     {
53 53
         $this->setOption('verify-ssl', $verifySSL);
54 54
             return $this;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         return $this->getBoolOption('verify-ssl');
60 60
     }
61 61
     
62
-    public function setVerboseMode(bool $enabled=true) : URLInfo_ConnectionTester
62
+    public function setVerboseMode(bool $enabled = true) : URLInfo_ConnectionTester
63 63
     {
64 64
         $this->setOption('curl-verbose', $enabled);
65 65
         return $this;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $ch = curl_init();
93 93
         
94
-        if(!is_resource($ch))
94
+        if (!is_resource($ch))
95 95
         {
96 96
             throw new BaseException(
97 97
                 'Could not initialize a new cURL instance.',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     private function configureOptions($ch) : void
110 110
     {
111
-        if($this->isVerboseModeEnabled())
111
+        if ($this->isVerboseModeEnabled())
112 112
         {
113 113
             curl_setopt($ch, CURLOPT_VERBOSE, true);
114 114
         }
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
         curl_setopt($ch, CURLOPT_TIMEOUT, $this->getTimeout());
119 119
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
120 120
         
121
-        if(!$this->isVerifySSLEnabled())
121
+        if (!$this->isVerifySSLEnabled())
122 122
         {
123 123
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
124 124
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
125 125
         }
126 126
         
127
-        if($this->url->hasUsername())
127
+        if ($this->url->hasUsername())
128 128
         {
129 129
             curl_setopt($ch, CURLOPT_USERNAME, $this->url->getUsername());
130 130
             curl_setopt($ch, CURLOPT_PASSWORD, $this->url->getPassword());
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
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
      * @param array|null $serialized
68 68
      * @throws BaseException
69 69
      */
70
-    public function __construct($value, ?array $serialized=null)
70
+    public function __construct($value, ?array $serialized = null)
71 71
     {
72
-        if(is_array($serialized))
72
+        if (is_array($serialized))
73 73
         {
74 74
             $this->parseSerialized($serialized);
75 75
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     */
118 118
     protected function parseSerialized(array $serialized) : void
119 119
     {
120
-        if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
120
+        if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options']))
121 121
         {
122 122
             throw new BaseException(
123 123
                 'Invalid variable info serialized data.',
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
         
140 140
         // Gettype will return a string like "Resource(closed)" when
141 141
         // working with a resource that has already been closed.
142
-        if(strstr($this->type, 'resource'))
142
+        if (strstr($this->type, 'resource'))
143 143
         {
144 144
             $this->type = self::TYPE_RESOURCE;
145 145
         }
146 146
 
147
-        if(in_array($this->type, $this->callableTypes) && is_callable($value)) {
147
+        if (in_array($this->type, $this->callableTypes) && is_callable($value)) {
148 148
             $this->type = self::TYPE_CALLABLE;
149 149
         }
150 150
         
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     * @param bool $enable
183 183
     * @return VariableInfo
184 184
     */
185
-    public function enableType(bool $enable=true) : VariableInfo
185
+    public function enableType(bool $enable = true) : VariableInfo
186 186
     {
187 187
         return $this->setOption('prepend-type', $enable);
188 188
     }
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
     {
192 192
         $converted = $this->string;
193 193
         
194
-        if($this->getOption('prepend-type') === true && !$this->isNull())
194
+        if ($this->getOption('prepend-type') === true && !$this->isNull())
195 195
         {
196
-            if($this->isString())
196
+            if ($this->isString())
197 197
             {
198 198
                 $converted = '"'.$converted.'"';
199 199
             }
Please login to merge, or discard this patch.
src/VariableInfo/Renderer/String/Callable.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
         $string = '';
14 14
 
15 15
         // Simple function call
16
-        if(is_string($this->value))
16
+        if (is_string($this->value))
17 17
         {
18 18
             return $this->value.'()';
19 19
         }
20 20
 
21
-        if(is_array($this->value)) {
21
+        if (is_array($this->value)) {
22 22
             return $this->renderArray();
23 23
         }
24 24
 
25
-        if($this->value instanceof NamedClosure) {
25
+        if ($this->value instanceof NamedClosure) {
26 26
             return 'Closure:'.$this->value->getOrigin();
27 27
         }
28 28
 
29
-        if($this->value instanceof Closure) {
29
+        if ($this->value instanceof Closure) {
30 30
             return 'Closure';
31 31
         }
32 32
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
         $string = '';
39 39
 
40 40
         if (is_string($this->value[0])) {
41
-            $string .= $this->value[0] . '::';
41
+            $string .= $this->value[0].'::';
42 42
         } else {
43
-            $string .= get_class($this->value[0]) . '->';
43
+            $string .= get_class($this->value[0]).'->';
44 44
         }
45 45
 
46 46
         $string .= $this->value[1].'()';
Please login to merge, or discard this patch.