@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function depth($levels) |
124 | 124 | { |
125 | - foreach ((array) $levels as $level) { |
|
125 | + foreach ((array)$levels as $level) { |
|
126 | 126 | $this->depths[] = new Comparator\NumberComparator($level); |
127 | 127 | } |
128 | 128 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function date($dates) |
152 | 152 | { |
153 | - foreach ((array) $dates as $date) { |
|
153 | + foreach ((array)$dates as $date) { |
|
154 | 154 | $this->dates[] = new Comparator\DateComparator($date); |
155 | 155 | } |
156 | 156 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function name($patterns) |
177 | 177 | { |
178 | - $this->names = array_merge($this->names, (array) $patterns); |
|
178 | + $this->names = array_merge($this->names, (array)$patterns); |
|
179 | 179 | |
180 | 180 | return $this; |
181 | 181 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function notName($patterns) |
193 | 193 | { |
194 | - $this->notNames = array_merge($this->notNames, (array) $patterns); |
|
194 | + $this->notNames = array_merge($this->notNames, (array)$patterns); |
|
195 | 195 | |
196 | 196 | return $this; |
197 | 197 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function contains($patterns) |
215 | 215 | { |
216 | - $this->contains = array_merge($this->contains, (array) $patterns); |
|
216 | + $this->contains = array_merge($this->contains, (array)$patterns); |
|
217 | 217 | |
218 | 218 | return $this; |
219 | 219 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function notContains($patterns) |
237 | 237 | { |
238 | - $this->notContains = array_merge($this->notContains, (array) $patterns); |
|
238 | + $this->notContains = array_merge($this->notContains, (array)$patterns); |
|
239 | 239 | |
240 | 240 | return $this; |
241 | 241 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function path($patterns) |
261 | 261 | { |
262 | - $this->paths = array_merge($this->paths, (array) $patterns); |
|
262 | + $this->paths = array_merge($this->paths, (array)$patterns); |
|
263 | 263 | |
264 | 264 | return $this; |
265 | 265 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | */ |
284 | 284 | public function notPath($patterns) |
285 | 285 | { |
286 | - $this->notPaths = array_merge($this->notPaths, (array) $patterns); |
|
286 | + $this->notPaths = array_merge($this->notPaths, (array)$patterns); |
|
287 | 287 | |
288 | 288 | return $this; |
289 | 289 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | */ |
306 | 306 | public function size($sizes) |
307 | 307 | { |
308 | - foreach ((array) $sizes as $size) { |
|
308 | + foreach ((array)$sizes as $size) { |
|
309 | 309 | $this->sizes[] = new Comparator\NumberComparator($size); |
310 | 310 | } |
311 | 311 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function exclude($dirs) |
329 | 329 | { |
330 | - $this->exclude = array_merge($this->exclude, (array) $dirs); |
|
330 | + $this->exclude = array_merge($this->exclude, (array)$dirs); |
|
331 | 331 | |
332 | 332 | return $this; |
333 | 333 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public static function addVCSPattern($pattern) |
401 | 401 | { |
402 | - foreach ((array) $pattern as $p) { |
|
402 | + foreach ((array)$pattern as $p) { |
|
403 | 403 | self::$vcsPatterns[] = $p; |
404 | 404 | } |
405 | 405 | |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | { |
581 | 581 | $resolvedDirs = []; |
582 | 582 | |
583 | - foreach ((array) $dirs as $dir) { |
|
583 | + foreach ((array)$dirs as $dir) { |
|
584 | 584 | if (is_dir($dir)) { |
585 | 585 | $resolvedDirs[] = $this->normalizeDir($dir); |
586 | 586 | } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) { |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | |
624 | 624 | $iterator = new \AppendIterator(); |
625 | 625 | foreach ($this->dirs as $dir) { |
626 | - $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) { |
|
626 | + $iterator->append(new \IteratorIterator(new LazyIterator(function() use ($dir) { |
|
627 | 627 | return $this->searchInDirectory($dir); |
628 | 628 | }))); |
629 | 629 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | return $dir; |
796 | 796 | } |
797 | 797 | |
798 | - $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); |
|
798 | + $dir = rtrim($dir, '/' . \DIRECTORY_SEPARATOR); |
|
799 | 799 | |
800 | 800 | if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) { |
801 | 801 | $dir .= '/'; |
@@ -53,6 +53,6 @@ |
||
53 | 53 | */ |
54 | 54 | protected function toRegex(string $str) |
55 | 55 | { |
56 | - return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; |
|
56 | + return $this->isRegex($str) ? $str : '/' . preg_quote($str, '/') . '/'; |
|
57 | 57 | } |
58 | 58 | } |
@@ -51,6 +51,6 @@ |
||
51 | 51 | */ |
52 | 52 | protected function toRegex(string $str) |
53 | 53 | { |
54 | - return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; |
|
54 | + return $this->isRegex($str) ? $str : '/' . preg_quote($str, '/') . '/'; |
|
55 | 55 | } |
56 | 56 | } |
@@ -41,15 +41,15 @@ discard block |
||
41 | 41 | $order = $reverseOrder ? -1 : 1; |
42 | 42 | |
43 | 43 | if (self::SORT_BY_NAME === $sort) { |
44 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
44 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
45 | 45 | return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); |
46 | 46 | }; |
47 | 47 | } elseif (self::SORT_BY_NAME_NATURAL === $sort) { |
48 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
48 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
49 | 49 | return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); |
50 | 50 | }; |
51 | 51 | } elseif (self::SORT_BY_TYPE === $sort) { |
52 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
52 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
53 | 53 | if ($a->isDir() && $b->isFile()) { |
54 | 54 | return -$order; |
55 | 55 | } elseif ($a->isFile() && $b->isDir()) { |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname()); |
60 | 60 | }; |
61 | 61 | } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { |
62 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
62 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
63 | 63 | return $order * ($a->getATime() - $b->getATime()); |
64 | 64 | }; |
65 | 65 | } elseif (self::SORT_BY_CHANGED_TIME === $sort) { |
66 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
66 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
67 | 67 | return $order * ($a->getCTime() - $b->getCTime()); |
68 | 68 | }; |
69 | 69 | } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { |
70 | - $this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
70 | + $this->sort = static function(\SplFileInfo $a, \SplFileInfo $b) use ($order) { |
|
71 | 71 | return $order * ($a->getMTime() - $b->getMTime()); |
72 | 72 | }; |
73 | 73 | } elseif (self::SORT_BY_NONE === $sort) { |
74 | 74 | $this->sort = $order; |
75 | 75 | } elseif (\is_callable($sort)) { |
76 | - $this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort; |
|
76 | + $this->sort = $reverseOrder ? static function(\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort; |
|
77 | 77 | } else { |
78 | 78 | throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); |
79 | 79 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | // the logic here avoids redoing the same work in all iterations |
64 | 64 | |
65 | 65 | if (null === $subPathname = $this->subPath) { |
66 | - $subPathname = $this->subPath = (string) $this->getSubPath(); |
|
66 | + $subPathname = $this->subPath = (string)$this->getSubPath(); |
|
67 | 67 | } |
68 | 68 | if ('' !== $subPathname) { |
69 | 69 | $subPathname .= $this->directorySeparator; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $basePath .= $this->directorySeparator; |
75 | 75 | } |
76 | 76 | |
77 | - return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname); |
|
77 | + return new SplFileInfo($basePath . $subPathname, $this->subPath, $subPathname); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -41,7 +41,7 @@ |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | if ($patterns) { |
44 | - $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#'; |
|
44 | + $this->excludedPattern = '#(?:^|/)(?:' . implode('|', $patterns) . ')(?:/|$)#'; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | parent::__construct($iterator); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | public function getContents() |
75 | 75 | { |
76 | - set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); |
|
76 | + set_error_handler(function($type, $msg) use (&$error) { $error = $msg; }); |
|
77 | 77 | $content = file_get_contents($this->getPathname()); |
78 | 78 | restore_error_handler(); |
79 | 79 | if (false === $content) { |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | |
56 | 56 | $firstByte = '/' === $car; |
57 | 57 | |
58 | - if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) { |
|
58 | + if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1] . $glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) { |
|
59 | 59 | $car = '[^/]++/'; |
60 | 60 | if (!isset($glob[$i + 3])) { |
61 | 61 | $car .= '?'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | if ($strictLeadingDot) { |
65 | - $car = '(?=[^\.])'.$car; |
|
65 | + $car = '(?=[^\.])' . $car; |
|
66 | 66 | } |
67 | 67 | |
68 | - $car = '/(?:'.$car.')*'; |
|
68 | + $car = '/(?:' . $car . ')*'; |
|
69 | 69 | $i += 2 + isset($glob[$i + 3]); |
70 | 70 | |
71 | 71 | if ('/' === $delimiter) { |
@@ -106,6 +106,6 @@ discard block |
||
106 | 106 | $escaping = false; |
107 | 107 | } |
108 | 108 | |
109 | - return $delimiter.'^'.$regex.'$'.$delimiter; |
|
109 | + return $delimiter . '^' . $regex . '$' . $delimiter; |
|
110 | 110 | } |
111 | 111 | } |
@@ -30,14 +30,14 @@ |
||
30 | 30 | { |
31 | 31 | $ns = microtime(false); |
32 | 32 | $s = substr($ns, 11) - self::$startAt; |
33 | - $ns = 1E9 * (float) $ns; |
|
33 | + $ns = 1E9 * (float)$ns; |
|
34 | 34 | |
35 | 35 | if ($asNum) { |
36 | 36 | $ns += $s * 1E9; |
37 | 37 | |
38 | - return \PHP_INT_SIZE === 4 ? $ns : (int) $ns; |
|
38 | + return \PHP_INT_SIZE === 4 ? $ns : (int)$ns; |
|
39 | 39 | } |
40 | 40 | |
41 | - return [$s, (int) $ns]; |
|
41 | + return [$s, (int)$ns]; |
|
42 | 42 | } |
43 | 43 | } |