Passed
Push — master ( 289f9d...bae7fb )
by Sebastian
04:42
created
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/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/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.
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/ConvertHelper/String.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
      * @param bool $caseInsensitive
20 20
      * @return ConvertHelper_StringMatch[]
21 21
      */
22
-    public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
22
+    public static function findString(string $needle, string $haystack, bool $caseInsensitive = false): array
23 23
     {
24
-        if($needle === '') {
24
+        if ($needle === '') {
25 25
             return array();
26 26
         }
27 27
 
28 28
         $function = 'mb_strpos';
29
-        if($caseInsensitive) {
29
+        if ($caseInsensitive) {
30 30
             $function = 'mb_stripos';
31 31
         }
32 32
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $positions = array();
35 35
         $length = mb_strlen($needle);
36 36
 
37
-        while( ($pos = $function($haystack, $needle, $pos)) !== false)
37
+        while (($pos = $function($haystack, $needle, $pos)) !== false)
38 38
         {
39 39
             $match = mb_substr($haystack, $pos, $length);
40 40
             $positions[] = new ConvertHelper_StringMatch($pos, $match);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     public static function toArray(string $string) : array
58 58
     {
59 59
         $result = preg_split('//u', $string, 0, PREG_SPLIT_NO_EMPTY);
60
-        if($result !== false) {
60
+        if ($result !== false) {
61 61
             return $result;
62 62
         }
63 63
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public static function toUtf8(string $string) : string
112 112
     {
113
-        if(!self::isASCII($string)) {
113
+        if (!self::isASCII($string)) {
114 114
             return Encoding::toUTF8($string);
115 115
         }
116 116
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public static function isASCII($string) : bool
130 130
     {
131
-        if($string === '' || $string === NULL) {
131
+        if ($string === '' || $string === NULL) {
132 132
             return true;
133 133
         }
134 134
 
135
-        if(!is_string($string)) {
135
+        if (!is_string($string)) {
136 136
             return false;
137 137
         }
138 138
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public static function isHTML(string $string) : bool
149 149
     {
150
-        if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
150
+        if (preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
151 151
             return true;
152 152
         }
153 153
 
154 154
         $decoded = html_entity_decode($string);
155
-        if($decoded !== $string) {
155
+        if ($decoded !== $string) {
156 156
             return true;
157 157
         }
158 158
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param int $tabSize The amount of spaces per tab.
185 185
      * @return string
186 186
      */
187
-    public static function tabs2spaces(string $string, int $tabSize=4) : string
187
+    public static function tabs2spaces(string $string, int $tabSize = 4) : string
188 188
     {
189 189
         return str_replace("\t", str_repeat(' ', $tabSize), $string);
190 190
     }
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
      * @param int $tabSize The amount of spaces per tab in the source string.
197 197
      * @return string
198 198
      */
199
-    public static function spaces2tabs(string $string, int $tabSize=4) : string
199
+    public static function spaces2tabs(string $string, int $tabSize = 4) : string
200 200
     {
201 201
         return str_replace(str_repeat(' ', $tabSize), "\t", $string);
202 202
     }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             return $text;
274 274
         }
275 275
 
276
-        $text = trim(mb_substr($text, 0, $targetLength)) . $append;
276
+        $text = trim(mb_substr($text, 0, $targetLength)).$append;
277 277
 
278 278
         return $text;
279 279
     }
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public static function explodeTrim(string $delimiter, string $string) : array
290 290
     {
291
-        if(empty($string) || empty($delimiter)) {
291
+        if (empty($string) || empty($delimiter)) {
292 292
             return array();
293 293
         }
294 294
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
         $tokens = array_map('trim', $tokens);
297 297
 
298 298
         $keep = array();
299
-        foreach($tokens as $token) {
300
-            if($token !== '') {
299
+        foreach ($tokens as $token) {
300
+            if ($token !== '') {
301 301
                 $keep[] = $token;
302 302
             }
303 303
         }
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.