@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getNextPage() : int |
115 | 115 | { |
116 | - if($this->next === 0) { |
|
116 | + if ($this->next === 0) { |
|
117 | 117 | return $this->last; |
118 | 118 | } |
119 | 119 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getPreviousPage() : int |
139 | 139 | { |
140 | - if($this->prev === 0) { |
|
140 | + if ($this->prev === 0) { |
|
141 | 141 | return 1; |
142 | 142 | } |
143 | 143 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // adjust the adjacent value if it exceeds the |
183 | 183 | // total amount of pages |
184 | 184 | $adjacentTotal = ($adjacent * 2) + 1; |
185 | - if($adjacentTotal > $this->last) |
|
185 | + if ($adjacentTotal > $this->last) |
|
186 | 186 | { |
187 | 187 | $adjacent = (int)floor($this->last / 2); |
188 | 188 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | $back = 0; |
196 | 196 | $fwd = 0; |
197 | 197 | |
198 | - if($maxBack >= $adjacent) { |
|
198 | + if ($maxBack >= $adjacent) { |
|
199 | 199 | $back = $adjacent; |
200 | 200 | } else { |
201 | 201 | $back = $maxBack; |
202 | 202 | } |
203 | 203 | |
204 | - if($maxFwd >= $adjacent) { |
|
204 | + if ($maxFwd >= $adjacent) { |
|
205 | 205 | $fwd = $adjacent; |
206 | 206 | } else { |
207 | 207 | $fwd = $maxFwd; |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | $fwd += $backDiff; |
218 | 218 | $back += $fwdDiff; |
219 | 219 | |
220 | - if($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | - if($back > $maxBack) { $back = $maxBack; } |
|
220 | + if ($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | + if ($back > $maxBack) { $back = $maxBack; } |
|
222 | 222 | |
223 | 223 | // calculate the first and last page in the list |
224 | 224 | $prev = $this->current - $back; |
225 | 225 | $next = $this->current + $fwd; |
226 | 226 | |
227 | 227 | // failsafe so we stay within the bounds |
228 | - if($prev < 1) { $prev = 1; } |
|
229 | - if($next > $this->last) { $next = $this->last; } |
|
228 | + if ($prev < 1) { $prev = 1; } |
|
229 | + if ($next > $this->last) { $next = $this->last; } |
|
230 | 230 | |
231 | 231 | // create and return the page numbers list |
232 | 232 | $numbers = range($prev, $next); |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | { |
320 | 320 | $pages = (int)ceil($this->total / $this->perPage); |
321 | 321 | |
322 | - if($this->current < 1) |
|
322 | + if ($this->current < 1) |
|
323 | 323 | { |
324 | 324 | $this->current = 1; |
325 | 325 | } |
326 | - else if($this->current > $pages) |
|
326 | + else if ($this->current > $pages) |
|
327 | 327 | { |
328 | 328 | $this->current = $pages; |
329 | 329 | } |
@@ -331,19 +331,19 @@ discard block |
||
331 | 331 | $this->last = $pages; |
332 | 332 | |
333 | 333 | $nextPage = $this->current + 1; |
334 | - if($nextPage <= $pages) { |
|
334 | + if ($nextPage <= $pages) { |
|
335 | 335 | $this->next = $nextPage; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $prevPage = $this->current - 1; |
339 | - if($prevPage > 0) { |
|
339 | + if ($prevPage > 0) { |
|
340 | 340 | $this->prev = $prevPage; |
341 | 341 | } |
342 | 342 | |
343 | 343 | $this->offsetStart = ($this->current - 1) * $this->perPage; |
344 | 344 | |
345 | 345 | $this->offsetEnd = $this->offsetStart + $this->perPage; |
346 | - if($this->offsetEnd > ($this->total - 1)) { |
|
346 | + if ($this->offsetEnd > ($this->total - 1)) { |
|
347 | 347 | $this->offsetEnd = ($this->total - 1); |
348 | 348 | } |
349 | 349 | } |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | $quoteStyle = array_shift($params); |
96 | 96 | $method = array_shift($params); |
97 | 97 | |
98 | - $call = $method . '('; |
|
98 | + $call = $method.'('; |
|
99 | 99 | |
100 | 100 | $total = count($params); |
101 | - if($total > 0) { |
|
102 | - for($i=0; $i < $total; $i++) |
|
101 | + if ($total > 0) { |
|
102 | + for ($i = 0; $i < $total; $i++) |
|
103 | 103 | { |
104 | 104 | $call .= self::phpVariable2JS($params[$i], $quoteStyle); |
105 | - if($i < ($total-1)) { |
|
105 | + if ($i < ($total - 1)) { |
|
106 | 106 | $call .= ','; |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - return $call . ');'; |
|
111 | + return $call.');'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public static function buildVariable(string $varName, $varValue) : string |
134 | 134 | { |
135 | - return $varName . "=" . self::phpVariable2JS($varValue) . ';'; |
|
135 | + return $varName."=".self::phpVariable2JS($varValue).';'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @param int $quoteStyle The quote style to use for strings |
145 | 145 | * @return string |
146 | 146 | */ |
147 | - public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string |
|
147 | + public static function phpVariable2JS($variable, int $quoteStyle = self::QUOTE_STYLE_DOUBLE) : string |
|
148 | 148 | { |
149 | 149 | // after much profiling, this variant of the method offers |
150 | 150 | // the best performance. Repeat scalar values are cached |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | |
153 | 153 | $type = gettype($variable); |
154 | 154 | $hash = null; |
155 | - if(is_scalar($variable) === true) |
|
155 | + if (is_scalar($variable) === true) |
|
156 | 156 | { |
157 | 157 | $hash = $variable; |
158 | 158 | |
159 | - if($hash === true) |
|
159 | + if ($hash === true) |
|
160 | 160 | { |
161 | 161 | $hash = 'true'; |
162 | 162 | } |
163 | - else if($hash === false) |
|
163 | + else if ($hash === false) |
|
164 | 164 | { |
165 | 165 | $hash = 'false'; |
166 | 166 | } |
167 | 167 | |
168 | 168 | $hash .= '-'.$quoteStyle.'-'.$type; |
169 | 169 | |
170 | - if(isset(self::$variableCache[$hash])) { |
|
170 | + if (isset(self::$variableCache[$hash])) { |
|
171 | 171 | return self::$variableCache[$hash]; |
172 | 172 | } |
173 | 173 | } |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | $result = 'null'; |
176 | 176 | |
177 | 177 | // one gettype call is better than a strict if-else. |
178 | - switch($type) |
|
178 | + switch ($type) |
|
179 | 179 | { |
180 | 180 | case 'double': |
181 | 181 | case 'string': |
182 | 182 | $string = json_encode($variable); |
183 | 183 | |
184 | - if($string === false) |
|
184 | + if ($string === false) |
|
185 | 185 | { |
186 | 186 | $string = ''; |
187 | 187 | } |
188 | - else if($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
188 | + else if ($quoteStyle === self::QUOTE_STYLE_SINGLE) |
|
189 | 189 | { |
190 | - $string = mb_substr($string, 1, mb_strlen($string)-2); |
|
190 | + $string = mb_substr($string, 1, mb_strlen($string) - 2); |
|
191 | 191 | $string = "'".str_replace("'", "\'", $string)."'"; |
192 | 192 | } |
193 | 193 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'boolean': |
198 | - if($variable === true) { |
|
198 | + if ($variable === true) { |
|
199 | 199 | $result = 'true'; |
200 | 200 | } else { |
201 | 201 | $result = 'false'; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // cache cacheable values |
216 | - if($hash !== null) |
|
216 | + if ($hash !== null) |
|
217 | 217 | { |
218 | 218 | self::$variableCache[$hash] = $result; |
219 | 219 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | self::$elementCounter++; |
247 | 247 | |
248 | - return self::$idPrefix . self::$elementCounter; |
|
248 | + return self::$idPrefix.self::$elementCounter; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @see JSHelper::JS_REGEX_OBJECT |
320 | 320 | * @see JSHelper::JS_REGEX_JSON |
321 | 321 | */ |
322 | - public static function buildRegexStatement(string $regex, string $statementType=self::JS_REGEX_OBJECT) : string |
|
322 | + public static function buildRegexStatement(string $regex, string $statementType = self::JS_REGEX_OBJECT) : string |
|
323 | 323 | { |
324 | 324 | $regex = trim($regex); |
325 | 325 | $separator = substr($regex, 0, 1); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | array_shift($parts); |
328 | 328 | |
329 | 329 | $modifiers = array_pop($parts); |
330 | - if($modifiers == $separator) { |
|
330 | + if ($modifiers == $separator) { |
|
331 | 331 | $modifiers = ''; |
332 | 332 | } |
333 | 333 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | // convert the anchors that are not supported in js regexes |
344 | 344 | $format = str_replace(array('\\A', '\\Z', '\\z'), array('^', '$', ''), $format); |
345 | 345 | |
346 | - if($statementType==self::JS_REGEX_JSON) |
|
346 | + if ($statementType == self::JS_REGEX_JSON) |
|
347 | 347 | { |
348 | 348 | return ConvertHelper::var2json(array( |
349 | 349 | 'format' => $format, |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | )); |
352 | 352 | } |
353 | 353 | |
354 | - if(!empty($modifiers)) { |
|
354 | + if (!empty($modifiers)) { |
|
355 | 355 | return sprintf( |
356 | 356 | 'new RegExp(%s, %s)', |
357 | 357 | ConvertHelper::var2json($format), |
@@ -63,7 +63,7 @@ |
||
63 | 63 | return $this->getBoolOption('cut'); |
64 | 64 | } |
65 | 65 | |
66 | - public function setCuttingEnabled(bool $enabled=true) : ConvertHelper_WordWrapper |
|
66 | + public function setCuttingEnabled(bool $enabled = true) : ConvertHelper_WordWrapper |
|
67 | 67 | { |
68 | 68 | $this->setOption('cut', $enabled); |
69 | 69 | return $this; |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | $this->commandLine = $commandLine; |
42 | 42 | $this->output = $output; |
43 | 43 | |
44 | - foreach($errors as $error) { |
|
45 | - if($error->isError()) { |
|
44 | + foreach ($errors as $error) { |
|
45 | + if ($error->isError()) { |
|
46 | 46 | $this->errors[] = $error; |
47 | 47 | } else { |
48 | 48 | $this->warnings[] = $error; |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | |
63 | 63 | public function hasErrorCode($code) |
64 | 64 | { |
65 | - foreach($this->errors as $error) { |
|
66 | - if($error->getCode() == $code) { |
|
65 | + foreach ($this->errors as $error) { |
|
66 | + if ($error->getCode() == $code) { |
|
67 | 67 | return true; |
68 | 68 | } |
69 | 69 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | * @param bool $asString |
93 | 93 | * @return string|string[] |
94 | 94 | */ |
95 | - public function getErrorMessages(bool $asString=false) |
|
95 | + public function getErrorMessages(bool $asString = false) |
|
96 | 96 | { |
97 | - if($asString) { |
|
97 | + if ($asString) { |
|
98 | 98 | $lines = array(); |
99 | - foreach($this->errors as $error) { |
|
99 | + foreach ($this->errors as $error) { |
|
100 | 100 | $lines[] = (string)$error; |
101 | 101 | } |
102 | 102 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | $messages = array(); |
107 | - foreach($this->errors as $error) { |
|
107 | + foreach ($this->errors as $error) { |
|
108 | 108 | $messages[] = (string)$error; |
109 | 109 | } |
110 | 110 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | public function getLastLine() |
125 | 125 | { |
126 | - return $this->output[count($this->output)-1]; |
|
126 | + return $this->output[count($this->output) - 1]; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function getFirstLine() |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | public function isConnectionFailed() |
140 | 140 | { |
141 | - foreach($this->errors as $error) { |
|
142 | - if($error->isConnectionFailed()) { |
|
141 | + foreach ($this->errors as $error) { |
|
142 | + if ($error->isConnectionFailed()) { |
|
143 | 143 | return true; |
144 | 144 | } |
145 | 145 | } |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | |
150 | 150 | public function hasConflicts() |
151 | 151 | { |
152 | - foreach($this->errors as $error) { |
|
153 | - if($error->isConflict()) { |
|
152 | + foreach ($this->errors as $error) { |
|
153 | + if ($error->isConflict()) { |
|
154 | 154 | return true; |
155 | 155 | } |
156 | 156 | } |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | |
161 | 161 | public function hasLocks() |
162 | 162 | { |
163 | - foreach($this->errors as $error) { |
|
164 | - if($error->isLock()) { |
|
163 | + foreach ($this->errors as $error) { |
|
164 | + if ($error->isLock()) { |
|
165 | 165 | return true; |
166 | 166 | } |
167 | 167 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->bytes = $bytes; |
34 | 34 | |
35 | 35 | // correct negative values |
36 | - if($this->bytes < 0) |
|
36 | + if ($this->bytes < 0) |
|
37 | 37 | { |
38 | 38 | $this->bytes = 0; |
39 | 39 | } |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | { |
50 | 50 | $sizes = $this->getSizesSorted($base); |
51 | 51 | |
52 | - if($this->bytes >= $sizes[0]->getBytes()) |
|
52 | + if ($this->bytes >= $sizes[0]->getBytes()) |
|
53 | 53 | { |
54 | 54 | $total = count($sizes); |
55 | 55 | |
56 | - for($i=0; $i < $total; $i++) |
|
56 | + for ($i = 0; $i < $total; $i++) |
|
57 | 57 | { |
58 | 58 | $size = $sizes[$i]; |
59 | 59 | |
60 | - if(!isset($sizes[($i+1)])) { |
|
60 | + if (!isset($sizes[($i + 1)])) { |
|
61 | 61 | return $size; |
62 | 62 | } |
63 | 63 | |
64 | - if($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i+1)]->getBytes()) { |
|
64 | + if ($this->bytes >= $size->getBytes() && $this->bytes < $sizes[($i + 1)]->getBytes()) { |
|
65 | 65 | return $size; |
66 | 66 | } |
67 | 67 | } |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | * @see ConvertHelper_StorageSizeEnum::BASE_10 |
100 | 100 | * @see ConvertHelper_StorageSizeEnum::BASE_2 |
101 | 101 | */ |
102 | - public function toString(int $precision, int $base=ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
102 | + public function toString(int $precision, int $base = ConvertHelper_StorageSizeEnum::BASE_10) : string |
|
103 | 103 | { |
104 | 104 | $size = $this->detectSize($base); |
105 | 105 | |
106 | - return round($this->bytes / $size->getBytes(), $precision) . ' ' . $size->getSuffix(); |
|
106 | + return round($this->bytes / $size->getBytes(), $precision).' '.$size->getSuffix(); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param int $precision Amount of decimals (rounded up) |
127 | 127 | * @return float |
128 | 128 | */ |
129 | - public function toKilobytes(int $precision=1) : float |
|
129 | + public function toKilobytes(int $precision = 1) : float |
|
130 | 130 | { |
131 | 131 | return $this->toNumber($precision, 'kb'); |
132 | 132 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @param int $precision Amount of decimals (rounded up) |
138 | 138 | * @return float |
139 | 139 | */ |
140 | - public function toMegabytes(int $precision=1) : float |
|
140 | + public function toMegabytes(int $precision = 1) : float |
|
141 | 141 | { |
142 | 142 | return $this->toNumber($precision, 'mb'); |
143 | 143 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param int $precision Amount of decimals (rounded up) |
149 | 149 | * @return float |
150 | 150 | */ |
151 | - public function toGigabytes(int $precision=1) : float |
|
151 | + public function toGigabytes(int $precision = 1) : float |
|
152 | 152 | { |
153 | 153 | return $this->toNumber($precision, 'gb'); |
154 | 154 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param int $precision Amount of decimals (rounded up) |
160 | 160 | * @return float |
161 | 161 | */ |
162 | - public function toTerabytes(int $precision=1) : float |
|
162 | + public function toTerabytes(int $precision = 1) : float |
|
163 | 163 | { |
164 | 164 | return $this->toNumber($precision, 'tb'); |
165 | 165 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param int $precision Amount of decimals (rounded up) |
171 | 171 | * @return float |
172 | 172 | */ |
173 | - public function toPetabytes(int $precision=1) : float |
|
173 | + public function toPetabytes(int $precision = 1) : float |
|
174 | 174 | { |
175 | 175 | return $this->toNumber($precision, 'pb'); |
176 | 176 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param int $precision Amount of decimals (rounded up) |
182 | 182 | * @return float |
183 | 183 | */ |
184 | - public function toKibibytes(int $precision=1) : float |
|
184 | + public function toKibibytes(int $precision = 1) : float |
|
185 | 185 | { |
186 | 186 | return $this->toNumber($precision, 'kib'); |
187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param int $precision Amount of decimals (rounded up) |
193 | 193 | * @return float |
194 | 194 | */ |
195 | - public function toMebibytes(int $precision=1) : float |
|
195 | + public function toMebibytes(int $precision = 1) : float |
|
196 | 196 | { |
197 | 197 | return $this->toNumber($precision, 'mib'); |
198 | 198 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param int $precision Amount of decimals (rounded up) |
204 | 204 | * @return float |
205 | 205 | */ |
206 | - public function toGibibytes(int $precision=1) : float |
|
206 | + public function toGibibytes(int $precision = 1) : float |
|
207 | 207 | { |
208 | 208 | return $this->toNumber($precision, 'gib'); |
209 | 209 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param int $precision Amount of decimals (rounded up) |
215 | 215 | * @return float |
216 | 216 | */ |
217 | - public function toTebibytes(int $precision=1) : float |
|
217 | + public function toTebibytes(int $precision = 1) : float |
|
218 | 218 | { |
219 | 219 | return $this->toNumber($precision, 'tib'); |
220 | 220 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @param int $precision Amount of decimals (rounded up) |
226 | 226 | * @return float |
227 | 227 | */ |
228 | - public function toPebibytes(int $precision=1) : float |
|
228 | + public function toPebibytes(int $precision = 1) : float |
|
229 | 229 | { |
230 | 230 | return $this->toNumber($precision, 'pib'); |
231 | 231 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | * @see ConvertHelper::bytes2readable() |
101 | 101 | */ |
102 | - public function toString(int $precision=1) : string |
|
102 | + public function toString(int $precision = 1) : string |
|
103 | 103 | { |
104 | 104 | return ConvertHelper::bytes2readable($this->bytes, $precision, $this->getBase()); |
105 | 105 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getBase() : int |
112 | 112 | { |
113 | - if($this->isValid()) { |
|
113 | + if ($this->isValid()) { |
|
114 | 114 | return $this->sizeDefinition->getBase(); |
115 | 115 | } |
116 | 116 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getSizeDefinition() : ?ConvertHelper_StorageSizeEnum_Size |
128 | 128 | { |
129 | - if($this->isValid()) { |
|
129 | + if ($this->isValid()) { |
|
130 | 130 | return $this->sizeDefinition; |
131 | 131 | } |
132 | 132 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | |
176 | 176 | protected function parseSize() : void |
177 | 177 | { |
178 | - if(!$this->detectParts()) { |
|
178 | + if (!$this->detectParts()) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | 182 | // we detected units in the string: all good. |
183 | - if($this->units !== null) |
|
183 | + if ($this->units !== null) |
|
184 | 184 | { |
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | 188 | // just a numeric value: we assume this means we're dealing with bytes. |
189 | - if(is_numeric($this->number)) |
|
189 | + if (is_numeric($this->number)) |
|
190 | 190 | { |
191 | 191 | $this->units = 'b'; |
192 | 192 | return; |
@@ -212,12 +212,12 @@ discard block |
||
212 | 212 | |
213 | 213 | $number = $this->sizeString; |
214 | 214 | |
215 | - foreach($units as $unit) |
|
215 | + foreach ($units as $unit) |
|
216 | 216 | { |
217 | - if(stristr($number, $unit)) |
|
217 | + if (stristr($number, $unit)) |
|
218 | 218 | { |
219 | 219 | // there are more than 1 unit defined in the string |
220 | - if($this->units !== null) |
|
220 | + if ($this->units !== null) |
|
221 | 221 | { |
222 | 222 | $this->setError( |
223 | 223 | t( |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | { |
274 | 274 | $this->parseSize(); |
275 | 275 | |
276 | - if(!$this->valid) { |
|
276 | + if (!$this->valid) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $int = intval($this->number); |
281 | 281 | |
282 | 282 | // negative values |
283 | - if($int < 0) |
|
283 | + if ($int < 0) |
|
284 | 284 | { |
285 | 285 | $this->setError( |
286 | 286 | t('Negative values cannot be used as size.'), |
@@ -34,7 +34,7 @@ |
||
34 | 34 | array_unshift($args, $this->value); |
35 | 35 | |
36 | 36 | $result = call_user_func_array($this->getOption('callback'), $args); |
37 | - if($result !== false) { |
|
37 | + if ($result !== false) { |
|
38 | 38 | return $this->value; |
39 | 39 | } |
40 | 40 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | str_replace(' ', '-', $this->type) |
41 | 41 | ); |
42 | 42 | |
43 | - if($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
43 | + if ($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
44 | 44 | { |
45 | 45 | $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->info->getType().'</span> '; |
46 | 46 | $converted = $typeLabel.' '.$converted; |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | |
108 | 108 | protected function detectAttributes() |
109 | 109 | { |
110 | - if(!$this->options['@attributes']) { |
|
110 | + if (!$this->options['@attributes']) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | 114 | $attributes = $this->subject->attributes(); |
115 | 115 | |
116 | - if(!empty($attributes)) |
|
116 | + if (!empty($attributes)) |
|
117 | 117 | { |
118 | 118 | $this->result['@attributes'] = array_map('strval', iterator_to_array($attributes)); |
119 | 119 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $children = $this->subject; |
125 | 125 | $depth = $this->options['depth'] - 1; |
126 | 126 | |
127 | - if($depth <= 0) |
|
127 | + if ($depth <= 0) |
|
128 | 128 | { |
129 | 129 | $children = []; |
130 | 130 | } |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | |
138 | 138 | $decorator->options = ['depth' => $depth] + $this->options; |
139 | 139 | |
140 | - if(isset($this->result[$name])) |
|
140 | + if (isset($this->result[$name])) |
|
141 | 141 | { |
142 | - if(!is_array($this->result[$name])) |
|
142 | + if (!is_array($this->result[$name])) |
|
143 | 143 | { |
144 | 144 | $this->result[$name] = [$this->result[$name]]; |
145 | 145 | } |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | // json encode non-whitespace element simplexml text values. |
159 | 159 | $text = trim((string)$this->subject); |
160 | 160 | |
161 | - if(strlen($text)) |
|
161 | + if (strlen($text)) |
|
162 | 162 | { |
163 | - if($this->options['@text']) |
|
163 | + if ($this->options['@text']) |
|
164 | 164 | { |
165 | 165 | $this->result['@text'] = $text; |
166 | 166 | } |