@@ -33,7 +33,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | * @param int|NULL $code |
32 | 32 | * @param Throwable|NULL $previous |
33 | 33 | */ |
34 | - public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null) |
|
34 | + public function __construct(string $message, ?string $details = null, ?int $code = null, ?Throwable $previous = null) |
|
35 | 35 | { |
36 | - if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
36 | + if (defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
37 | 37 | { |
38 | 38 | $message .= PHP_EOL.$details; |
39 | 39 | } |
40 | 40 | |
41 | - if($code === null) |
|
41 | + if ($code === null) |
|
42 | 42 | { |
43 | 43 | $code = 0; |
44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function display() : void |
64 | 64 | { |
65 | - if(!headers_sent()) { |
|
65 | + if (!headers_sent()) { |
|
66 | 66 | header('Content-type:text/plain; charset=utf-8'); |
67 | 67 | } |
68 | 68 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | throw new BaseException(''); |
91 | 91 | } |
92 | - catch(BaseException $e) |
|
92 | + catch (BaseException $e) |
|
93 | 93 | { |
94 | 94 | echo self::createInfo($e)->toString(); |
95 | 95 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | throw new BaseException(''); |
106 | 106 | } |
107 | - catch(BaseException $e) |
|
107 | + catch (BaseException $e) |
|
108 | 108 | { |
109 | 109 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
110 | 110 | echo self::createInfo($e)->toString(); |
@@ -22,7 +22,7 @@ |
||
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 |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | $this->detectNamespace($code); |
127 | 127 | $result = $this->detectMatches($code); |
128 | 128 | |
129 | - if($result === null) { |
|
129 | + if ($result === null) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $indexes = array_keys($result[0]); |
134 | 134 | |
135 | - foreach($indexes as $idx) |
|
135 | + foreach ($indexes as $idx) |
|
136 | 136 | { |
137 | 137 | $this->parseResult( |
138 | 138 | $result[1][$idx], |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | preg_match_all('/(abstract|final)\s+('.$types.')\s+([\sa-z\d\\\\_,]+){|('.$types.')\s+([\sa-z\d\\\\_,]+){/ix', $code, $result, PREG_PATTERN_ORDER); |
153 | 153 | |
154 | - if(isset($result[0][0])) { |
|
154 | + if (isset($result[0][0])) { |
|
155 | 155 | return $result; |
156 | 156 | } |
157 | 157 | |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | $result = array(); |
164 | 164 | preg_match_all('/namespace\s+([^;]+);/ix', $code, $result, PREG_PATTERN_ORDER); |
165 | 165 | |
166 | - if(isset($result[0][0])) { |
|
166 | + if (isset($result[0][0])) { |
|
167 | 167 | $this->namespace = trim($result[1][0]); |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | 171 | private function parseResult(string $keyword, string $declaration, string $type, string $simpleType, string $simpleDeclaration) : void |
172 | 172 | { |
173 | - if(empty($keyword)) { |
|
173 | + if (empty($keyword)) { |
|
174 | 174 | $type = $simpleType; |
175 | 175 | $declaration = $simpleDeclaration; |
176 | 176 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public static function factory($path) : FileInfo |
52 | 52 | { |
53 | - if($path instanceof self) { |
|
53 | + if ($path instanceof self) { |
|
54 | 54 | return $path; |
55 | 55 | } |
56 | 56 | |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | $pathString = AbstractPathInfo::type2string($path); |
68 | 68 | $key = $pathString.';'.static::class; |
69 | 69 | |
70 | - if(!isset(self::$infoCache[$key])) |
|
70 | + if (!isset(self::$infoCache[$key])) |
|
71 | 71 | { |
72 | 72 | $class = static::class; |
73 | 73 | $instance = new $class($pathString); |
74 | 74 | |
75 | - if(!$instance instanceof self) { |
|
75 | + if (!$instance instanceof self) { |
|
76 | 76 | throw new FileHelper_Exception( |
77 | 77 | 'Invalid class' |
78 | 78 | ); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | parent::__construct($path); |
108 | 108 | |
109 | - if(!self::is_file($this->path)) |
|
109 | + if (!self::is_file($this->path)) |
|
110 | 110 | { |
111 | 111 | throw new FileHelper_Exception( |
112 | 112 | 'Not a file path', |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $path = trim($path); |
122 | 122 | |
123 | - if(empty($path)) |
|
123 | + if (empty($path)) |
|
124 | 124 | { |
125 | 125 | return false; |
126 | 126 | } |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | return is_file($path) || pathinfo($path, PATHINFO_EXTENSION) !== ''; |
129 | 129 | } |
130 | 130 | |
131 | - public function removeExtension(bool $keepPath=false) : string |
|
131 | + public function removeExtension(bool $keepPath = false) : string |
|
132 | 132 | { |
133 | - if(!$keepPath) |
|
133 | + if (!$keepPath) |
|
134 | 134 | { |
135 | 135 | return (string)pathinfo($this->getName(), PATHINFO_FILENAME); |
136 | 136 | } |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | return $this->removeExtension(); |
156 | 156 | } |
157 | 157 | |
158 | - public function getExtension(bool $lowercase=true) : string |
|
158 | + public function getExtension(bool $lowercase = true) : string |
|
159 | 159 | { |
160 | 160 | $ext = (string)pathinfo($this->path, PATHINFO_EXTENSION); |
161 | 161 | |
162 | - if($lowercase) |
|
162 | + if ($lowercase) |
|
163 | 163 | { |
164 | 164 | $ext = mb_strtolower($ext); |
165 | 165 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public function delete() : FileInfo |
182 | 182 | { |
183 | - if(!$this->exists()) |
|
183 | + if (!$this->exists()) |
|
184 | 184 | { |
185 | 185 | return $this; |
186 | 186 | } |
187 | 187 | |
188 | - if(unlink($this->path)) |
|
188 | + if (unlink($this->path)) |
|
189 | 189 | { |
190 | 190 | return $this; |
191 | 191 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | { |
213 | 213 | $target = $this->checkCopyPrerequisites($targetPath); |
214 | 214 | |
215 | - if(copy($this->path, (string)$target)) |
|
215 | + if (copy($this->path, (string)$target)) |
|
216 | 216 | { |
217 | 217 | return $target; |
218 | 218 | } |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | public function getLineReader() : LineReader |
266 | 266 | { |
267 | - if($this->lineReader === null) |
|
267 | + if ($this->lineReader === null) |
|
268 | 268 | { |
269 | 269 | $this->lineReader = new LineReader($this); |
270 | 270 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $result = file_get_contents($this->getPath()); |
285 | 285 | |
286 | - if($result !== false) { |
|
286 | + if ($result !== false) { |
|
287 | 287 | return $result; |
288 | 288 | } |
289 | 289 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function putContents(string $content) : FileInfo |
307 | 307 | { |
308 | - if($this->exists()) |
|
308 | + if ($this->exists()) |
|
309 | 309 | { |
310 | 310 | $this->requireWritable(); |
311 | 311 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ->requireWritable(); |
317 | 317 | } |
318 | 318 | |
319 | - if(file_put_contents($this->path, $content) !== false) |
|
319 | + if (file_put_contents($this->path, $content) !== false) |
|
320 | 320 | { |
321 | 321 | return $this; |
322 | 322 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | private function createFolder() : FileInfo |
348 | 348 | { |
349 | - if(!$this->exists()) |
|
349 | + if (!$this->exists()) |
|
350 | 350 | { |
351 | 351 | FolderInfo::factory($this->getFolderPath()) |
352 | 352 | ->create() |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | protected bool $value = false; |
23 | 23 | |
24 | - public function __construct(bool $value=false) |
|
24 | + public function __construct(bool $value = false) |
|
25 | 25 | { |
26 | 26 | $this->value = $value; |
27 | 27 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | private function addFont(string $name) : FontFamily |
34 | 34 | { |
35 | - if(!in_array($name, $this->fonts, true)) |
|
35 | + if (!in_array($name, $this->fonts, true)) |
|
36 | 36 | { |
37 | 37 | $this->fonts[] = $name; |
38 | 38 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $result = array(); |
55 | 55 | |
56 | - foreach($this->headers as $header) |
|
56 | + foreach ($this->headers as $header) |
|
57 | 57 | { |
58 | 58 | $result[] = $header->getMimeType(); |
59 | 59 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | // we may be in a CLI environment where the headers |
70 | 70 | // are not populated. |
71 | - if(!isset($_SERVER['HTTP_ACCEPT'])) { |
|
71 | + if (!isset($_SERVER['HTTP_ACCEPT'])) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | $accept = array(); |
89 | 89 | |
90 | - foreach($tokens as $i => $term) |
|
90 | + foreach ($tokens as $i => $term) |
|
91 | 91 | { |
92 | 92 | $accept[] = $this->parseEntry($i, $term); |
93 | 93 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $quality = 0; |
110 | 110 | $params = array(); |
111 | 111 | |
112 | - if(strpos($mime, ';') !== false) |
|
112 | + if (strpos($mime, ';') !== false) |
|
113 | 113 | { |
114 | 114 | $parts = explode(';', $mime); |
115 | 115 | $mime = (string)array_shift($parts); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | // like a URL query string if separated by ampersands; |
119 | 119 | $params = ConvertHelper::parseQueryString(implode('&', $parts)); |
120 | 120 | |
121 | - if(isset($params['q'])) |
|
121 | + if (isset($params['q'])) |
|
122 | 122 | { |
123 | 123 | $quality = (double)$params['q']; |
124 | 124 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | */ |
92 | 92 | public function offsetSet($offset, $value) : void |
93 | 93 | { |
94 | - if(isset($this->data[$offset]) && gettype($this->data[$offset]) === gettype($value)) { |
|
94 | + if (isset($this->data[$offset]) && gettype($this->data[$offset]) === gettype($value)) { |
|
95 | 95 | $this->data[$offset] = $value; |
96 | 96 | } |
97 | 97 | } |