@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $pathString = AbstractPathInfo::type2string($path); |
32 | 32 | |
33 | - if(!isset(self::$infoCache[$pathString])) |
|
33 | + if (!isset(self::$infoCache[$pathString])) |
|
34 | 34 | { |
35 | 35 | self::$infoCache[$pathString] = new FolderInfo($pathString); |
36 | 36 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | parent::__construct($path); |
61 | 61 | |
62 | - if(!self::is_dir($this->path)) |
|
62 | + if (!self::is_dir($this->path)) |
|
63 | 63 | { |
64 | 64 | throw new FileHelper_Exception( |
65 | 65 | 'Not a folder', |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | { |
82 | 82 | $path = trim($path); |
83 | 83 | |
84 | - if($path === '' || $path === '.' || $path === '..') |
|
84 | + if ($path === '' || $path === '.' || $path === '..') |
|
85 | 85 | { |
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | |
89 | - if(is_dir($path)) |
|
89 | + if (is_dir($path)) |
|
90 | 90 | { |
91 | 91 | return true; |
92 | 92 | } |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function delete() : FolderInfo |
106 | 106 | { |
107 | - if(!$this->exists()) |
|
107 | + if (!$this->exists()) |
|
108 | 108 | { |
109 | 109 | return $this; |
110 | 110 | } |
111 | 111 | |
112 | - if(rmdir($this->path)) |
|
112 | + if (rmdir($this->path)) |
|
113 | 113 | { |
114 | 114 | return $this; |
115 | 115 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function create() : FolderInfo |
137 | 137 | { |
138 | - if(is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path)) |
|
138 | + if (is_dir($this->path) || mkdir($this->path, 0777, true) || is_dir($this->path)) |
|
139 | 139 | { |
140 | 140 | return $this; |
141 | 141 | } |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | return FileHelper::createFolder($this->getPath().'/'.$name); |
186 | 186 | } |
187 | 187 | |
188 | - public function saveFile(string $fileName, string $content='') : FileInfo |
|
188 | + public function saveFile(string $fileName, string $content = '') : FileInfo |
|
189 | 189 | { |
190 | 190 | return FileHelper::saveFile($this.'/'.$fileName, $content); |
191 | 191 | } |
192 | 192 | |
193 | - public function saveJSONFile(array $data, string $fileName, bool $pretty=false) : JSONFile |
|
193 | + public function saveJSONFile(array $data, string $fileName, bool $pretty = false) : JSONFile |
|
194 | 194 | { |
195 | 195 | return FileHelper::saveAsJSON($data, $this.'/'.$fileName, $pretty); |
196 | 196 | } |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | $this->subject = $subject; |
28 | 28 | } |
29 | 29 | |
30 | - public function setRemoveDuplicates(bool $remove=true, bool $caseInsensitive=false) : self |
|
30 | + public function setRemoveDuplicates(bool $remove = true, bool $caseInsensitive = false) : self |
|
31 | 31 | { |
32 | 32 | $this->removeDuplicates = $remove; |
33 | 33 | $this->duplicatesCaseInsensitive = $caseInsensitive; |
34 | 34 | return $this; |
35 | 35 | } |
36 | 36 | |
37 | - public function setSorting(bool $sorting=true) : self |
|
37 | + public function setSorting(bool $sorting = true) : self |
|
38 | 38 | { |
39 | 39 | $this->sorting = $sorting; |
40 | 40 | return $this; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | |
53 | 53 | $words = $this->filterEmpty($words); |
54 | 54 | |
55 | - if($this->removeDuplicates) { |
|
55 | + if ($this->removeDuplicates) { |
|
56 | 56 | $words = $this->filterDuplicates($words); |
57 | 57 | } |
58 | 58 | |
59 | - if($this->sorting) { |
|
59 | + if ($this->sorting) { |
|
60 | 60 | usort($words, 'strnatcasecmp'); |
61 | 61 | } |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | |
66 | 66 | private function filterDuplicates(array $words) : array |
67 | 67 | { |
68 | - if($this->duplicatesCaseInsensitive) { |
|
68 | + if ($this->duplicatesCaseInsensitive) { |
|
69 | 69 | return $this->filterDuplicatesCaseInsensitive($words); |
70 | 70 | } |
71 | 71 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | return array_intersect_key( |
78 | 78 | $array, |
79 | - array_unique( array_map( "strtolower", $array ) ) |
|
79 | + array_unique(array_map("strtolower", $array)) |
|
80 | 80 | ); |
81 | 81 | } |
82 | 82 | |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 89 | $keep = array(); |
90 | 90 | |
91 | - foreach($words as $word) |
|
91 | + foreach ($words as $word) |
|
92 | 92 | { |
93 | - if(empty($word)) { |
|
93 | + if (empty($word)) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | |
97 | - if(mb_strlen($word) < $this->minWordLength) { |
|
97 | + if (mb_strlen($word) < $this->minWordLength) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 |
@@ -122,7 +122,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -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 | } |
@@ -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 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * the vendor name, for example (Vendor\PackageName\Folder\Class). |
40 | 40 | * @return string|null The detected class name, or NULL otherwise. |
41 | 41 | */ |
42 | - public static function resolveClassName(string $legacyName, string $nsPrefix='') : ?string |
|
42 | + public static function resolveClassName(string $legacyName, string $nsPrefix = '') : ?string |
|
43 | 43 | { |
44 | 44 | $names = array( |
45 | 45 | str_replace('\\', '_', $legacyName), |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $nsPrefix.'\\'.str_replace('_', '\\', $legacyName) |
48 | 48 | ); |
49 | 49 | |
50 | - foreach($names as $name) { |
|
50 | + foreach ($names as $name) { |
|
51 | 51 | if (class_exists($name)) { |
52 | 52 | return ltrim($name, '\\'); |
53 | 53 | } |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @return string |
67 | 67 | * @throws ClassNotExistsException |
68 | 68 | */ |
69 | - public static function requireResolvedClass(string $legacyName, string $nsPrefix='') : string |
|
69 | + public static function requireResolvedClass(string $legacyName, string $nsPrefix = '') : string |
|
70 | 70 | { |
71 | 71 | $class = self::resolveClassName($legacyName, $nsPrefix); |
72 | 72 | |
73 | - if($class !== null) |
|
73 | + if ($class !== null) |
|
74 | 74 | { |
75 | 75 | return $class; |
76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function requireClassExists(string $className) : void |
92 | 92 | { |
93 | - if(class_exists($className)) |
|
93 | + if (class_exists($className)) |
|
94 | 94 | { |
95 | 95 | return; |
96 | 96 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | self::requireClassExists($targetClass); |
116 | 116 | self::requireClassExists($extendsClass); |
117 | 117 | |
118 | - if(is_a($targetClass, $extendsClass, true)) |
|
118 | + if (is_a($targetClass, $extendsClass, true)) |
|
119 | 119 | { |
120 | 120 | return; |
121 | 121 | } |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | * @throws ClassNotExistsException |
137 | 137 | * @throws ClassNotImplementsException |
138 | 138 | */ |
139 | - public static function requireObjectInstanceOf(string $class, object $object, int $errorCode=0) |
|
139 | + public static function requireObjectInstanceOf(string $class, object $object, int $errorCode = 0) |
|
140 | 140 | { |
141 | - if(!class_exists($class) && !interface_exists($class) && !trait_exists($class)) |
|
141 | + if (!class_exists($class) && !interface_exists($class) && !trait_exists($class)) |
|
142 | 142 | { |
143 | 143 | throw new ClassNotExistsException($class, $errorCode); |
144 | 144 | } |
145 | 145 | |
146 | - if(is_a($object, $class, true)) |
|
146 | + if (is_a($object, $class, true)) |
|
147 | 147 | { |
148 | 148 | return $object; |
149 | 149 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public static function getClassLoader() : ClassLoader |
166 | 166 | { |
167 | - if(isset(self::$classLoader)) { |
|
167 | + if (isset(self::$classLoader)) { |
|
168 | 168 | return self::$classLoader; |
169 | 169 | } |
170 | 170 | |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | |
179 | 179 | $autoloadFile = null; |
180 | 180 | |
181 | - foreach($paths as $path) |
|
181 | + foreach ($paths as $path) |
|
182 | 182 | { |
183 | - if(file_exists($path)) { |
|
183 | + if (file_exists($path)) { |
|
184 | 184 | $autoloadFile = $path; |
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if($autoloadFile === null) { |
|
188 | + if ($autoloadFile === null) { |
|
189 | 189 | throw new ClassLoaderNotFoundException($paths); |
190 | 190 | } |
191 | 191 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | private static function splitClass($subject) : array |
238 | 238 | { |
239 | - if(is_object($subject)) { |
|
239 | + if (is_object($subject)) { |
|
240 | 240 | $class = get_class($subject); |
241 | 241 | } else { |
242 | 242 | $class = $subject; |