@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | protected function _validate() |
29 | 29 | { |
30 | - if(!is_scalar($this->value)) { |
|
30 | + if (!is_scalar($this->value)) { |
|
31 | 31 | return null; |
32 | 32 | } |
33 | 33 | |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | // is a boolan, which is converted to an integer when |
36 | 36 | // converted to string, which in turn can be validated |
37 | 37 | // with a regex. |
38 | - if(is_bool($this->value)) { |
|
38 | + if (is_bool($this->value)) { |
|
39 | 39 | return null; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $value = (string)$this->value; |
43 | 43 | |
44 | - if(preg_match($this->getStringOption('regex'), $value)) { |
|
44 | + if (preg_match($this->getStringOption('regex'), $value)) { |
|
45 | 45 | return $value; |
46 | 46 | } |
47 | 47 |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | protected function _validate() |
31 | 31 | { |
32 | - if(in_array($this->value, $this->getArrayOption('values'))) { |
|
32 | + if (in_array($this->value, $this->getArrayOption('values'))) { |
|
33 | 33 | return $this->value; |
34 | 34 | } |
35 | 35 |
@@ -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; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $string = ''; |
12 | 12 | |
13 | - if(is_string($this->value[0])) |
|
13 | + if (is_string($this->value[0])) |
|
14 | 14 | { |
15 | 15 | $string .= $this->value[0].'::'; |
16 | 16 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | $result = array(); |
12 | 12 | |
13 | - foreach($this->value as $key => $val) |
|
13 | + foreach ($this->value as $key => $val) |
|
14 | 14 | { |
15 | 15 | $result[$key] = parseVariable($val)->toString(); |
16 | 16 | } |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param mixed $value |
39 | 39 | * @param array|null $serialized |
40 | 40 | */ |
41 | - public function __construct($value, $serialized=null) |
|
41 | + public function __construct($value, $serialized = null) |
|
42 | 42 | { |
43 | - if(is_array($serialized)) |
|
43 | + if (is_array($serialized)) |
|
44 | 44 | { |
45 | 45 | $this->parseSerialized($serialized); |
46 | 46 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $this->value = $value; |
89 | 89 | $this->type = strtolower(gettype($value)); |
90 | 90 | |
91 | - if(is_array($value) && is_callable($value)) { |
|
91 | + if (is_array($value) && is_callable($value)) { |
|
92 | 92 | $this->type = self::TYPE_CALLABLE; |
93 | 93 | } |
94 | 94 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param bool $enable |
127 | 127 | * @return VariableInfo |
128 | 128 | */ |
129 | - public function enableType(bool $enable=true) : VariableInfo |
|
129 | + public function enableType(bool $enable = true) : VariableInfo |
|
130 | 130 | { |
131 | 131 | return $this->setOption('prepend-type', $enable); |
132 | 132 | } |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | { |
136 | 136 | $converted = $this->string; |
137 | 137 | |
138 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
138 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
139 | 139 | { |
140 | - if($this->isString()) |
|
140 | + if ($this->isString()) |
|
141 | 141 | { |
142 | 142 | $converted = '"'.$converted.'"'; |
143 | 143 | } |
@@ -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 | } |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | * @param mixed $value |
17 | 17 | * @return \AppUtils\NumberInfo |
18 | 18 | */ |
19 | -function parseNumber($value, $forceNew=false) |
|
19 | +function parseNumber($value, $forceNew = false) |
|
20 | 20 | { |
21 | - if($value instanceof NumberInfo && $forceNew !== true) { |
|
21 | + if ($value instanceof NumberInfo && $forceNew !== true) { |
|
22 | 22 | return $value; |
23 | 23 | } |
24 | 24 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $args = func_get_args(); |
100 | 100 | |
101 | 101 | // is the localization package installed? |
102 | - if(class_exists('\AppLocalize\Localization')) |
|
102 | + if (class_exists('\AppLocalize\Localization')) |
|
103 | 103 | { |
104 | 104 | return call_user_func_array('\AppLocalize\t', $args); |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | function requireCURL() : void |
119 | 119 | { |
120 | - if(function_exists('curl_init')) { |
|
120 | + if (function_exists('curl_init')) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function init() |
137 | 137 | { |
138 | - if(!class_exists('\AppLocalize\Localization')) { |
|
138 | + if (!class_exists('\AppLocalize\Localization')) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @see FileHelper_FileFinder |
8 | 8 | */ |
9 | 9 | |
10 | -declare(strict_types = 1); |
|
10 | +declare(strict_types=1); |
|
11 | 11 | |
12 | 12 | namespace AppUtils; |
13 | 13 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $real = realpath($path); |
57 | 57 | |
58 | - if($real === false) |
|
58 | + if ($real === false) |
|
59 | 59 | { |
60 | 60 | throw new FileHelper_Exception( |
61 | 61 | 'Target path does not exist', |
@@ -290,22 +290,22 @@ discard block |
||
290 | 290 | return $this->getAll(); |
291 | 291 | } |
292 | 292 | |
293 | - protected function find(string $path, bool $isRoot=false) : void |
|
293 | + protected function find(string $path, bool $isRoot = false) : void |
|
294 | 294 | { |
295 | - if($isRoot) { |
|
295 | + if ($isRoot) { |
|
296 | 296 | $this->found = array(); |
297 | 297 | } |
298 | 298 | |
299 | 299 | $recursive = $this->getBoolOption('recursive'); |
300 | 300 | |
301 | 301 | $d = new \DirectoryIterator($path); |
302 | - foreach($d as $item) |
|
302 | + foreach ($d as $item) |
|
303 | 303 | { |
304 | 304 | $pathname = $item->getPathname(); |
305 | 305 | |
306 | - if($item->isDir()) |
|
306 | + if ($item->isDir()) |
|
307 | 307 | { |
308 | - if($recursive && !$item->isDot()) { |
|
308 | + if ($recursive && !$item->isDot()) { |
|
309 | 309 | $this->find($pathname); |
310 | 310 | } |
311 | 311 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | $file = $this->filterFile($pathname); |
316 | 316 | |
317 | - if($file !== null) |
|
317 | + if ($file !== null) |
|
318 | 318 | { |
319 | 319 | $this->found[] = $file; |
320 | 320 | } |
@@ -327,23 +327,23 @@ discard block |
||
327 | 327 | |
328 | 328 | $extension = FileHelper::getExtension($path); |
329 | 329 | |
330 | - if(!$this->filterExclusion($extension)) { |
|
330 | + if (!$this->filterExclusion($extension)) { |
|
331 | 331 | return null; |
332 | 332 | } |
333 | 333 | |
334 | 334 | $path = $this->filterPath($path); |
335 | 335 | |
336 | - if($this->getOption('strip-extensions') === true) |
|
336 | + if ($this->getOption('strip-extensions') === true) |
|
337 | 337 | { |
338 | 338 | $path = str_replace('.'.$extension, '', $path); |
339 | 339 | } |
340 | 340 | |
341 | - if($path === '') { |
|
341 | + if ($path === '') { |
|
342 | 342 | return null; |
343 | 343 | } |
344 | 344 | |
345 | 345 | $replace = $this->getOption('slash-replacement'); |
346 | - if(!empty($replace)) { |
|
346 | + if (!empty($replace)) { |
|
347 | 347 | $path = str_replace('/', $replace, $path); |
348 | 348 | } |
349 | 349 | |
@@ -362,15 +362,15 @@ discard block |
||
362 | 362 | $include = $this->getOption('include-extensions'); |
363 | 363 | $exclude = $this->getOption('exclude-extensions'); |
364 | 364 | |
365 | - if(!empty($include)) |
|
365 | + if (!empty($include)) |
|
366 | 366 | { |
367 | - if(!in_array($extension, $include)) { |
|
367 | + if (!in_array($extension, $include)) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | } |
371 | - else if(!empty($exclude)) |
|
371 | + else if (!empty($exclude)) |
|
372 | 372 | { |
373 | - if(in_array($extension, $exclude)) { |
|
373 | + if (in_array($extension, $exclude)) { |
|
374 | 374 | return false; |
375 | 375 | } |
376 | 376 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | */ |
387 | 387 | protected function filterPath(string $path) : string |
388 | 388 | { |
389 | - switch($this->getStringOption('pathmode')) |
|
389 | + switch ($this->getStringOption('pathmode')) |
|
390 | 390 | { |
391 | 391 | case self::PATH_MODE_STRIP: |
392 | 392 | return basename($path); |