Passed
Push — master ( 6080f3...d98100 )
by Sebastian
03:12
created
src/ConvertHelper/Bool.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function fromString($string) : bool
31 31
     {
32
-        if($string === '' || !is_scalar($string))
32
+        if ($string === '' || !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(is_string($string))
42
+        if (is_string($string))
43 43
         {
44 44
             $string = strtolower($string);
45 45
         }
46 46
 
47
-        if(array_key_exists($string, self::$booleanStrings))
47
+        if (array_key_exists($string, self::$booleanStrings))
48 48
         {
49 49
             return self::$booleanStrings[$string];
50 50
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public static function toString($boolean, bool $yesno = false) : string
75 75
     {
76 76
         // allow 'yes', 'true', 'no', 'false' string notations as well
77
-        if(!is_bool($boolean)) {
77
+        if (!is_bool($boolean)) {
78 78
             $boolean = self::fromString($boolean);
79 79
         }
80 80
 
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public static function isBoolean($value) : bool
132 132
     {
133
-        if(is_bool($value)) {
133
+        if (is_bool($value)) {
134 134
             return true;
135 135
         }
136 136
 
137
-        if(!is_scalar($value)) {
137
+        if (!is_scalar($value)) {
138 138
             return false;
139 139
         }
140 140
 
Please login to merge, or discard this patch.
src/FileHelper/JSONFile.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public static function factory($path) : JSONFile
45 45
     {
46
-        if($path instanceof self) {
46
+        if ($path instanceof self) {
47 47
             return $path;
48 48
         }
49 49
 
50 50
         $instance = self::createInstance($path);
51 51
 
52
-        if($instance instanceof self) {
52
+        if ($instance instanceof self) {
53 53
             return $instance;
54 54
         }
55 55
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
     private function convertEncoding(string $contents) : string
130 130
     {
131
-        if(!empty($this->targetEncoding))
131
+        if (!empty($this->targetEncoding))
132 132
         {
133 133
             return (string)mb_convert_encoding(
134 134
                 $contents,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     {
151 151
         $options = null;
152 152
 
153
-        if($pretty)
153
+        if ($pretty)
154 154
         {
155 155
             $options = JSON_PRETTY_PRINT;
156 156
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
                 512,
102 102
                 JSON_THROW_ON_ERROR
103 103
             );
104
-        }
105
-        catch (JsonException $e)
104
+        } catch (JsonException $e)
106 105
         {
107 106
             throw new FileHelper_Exception(
108 107
                 'Cannot decode json data',
@@ -162,8 +161,7 @@  discard block
 block discarded – undo
162 161
             $this->putContents($json);
163 162
 
164 163
             return $this;
165
-        }
166
-        catch (JsonException $e)
164
+        } catch (JsonException $e)
167 165
         {
168 166
             throw new FileHelper_Exception(
169 167
                 'An error occurred while encoding a data set to JSON.',
Please login to merge, or discard this patch.
src/FileHelper/AbstractPathInfo.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
         $path = realpath($this->path);
98 98
 
99
-        if($path !== false)
99
+        if ($path !== false)
100 100
         {
101 101
             return FileHelper::normalizePath($path);
102 102
         }
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
      * @return $this
116 116
      * @throws FileHelper_Exception
117 117
      */
118
-    private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode=null) : self
118
+    private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode = null) : self
119 119
     {
120
-        if($condition === true)
120
+        if ($condition === true)
121 121
         {
122 122
             return $this;
123 123
         }
124 124
 
125
-        if($errorCode === null)
125
+        if ($errorCode === null)
126 126
         {
127 127
             $errorCode = FileHelper::ERROR_FILE_DOES_NOT_EXIST;
128 128
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @return $this
140 140
      * @throws FileHelper_Exception
141 141
      */
142
-    public function requireExists(?int $errorCode=null) : self
142
+    public function requireExists(?int $errorCode = null) : self
143 143
     {
144 144
         return $this->requireTrue(
145 145
             !empty($this->path) && realpath($this->path) !== false,
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
      * @return $this
154 154
      * @throws FileHelper_Exception
155 155
      */
156
-    public function requireReadable(?int $errorCode=null) : self
156
+    public function requireReadable(?int $errorCode = null) : self
157 157
     {
158 158
         $this->requireExists($errorCode);
159 159
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @return $this
170 170
      * @throws FileHelper_Exception
171 171
      */
172
-    public function requireWritable(?int $errorCode=null) : self
172
+    public function requireWritable(?int $errorCode = null) : self
173 173
     {
174 174
         return $this->requireTrue(
175 175
             $this->isWritable(),
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function requireIsFile() : FileInfo
188 188
     {
189
-        if($this instanceof FileInfo)
189
+        if ($this instanceof FileInfo)
190 190
         {
191 191
             return $this;
192 192
         }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      */
210 210
     public function requireIsFolder() : FolderInfo
211 211
     {
212
-        if($this instanceof FolderInfo)
212
+        if ($this instanceof FolderInfo)
213 213
         {
214 214
             return $this;
215 215
         }
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public static function type2string($path) : string
232 232
     {
233
-        if($path instanceof PathInfoInterface)
233
+        if ($path instanceof PathInfoInterface)
234 234
         {
235 235
             return $path->getPath();
236 236
         }
237 237
 
238
-        if($path instanceof SplFileInfo)
238
+        if ($path instanceof SplFileInfo)
239 239
         {
240 240
             return $path->getPathname();
241 241
         }
@@ -257,19 +257,19 @@  discard block
 block discarded – undo
257 257
      */
258 258
     public static function resolveType($path) : PathInfoInterface
259 259
     {
260
-        if($path instanceof PathInfoInterface)
260
+        if ($path instanceof PathInfoInterface)
261 261
         {
262 262
             return $path;
263 263
         }
264 264
 
265 265
         $path = self::type2string($path);
266 266
 
267
-        if(FolderInfo::is_dir($path))
267
+        if (FolderInfo::is_dir($path))
268 268
         {
269 269
             return FolderInfo::factory($path);
270 270
         }
271 271
 
272
-        if(FileInfo::is_file($path))
272
+        if (FileInfo::is_file($path))
273 273
         {
274 274
             return FileInfo::factory($path);
275 275
         }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
     public function getModifiedDate() : ?DateTime
328 328
     {
329 329
         $time = filemtime($this->getPath());
330
-        if($time === false) {
330
+        if ($time === false) {
331 331
             return null;
332 332
         }
333 333
 
Please login to merge, or discard this patch.
src/FileHelper/PathInfoInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 interface PathInfoInterface
25 25
 {
26 26
     public function getName() : string;
27
-    public function getExtension(bool $lowercase=true) : string;
27
+    public function getExtension(bool $lowercase = true) : string;
28 28
     public function getPath() : string;
29 29
     public function getFolderPath() : string;
30 30
     public function exists() : bool;
Please login to merge, or discard this patch.
src/FileHelper/SerializedFile.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function factory($path) : SerializedFile
34 34
     {
35
-        if($path instanceof self) {
35
+        if ($path instanceof self) {
36 36
             return $path;
37 37
         }
38 38
 
39 39
         $instance = self::createInstance($path);
40 40
 
41
-        if($instance instanceof self) {
41
+        if ($instance instanceof self) {
42 42
             return $instance;
43 43
         }
44 44
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             )
74 74
         );
75 75
 
76
-        if($result !== false) {
76
+        if ($result !== false) {
77 77
             return $result;
78 78
         }
79 79
 
Please login to merge, or discard this patch.
src/FileHelper/PHPFile.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function factory($path) : PHPFile
34 34
     {
35
-        if($path instanceof self) {
35
+        if ($path instanceof self) {
36 36
             return $path;
37 37
         }
38 38
 
39 39
         $instance = self::createInstance($path);
40 40
 
41
-        if($instance instanceof self) {
41
+        if ($instance instanceof self) {
42 42
             return $instance;
43 43
         }
44 44
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function checkSyntax()
61 61
     {
62
-        if(!FileHelper::canMakePHPCalls())
62
+        if (!FileHelper::canMakePHPCalls())
63 63
         {
64 64
             return true;
65 65
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         // when the validation is successful, the first entry
72 72
         // in the array contains the success message. When it
73 73
         // is invalid, the first entry is always empty.
74
-        if(!empty($output[0])) {
74
+        if (!empty($output[0])) {
75 75
             return true;
76 76
         }
77 77
 
Please login to merge, or discard this patch.
src/LipsumHelper/LipsumDetector.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public function setMinWords(int $min) : self
123 123
     {
124 124
         // Avoid a reset if the value is the same
125
-        if($this->minWords === $min)
125
+        if ($this->minWords === $min)
126 126
         {
127 127
             return $this;
128 128
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     private function detect() : void
144 144
     {
145
-        if($this->detected) {
145
+        if ($this->detected) {
146 146
             return;
147 147
         }
148 148
 
@@ -150,15 +150,15 @@  discard block
 block discarded – undo
150 150
         $this->found = array();
151 151
         $this->count = 0;
152 152
 
153
-        foreach(self::$words as $word)
153
+        foreach (self::$words as $word)
154 154
         {
155
-            if(stripos($this->subject, $word) !== false)
155
+            if (stripos($this->subject, $word) !== false)
156 156
             {
157 157
                 $this->count++;
158 158
                 $this->found[] = $word;
159 159
             }
160 160
 
161
-            if($this->count >= $this->minWords) {
161
+            if ($this->count >= $this->minWords) {
162 162
                 break;
163 163
             }
164 164
         }
Please login to merge, or discard this patch.
src/StyleCollection.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
35 35
      */
36
-    public function __construct(array $styles=array())
36
+    public function __construct(array $styles = array())
37 37
     {
38 38
         $this->options = new StyleOptions();
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
45 45
      * @return StyleCollection
46 46
      */
47
-    public static function create(array $styles=array()) : StyleCollection
47
+    public static function create(array $styles = array()) : StyleCollection
48 48
     {
49 49
         return new StyleCollection($styles);
50 50
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $lines = explode(';', $string);
70 70
 
71
-        foreach($lines as $line)
71
+        foreach ($lines as $line)
72 72
         {
73 73
             $parts = explode(':', $line);
74 74
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function setStyles(array $styles) : StyleCollection
91 91
     {
92
-        foreach($styles as $name => $value)
92
+        foreach ($styles as $name => $value)
93 93
         {
94 94
             $this->styleAuto($name, $value);
95 95
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      * @param bool $important
106 106
      * @return $this
107 107
      */
108
-    public function style(string $name, string $value, bool $important=false) : StyleCollection
108
+    public function style(string $name, string $value, bool $important = false) : StyleCollection
109 109
     {
110
-        if($value === '')
110
+        if ($value === '')
111 111
         {
112 112
             return $this;
113 113
         }
114 114
 
115
-        if($important && stripos($value, '!important') === false)
115
+        if ($important && stripos($value, '!important') === false)
116 116
         {
117 117
             $value .= ' !important';
118 118
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @param bool $important
131 131
      * @return $this
132 132
      */
133
-    public function styleAuto(string $name, $value, bool $important=false) : StyleCollection
133
+    public function styleAuto(string $name, $value, bool $important = false) : StyleCollection
134 134
     {
135
-        if($value instanceof NumberInfo)
135
+        if ($value instanceof NumberInfo)
136 136
         {
137 137
             return $this->style($name, $value->toCSS(), $important);
138 138
         }
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
         return $this->style($name, (string)$value, $important);
141 141
     }
142 142
 
143
-    public function stylePX(string $name, int $px, bool $important=false) : StyleCollection
143
+    public function stylePX(string $name, int $px, bool $important = false) : StyleCollection
144 144
     {
145 145
         return $this->style($name, $px.'px', $important);
146 146
     }
147 147
 
148
-    public function stylePercent(string $name, float $percent, bool $important=false) : StyleCollection
148
+    public function stylePercent(string $name, float $percent, bool $important = false) : StyleCollection
149 149
     {
150 150
         return $this->style($name, $percent.'%', $important);
151 151
     }
152 152
 
153
-    public function styleEM(string $name, float $em, bool $important=false) : StyleCollection
153
+    public function styleEM(string $name, float $em, bool $important = false) : StyleCollection
154 154
     {
155 155
         return $this->style($name, $em.'em', $important);
156 156
     }
157 157
 
158
-    public function styleREM(string $name, float $em, bool $important=false) : StyleCollection
158
+    public function styleREM(string $name, float $em, bool $important = false) : StyleCollection
159 159
     {
160 160
         return $this->style($name, $em.'rem', $important);
161 161
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param bool $important
170 170
      * @return $this
171 171
      */
172
-    public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection
172
+    public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection
173 173
     {
174 174
         return $this->styleNumber($name, parseNumber($value), $important);
175 175
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param bool $important
183 183
      * @return $this
184 184
      */
185
-    public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection
185
+    public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection
186 186
     {
187 187
         $this->style($name, $info->toCSS(), $important);
188 188
         return $this;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
     public function remove(string $name) : StyleCollection
192 192
     {
193
-        if(isset($this->styles[$name]))
193
+        if (isset($this->styles[$name]))
194 194
         {
195 195
             unset($this->styles[$name]);
196 196
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $all = self::create();
228 228
 
229
-        foreach($collections as $collection)
229
+        foreach ($collections as $collection)
230 230
         {
231 231
             $all->mergeWith($collection);
232 232
         }
Please login to merge, or discard this patch.
src/ClassHelper/ClassNotExistsException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
 
23 23
     public function __construct(string $class, ?int $code = null, ?Throwable $previous = null)
24 24
     {
25
-        if($code === null || $code === 0) {
25
+        if ($code === null || $code === 0) {
26 26
             $code = self::ERROR_CODE;
27 27
         }
28 28
 
Please login to merge, or discard this patch.