Passed
Push — master ( aecd40...074997 )
by Sebastian
10:13 queued 07:17
created
src/OutputBuffering.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         self::$stack[] = 1;
70 70
 
71
-        if(ob_start() === true) {
71
+        if (ob_start() === true) {
72 72
             return;
73 73
         }
74 74
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
     {
91 91
         self::_stop();
92 92
 
93
-        if(ob_end_clean() !== false)
93
+        if (ob_end_clean() !== false)
94 94
         {
95 95
             return;
96 96
         }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     private static function _stop() : void
109 109
     {
110
-        if(empty(self::$stack))
110
+        if (empty(self::$stack))
111 111
         {
112 112
             throw new OutputBuffering_Exception(
113 113
                 'Output buffering is not active',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     {
131 131
         self::_stop();
132 132
 
133
-        if(ob_end_flush() !== false)
133
+        if (ob_end_flush() !== false)
134 134
         {
135 135
             return;
136 136
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         $content = ob_get_clean();
160 160
 
161
-        if($content !== false)
161
+        if ($content !== false)
162 162
         {
163 163
             return $content;
164 164
         }
Please login to merge, or discard this patch.
src/ConvertHelper/TextComparer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,14 +87,14 @@
 block discarded – undo
87 87
     public function match(string $source, string $target) : float
88 88
     {
89 89
         // avoid doing this via levenshtein
90
-        if($source === $target) {
90
+        if ($source === $target) {
91 91
             return 100;
92 92
         }
93 93
 
94 94
         $maxL = $this->getMaxDistance();
95 95
 
96 96
         $diff = levenshtein($source, $target);
97
-        if($diff > $maxL) {
97
+        if ($diff > $maxL) {
98 98
             return 0;
99 99
         }
100 100
 
Please login to merge, or discard this patch.
src/ConvertHelper/Comparator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,19 +49,19 @@
 block discarded – undo
49 49
      */
50 50
     protected static function convertScalarForComparison($scalar) : ?string
51 51
     {
52
-        if($scalar === '' || is_null($scalar)) {
52
+        if ($scalar === '' || is_null($scalar)) {
53 53
             return null;
54 54
         }
55 55
 
56
-        if(is_bool($scalar)) {
56
+        if (is_bool($scalar)) {
57 57
             return ConvertHelper_Bool::toStringStrict($scalar);
58 58
         }
59 59
 
60
-        if(is_array($scalar)) {
60
+        if (is_array($scalar)) {
61 61
             $scalar = md5(serialize($scalar));
62 62
         }
63 63
 
64
-        if($scalar !== null && !is_scalar($scalar)) {
64
+        if ($scalar !== null && !is_scalar($scalar)) {
65 65
             throw new ConvertHelper_Exception(
66 66
                 'Not a scalar value in comparison',
67 67
                 null,
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
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
      * @param bool $caseInsensitive
34 34
      * @return ConvertHelper_StringMatch[]
35 35
      */
36
-    public static function findString(string $needle, string $haystack, bool $caseInsensitive=false): array
36
+    public static function findString(string $needle, string $haystack, bool $caseInsensitive = false): array
37 37
     {
38
-        if($needle === '') {
38
+        if ($needle === '') {
39 39
             return array();
40 40
         }
41 41
 
42 42
         $function = 'mb_strpos';
43
-        if($caseInsensitive) {
43
+        if ($caseInsensitive) {
44 44
             $function = 'mb_stripos';
45 45
         }
46 46
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $positions = array();
49 49
         $length = mb_strlen($needle);
50 50
 
51
-        while( ($pos = $function($haystack, $needle, $pos)) !== false)
51
+        while (($pos = $function($haystack, $needle, $pos)) !== false)
52 52
         {
53 53
             $match = mb_substr($haystack, $pos, $length);
54 54
             $positions[] = new ConvertHelper_StringMatch($pos, $match);
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function toArray(string $string) : array
72 72
     {
73 73
         $result = preg_split('//u', $string, 0, PREG_SPLIT_NO_EMPTY);
74
-        if($result !== false) {
74
+        if ($result !== false) {
75 75
             return $result;
76 76
         }
77 77
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public static function toUtf8(string $string) : string
126 126
     {
127
-        if(!self::isASCII($string)) {
127
+        if (!self::isASCII($string)) {
128 128
             return Encoding::toUTF8($string);
129 129
         }
130 130
 
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public static function isASCII($string) : bool
144 144
     {
145
-        if($string === '' || $string === NULL) {
145
+        if ($string === '' || $string === NULL) {
146 146
             return true;
147 147
         }
148 148
 
149
-        if(!is_string($string)) {
149
+        if (!is_string($string)) {
150 150
             return false;
151 151
         }
152 152
 
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public static function isHTML(string $string) : bool
163 163
     {
164
-        if(preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
164
+        if (preg_match('%<[a-z/][\s\S]*>%siU', $string)) {
165 165
             return true;
166 166
         }
167 167
 
168 168
         $decoded = html_entity_decode($string);
169
-        if($decoded !== $string) {
169
+        if ($decoded !== $string) {
170 170
             return true;
171 171
         }
172 172
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * @param int $tabSize The amount of spaces per tab.
199 199
      * @return string
200 200
      */
201
-    public static function tabs2spaces(string $string, int $tabSize=4) : string
201
+    public static function tabs2spaces(string $string, int $tabSize = 4) : string
202 202
     {
203 203
         return str_replace("\t", str_repeat(' ', $tabSize), $string);
204 204
     }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      * @param int $tabSize The amount of spaces per tab in the source string.
211 211
      * @return string
212 212
      */
213
-    public static function spaces2tabs(string $string, int $tabSize=4) : string
213
+    public static function spaces2tabs(string $string, int $tabSize = 4) : string
214 214
     {
215 215
         return str_replace(str_repeat(' ', $tabSize), "\t", $string);
216 216
     }
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             return $text;
290 290
         }
291 291
 
292
-        return trim(mb_substr($text, 0, $targetLength)) . $append;
292
+        return trim(mb_substr($text, 0, $targetLength)).$append;
293 293
     }
294 294
 
295 295
     /**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public static function explodeTrim(string $delimiter, string $string) : array
304 304
     {
305
-        if(empty($string) || empty($delimiter)) {
305
+        if (empty($string) || empty($delimiter)) {
306 306
             return array();
307 307
         }
308 308
 
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
         $tokens = array_map('trim', $tokens);
311 311
 
312 312
         $keep = array();
313
-        foreach($tokens as $token) {
314
-            if($token !== '') {
313
+        foreach ($tokens as $token) {
314
+            if ($token !== '') {
315 315
                 $keep[] = $token;
316 316
             }
317 317
         }
Please login to merge, or discard this patch.
src/ConvertHelper/DurationConverter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     
72 72
     public function __construct()
73 73
     {
74
-        if(class_exists('\AppLocalize\Localization')) {
74
+        if (class_exists('\AppLocalize\Localization')) {
75 75
             \AppLocalize\Localization::onLocaleChanged(array($this, 'handle_localeChanged'));
76 76
         }
77 77
     }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
         
134 134
         $epoch = 'past';
135 135
         $key = 'singular';
136
-        if($this->dateDiff > 1) {
136
+        if ($this->dateDiff > 1) {
137 137
             $key = 'plural';
138 138
         }
139 139
         
140
-        if($this->future) {
140
+        if ($this->future) {
141 141
             $epoch = 'future'; 
142 142
         }
143 143
         
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     
151 151
     protected function initTexts() : void
152 152
     {
153
-        if(isset(self::$texts)) {
153
+        if (isset(self::$texts)) {
154 154
             return;
155 155
         }
156 156
         
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $day = (int)date("j", $this->dateTo);
237 237
         $year = (int)date("Y", $this->dateFrom);
238 238
         
239
-        while(mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo)
239
+        while (mktime($hour, $min, $sec, $month + ($months_difference), $day, $year) < $this->dateTo)
240 240
         {
241 241
             $months_difference++;
242 242
         }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     
257 257
     protected function resolveCalculations() : void
258 258
     {
259
-        if(!isset($this->dateFrom))
259
+        if (!isset($this->dateFrom))
260 260
         {
261 261
             throw new ConvertHelper_Exception(
262 262
                 'No date from has been specified.',
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         }
267 267
         
268 268
         // no date to set? Assume we want to use today.
269
-        if(!isset($this->dateTo))
269
+        if (!isset($this->dateTo))
270 270
         {
271 271
             $this->dateTo = time();
272 272
         }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         
334 334
         $difference = $this->dateTo - $this->dateFrom;
335 335
         
336
-        if($difference < 0)
336
+        if ($difference < 0)
337 337
         {
338 338
             $difference = $difference * -1;
339 339
             $this->future = true;
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     {
396 396
         $converter = new ConvertHelper_DurationConverter();
397 397
 
398
-        if($datefrom instanceof DateTime)
398
+        if ($datefrom instanceof DateTime)
399 399
         {
400 400
             $converter->setDateFrom($datefrom);
401 401
         }
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
             $converter->setDateFrom(ConvertHelper_Date::fromTimestamp($datefrom));
405 405
         }
406 406
 
407
-        if($dateto instanceof DateTime)
407
+        if ($dateto instanceof DateTime)
408 408
         {
409 409
             $converter->setDateTo($dateto);
410 410
         }
411
-        else if($dateto > 0)
411
+        else if ($dateto > 0)
412 412
         {
413 413
             $converter->setDateTo(ConvertHelper_Date::fromTimestamp($dateto));
414 414
         }
Please login to merge, or discard this patch.
src/ConvertHelper/ThrowableInfo/Call.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $this->info = $info;
61 61
         
62
-        if(isset($data['serialized'])) 
62
+        if (isset($data['serialized'])) 
63 63
         {
64 64
             $this->parseSerialized($data['serialized']);
65 65
         }
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
             $this->position = $data['position'];
70 70
         }
71 71
         
72
-        if($this->hasClass()) 
72
+        if ($this->hasClass()) 
73 73
         {
74 74
             $this->type = self::TYPE_METHOD_CALL;
75 75
         }
76
-        else if($this->hasFunction()) 
76
+        else if ($this->hasFunction()) 
77 77
         {
78 78
             $this->type = self::TYPE_FUNCTION_CALL;
79 79
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     
133 133
     public function getFileName() : string
134 134
     {
135
-        if($this->hasFile()) {
135
+        if ($this->hasFile()) {
136 136
             return basename($this->file);
137 137
         }
138 138
         
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     
142 142
     public function getFileRelative() : string
143 143
     {
144
-        if($this->hasFile()) {
144
+        if ($this->hasFile()) {
145 145
             return FileHelper::relativizePathByDepth($this->file, $this->info->getFolderDepth());
146 146
         }
147 147
         
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $this->class = $data['class'];
172 172
         $this->position = $data['position'];
173 173
         
174
-        foreach($data['arguments'] as $arg)
174
+        foreach ($data['arguments'] as $arg)
175 175
         {
176 176
             $this->args[] = VariableInfo::fromSerialized($arg);
177 177
         }
@@ -182,29 +182,29 @@  discard block
 block discarded – undo
182 182
      */
183 183
     protected function parseTrace(array $trace) : void
184 184
     {
185
-        if(isset($trace['line']))
185
+        if (isset($trace['line']))
186 186
         {
187 187
             $this->line = intval($trace['line']);
188 188
         }
189 189
         
190
-        if(isset($trace['function'])) 
190
+        if (isset($trace['function'])) 
191 191
         {
192 192
             $this->function = $trace['function'];
193 193
         }
194 194
         
195
-        if(isset($trace['file']))
195
+        if (isset($trace['file']))
196 196
         {
197 197
             $this->file = FileHelper::normalizePath($trace['file']);
198 198
         }
199 199
         
200
-        if(isset($trace['class'])) 
200
+        if (isset($trace['class'])) 
201 201
         {
202 202
             $this->class = $trace['class'];
203 203
         }
204 204
      
205
-        if(isset($trace['args']) && !empty($trace['args']))
205
+        if (isset($trace['args']) && !empty($trace['args']))
206 206
         {
207
-            foreach($trace['args'] as $arg) 
207
+            foreach ($trace['args'] as $arg) 
208 208
             {
209 209
                 $this->args[] = parseVariable($arg);
210 210
             }
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
         
220 220
         $tokens[] = '#'.sprintf('%0'.$padLength.'d', $this->getPosition()).' ';
221 221
         
222
-        if($this->hasFile()) {
222
+        if ($this->hasFile()) {
223 223
             $tokens[] = $this->getFileRelative().':'.$this->getLine();
224 224
         }
225 225
         
226
-        if($this->hasClass()) {
226
+        if ($this->hasClass()) {
227 227
             $tokens[] = $this->getClass().'::'.$this->getFunction().'('.$this->argumentsToString().')';
228
-        } else if($this->hasFunction()) {
228
+        } else if ($this->hasFunction()) {
229 229
             $tokens[] = $this->getFunction().'('.$this->argumentsToString().')';
230 230
         }
231 231
         
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
     {
237 237
         $tokens = array();
238 238
         
239
-        foreach($this->args as $arg) 
239
+        foreach ($this->args as $arg) 
240 240
         {
241 241
             $tokens[] = $arg->toString();
242 242
         }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
             'arguments' => array()
282 282
         );
283 283
         
284
-        foreach($this->args as $argument)
284
+        foreach ($this->args as $argument)
285 285
         {
286 286
             $result['arguments'][] = $argument->serialize();
287 287
         }
Please login to merge, or discard this patch.
src/NumberInfo/Comparer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function validate() : bool
57 57
     {
58
-        if($this->a->getUnits() !== $this->b->getUnits())
58
+        if ($this->a->getUnits() !== $this->b->getUnits())
59 59
         {
60 60
             return false;
61 61
         }
62 62
 
63
-        if($this->a->isEmpty() || $this->b->isEmpty())
63
+        if ($this->a->isEmpty() || $this->b->isEmpty())
64 64
         {
65 65
             return false;
66 66
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function isBiggerThan() : bool
72 72
     {
73
-        if($this->valid === false)
73
+        if ($this->valid === false)
74 74
         {
75 75
             return false;
76 76
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public function isBiggerEqual() : bool
82 82
     {
83
-        if($this->valid === false)
83
+        if ($this->valid === false)
84 84
         {
85 85
             return false;
86 86
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function isSmallerThan() : bool
92 92
     {
93
-        if($this->valid === false)
93
+        if ($this->valid === false)
94 94
         {
95 95
             return false;
96 96
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
     public function isSmallerEqual() : bool
102 102
     {
103
-        if($this->valid === false)
103
+        if ($this->valid === false)
104 104
         {
105 105
             return false;
106 106
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function isEqual() : bool
112 112
     {
113
-        if($this->valid === false)
113
+        if ($this->valid === false)
114 114
         {
115 115
             return false;
116 116
         }
Please login to merge, or discard this patch.
src/NumberInfo/Immutable.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     {
15 15
         $number = parseNumber($value, true);
16 16
 
17
-        if($number->getNumber() === $this->getNumber() && $number->hasUnits() === $this->hasUnits())
17
+        if ($number->getNumber() === $this->getNumber() && $number->hasUnits() === $this->hasUnits())
18 18
         {
19 19
             return $this;
20 20
         }
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $number = parseNumber($number, true);
32 32
 
33
-        if($number->getNumber() === $this->getNumber() && $number->getUnits() === $this->getUnits())
33
+        if ($number->getNumber() === $this->getNumber() && $number->getUnits() === $this->getUnits())
34 34
         {
35 35
             return $this;
36 36
         }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $number = parseNumber($this, true);
48 48
         $number->add($value);
49 49
 
50
-        if($number->getNumber() === $this->getNumber())
50
+        if ($number->getNumber() === $this->getNumber())
51 51
         {
52 52
             return $this;
53 53
         }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $number = parseNumber($this, true);
65 65
         $number->subtract($value);
66 66
 
67
-        if($number->getNumber() === $this->getNumber())
67
+        if ($number->getNumber() === $this->getNumber())
68 68
         {
69 69
             return $this;
70 70
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         $number = parseNumber($this, true);
82 82
         $number->subtractPercent($percent);
83 83
 
84
-        if($number->getNumber() === $this->getNumber())
84
+        if ($number->getNumber() === $this->getNumber())
85 85
         {
86 86
             return $this;
87 87
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $number = parseNumber($this, true);
99 99
         $number->addPercent($percent);
100 100
 
101
-        if($number->getNumber() === $this->getNumber())
101
+        if ($number->getNumber() === $this->getNumber())
102 102
         {
103 103
             return $this;
104 104
         }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $number = parseNumber($this, true);
115 115
         $number->floorEven();
116 116
 
117
-        if($number->getNumber() === $this->getNumber())
117
+        if ($number->getNumber() === $this->getNumber())
118 118
         {
119 119
             return $this;
120 120
         }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $number = parseNumber($this, true);
131 131
         $number->ceilEven();
132 132
 
133
-        if($number->getNumber() === $this->getNumber())
133
+        if ($number->getNumber() === $this->getNumber())
134 134
         {
135 135
             return $this;
136 136
         }
Please login to merge, or discard this patch.
src/NumberInfo.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     protected function _setValue($value)
132 132
     {
133
-        if($value instanceof NumberInfo) {
133
+        if ($value instanceof NumberInfo) {
134 134
             $value = $value->getValue();
135 135
         }
136 136
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function isPositive() : bool
172 172
     {
173
-        if($this->isEmpty())
173
+        if ($this->isEmpty())
174 174
         {
175 175
             return false;
176 176
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function isZero() : bool
187 187
     {
188
-        if($this->isEmpty())
188
+        if ($this->isEmpty())
189 189
         {
190 190
             return false;
191 191
         }
@@ -231,23 +231,23 @@  discard block
 block discarded – undo
231 231
     {
232 232
         // Append the units if the value is a number,
233 233
         // so they can be inherited.
234
-        if($this->hasUnits() && is_numeric($number))
234
+        if ($this->hasUnits() && is_numeric($number))
235 235
         {
236 236
             $number .= $this->getUnits();
237 237
         }
238 238
 
239 239
         $new = parseNumber($number);
240 240
 
241
-        if($new->isEmpty())
241
+        if ($new->isEmpty())
242 242
         {
243 243
             return $this;
244 244
         }
245 245
 
246
-        if($new->getUnits() === $this->getUnits())
246
+        if ($new->getUnits() === $this->getUnits())
247 247
         {
248 248
             $value = $new->getNumber();
249 249
 
250
-            if($this->hasUnits()) {
250
+            if ($this->hasUnits()) {
251 251
                 $value .= $this->getUnits();
252 252
             }
253 253
 
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
     {
290 290
         $number = (float)$this->info['number'];
291 291
 
292
-        if($this->hasDecimals())
292
+        if ($this->hasDecimals())
293 293
         {
294 294
             return $number;
295 295
         }
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
      */
326 326
     public function getUnits() : string
327 327
     {
328
-        if($this->isEmpty()) {
328
+        if ($this->isEmpty()) {
329 329
             return '';
330 330
         }
331 331
 
332
-        if(!$this->hasUnits()) {
332
+        if (!$this->hasUnits()) {
333 333
             return 'px';
334 334
         }
335 335
         
@@ -363,15 +363,15 @@  discard block
 block discarded – undo
363 363
      */
364 364
     public function toAttribute() : string
365 365
     {
366
-        if($this->isEmpty()) {
366
+        if ($this->isEmpty()) {
367 367
             return '';
368 368
         }
369 369
         
370
-        if($this->isZero()) {
370
+        if ($this->isZero()) {
371 371
             return '0';
372 372
         }
373 373
         
374
-        if($this->isPercent()) {
374
+        if ($this->isPercent()) {
375 375
             return $this->getNumber().$this->getUnits();
376 376
         }
377 377
         
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
      */
385 385
     public function toCSS() : string
386 386
     {
387
-        if($this->isEmpty()) {
387
+        if ($this->isEmpty()) {
388 388
             return '';
389 389
         }
390 390
         
391
-        if($this->isZero()) {
391
+        if ($this->isZero()) {
392 392
             return '0';
393 393
         }
394 394
         
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
     
398 398
     public function __toString()
399 399
     {
400
-        if($this->isEmpty()) {
400
+        if ($this->isEmpty()) {
401 401
             return '';
402 402
         }
403 403
         
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
      */
504 504
     public function add($value)
505 505
     {
506
-        if($this->isEmpty())
506
+        if ($this->isEmpty())
507 507
         {
508 508
             $this->setValue($value);
509 509
             return $this;
@@ -511,11 +511,11 @@  discard block
 block discarded – undo
511 511
         
512 512
         $number = parseNumber($value);
513 513
         
514
-        if($number->getUnits() === $this->getUnits() || !$number->hasUnits())
514
+        if ($number->getUnits() === $this->getUnits() || !$number->hasUnits())
515 515
         {
516 516
             $new = $this->getNumber() + $number->getNumber();
517 517
 
518
-            if($this->hasUnits())
518
+            if ($this->hasUnits())
519 519
             {
520 520
                 $new .= $this->getUnits();
521 521
             }
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
      */
537 537
     public function subtract($value)
538 538
     {
539
-        if($this->isEmpty())
539
+        if ($this->isEmpty())
540 540
         {
541 541
             $this->setValue($value);
542 542
             return $this;
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
         
545 545
         $number = parseNumber($value);
546 546
         
547
-        if($number->getUnits() == $this->getUnits() || !$number->hasUnits())
547
+        if ($number->getUnits() == $this->getUnits() || !$number->hasUnits())
548 548
         {
549 549
             $new = $this->getNumber() - $number->getNumber();
550 550
 
551
-            if($this->hasUnits())
551
+            if ($this->hasUnits())
552 552
             {
553 553
                 $new .= $this->getUnits();
554 554
             }
@@ -588,13 +588,13 @@  discard block
 block discarded – undo
588 588
      */
589 589
     protected function percentOperation(string $operation, $percent)
590 590
     {
591
-        if($this->isZeroOrEmpty()) {
591
+        if ($this->isZeroOrEmpty()) {
592 592
             return $this;
593 593
         }
594 594
         
595 595
         $percent = parseNumber($percent);
596 596
 
597
-        if($percent->hasUnits() && !$percent->isPercent())
597
+        if ($percent->hasUnits() && !$percent->isPercent())
598 598
         {
599 599
             return $this;
600 600
         }
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
         $number = $this->getNumber();
603 603
         $value = $number * $percent->getNumber() / 100;
604 604
         
605
-        if($operation == '-') {
605
+        if ($operation == '-') {
606 606
             $number = $number - $value;
607 607
         } else {
608 608
             $number = $number + $value;
609 609
         }
610 610
         
611
-        if($this->isUnitInteger())
611
+        if ($this->isUnitInteger())
612 612
         {
613 613
             $number = intval($number);
614 614
         }
615 615
 
616
-        if($this->hasUnits())
616
+        if ($this->hasUnits())
617 617
         {
618 618
             $number .= $this->getUnits();
619 619
         }
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
     {
628 628
         $units = $this->getUnits();
629 629
 
630
-        if(isset($this->knownUnits[$units]))
630
+        if (isset($this->knownUnits[$units]))
631 631
         {
632 632
             return !$this->knownUnits[$units];
633 633
         }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     {
640 640
         $units = $this->getUnits();
641 641
 
642
-        if(isset($this->knownUnits[$units]))
642
+        if (isset($this->knownUnits[$units]))
643 643
         {
644 644
             return $this->knownUnits[$units];
645 645
         }
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         
679 679
         $key = $this->createValueKey($value);
680 680
 
681
-        if(array_key_exists($key, $cache)) {
681
+        if (array_key_exists($key, $cache)) {
682 682
             return $cache[$key];
683 683
         }
684 684
         
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
             'number' => null
689 689
         );
690 690
         
691
-        if($key === '_EMPTY_') 
691
+        if ($key === '_EMPTY_') 
692 692
         {
693 693
             $cache[$key]['empty'] = true;
694 694
             return $cache[$key];
695 695
         }
696 696
         
697
-        if($value === 0 || $value === '0') 
697
+        if ($value === 0 || $value === '0') 
698 698
         {
699 699
             $cache[$key]['number'] = 0;
700 700
             $cache[$key] = $this->filterInfo($cache[$key]);
@@ -703,20 +703,20 @@  discard block
 block discarded – undo
703 703
         
704 704
         $test = trim((string)$value);
705 705
         
706
-        if($test === '') 
706
+        if ($test === '') 
707 707
         {
708 708
             $cache[$key]['empty'] = true;
709 709
             return $cache[$key];
710 710
         }
711 711
         
712 712
         // replace comma notation (which is only possible if it's a string)
713
-        if(is_string($value))
713
+        if (is_string($value))
714 714
         {
715 715
             $test = $this->preProcess($test, $cache, $value);
716 716
         }
717 717
         
718 718
         // convert to a number if it's numeric
719
-        if(is_numeric($test)) 
719
+        if (is_numeric($test)) 
720 720
         {
721 721
             $cache[$key]['number'] = (float)$test * 1;
722 722
             $cache[$key] = $this->filterInfo($cache[$key]);
@@ -742,19 +742,19 @@  discard block
 block discarded – undo
742 742
         $empty = false;
743 743
         
744 744
         $found = $this->findUnits($test);
745
-        if($found !== null) 
745
+        if ($found !== null) 
746 746
         {
747 747
             $number = $found['number'];
748 748
             $units = $found['units'];
749 749
         }
750 750
         
751 751
         // the filters have to restore the value
752
-        if($this->postProcess)
752
+        if ($this->postProcess)
753 753
         {
754 754
             $number = $this->postProcess($number, $test);
755 755
         }
756 756
         // empty number
757
-        else if($number === '' || $number === null || is_bool($number))
757
+        else if ($number === '' || $number === null || is_bool($number))
758 758
         {
759 759
             $number = null;
760 760
             $empty = true;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
             $number = trim($number);
766 766
             
767 767
             // may be an arbitrary string in some cases
768
-            if(!is_numeric($number))
768
+            if (!is_numeric($number))
769 769
             {
770 770
                 $number = null;
771 771
                 $empty = true;
@@ -797,17 +797,17 @@  discard block
 block discarded – undo
797 797
         $vlength = strlen($value);
798 798
         $names = array_keys($this->knownUnits);
799 799
         
800
-        foreach($names as $unit)
800
+        foreach ($names as $unit)
801 801
         {
802 802
             $ulength = strlen($unit);
803
-            $start = $vlength-$ulength;
804
-            if($start < 0) {
803
+            $start = $vlength - $ulength;
804
+            if ($start < 0) {
805 805
                 continue;
806 806
             }
807 807
             
808 808
             $search = substr($value, $start, $ulength);
809 809
             
810
-            if($search==$unit) 
810
+            if ($search == $unit) 
811 811
             {
812 812
                 return array(
813 813
                     'units' => $unit,
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     */
828 828
     private function createValueKey($value) : string
829 829
     {
830
-        if(!is_string($value) && !is_numeric($value))
830
+        if (!is_string($value) && !is_numeric($value))
831 831
         {
832 832
             return '_EMPTY_';
833 833
         }
@@ -891,12 +891,12 @@  discard block
 block discarded – undo
891 891
     protected function filterInfo(array $info) : array
892 892
     {
893 893
         $useUnits = 'px';
894
-        if($info['units'] !== null) {
894
+        if ($info['units'] !== null) {
895 895
             $useUnits = $info['units'];
896 896
         }
897 897
         
898 898
         // the units are non-decimal: convert decimal values
899
-        if($this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
899
+        if ($this->knownUnits[$useUnits] === false && !$info['empty'] && is_numeric($info['number']))
900 900
         {
901 901
             $info['number'] = intval($info['number']);
902 902
         }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
     {
923 923
         $number = floor($this->getNumber());
924 924
 
925
-        if($number % 2 == 1) $number--;
925
+        if ($number % 2 == 1) $number--;
926 926
 
927 927
         return $this->setNumber($number);
928 928
     }
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
     {
939 939
         $number = ceil($this->getNumber());
940 940
 
941
-        if($number % 2 == 1) $number++;
941
+        if ($number % 2 == 1) $number++;
942 942
 
943 943
         return $this->setNumber($number);
944 944
     }
Please login to merge, or discard this patch.