@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @throws \RuntimeException |
41 | 41 | */ |
42 | - public function __construct(string $path, int $flags, bool $ignoreUnreadableDirs = false) |
|
42 | + public function __construct( string $path, int $flags, bool $ignoreUnreadableDirs = false ) |
|
43 | 43 | { |
44 | - if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) { |
|
45 | - throw new \RuntimeException('This iterator only support returning current as fileinfo.'); |
|
44 | + if ( $flags & ( self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF ) ) { |
|
45 | + throw new \RuntimeException( 'This iterator only support returning current as fileinfo.' ); |
|
46 | 46 | } |
47 | 47 | |
48 | - parent::__construct($path, $flags); |
|
48 | + parent::__construct( $path, $flags ); |
|
49 | 49 | $this->ignoreUnreadableDirs = $ignoreUnreadableDirs; |
50 | 50 | $this->rootPath = $path; |
51 | - if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) { |
|
51 | + if ( '/' !== \DIRECTORY_SEPARATOR && ! ( $flags & self::UNIX_PATHS ) ) { |
|
52 | 52 | $this->directorySeparator = \DIRECTORY_SEPARATOR; |
53 | 53 | } |
54 | 54 | } |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | { |
64 | 64 | // the logic here avoids redoing the same work in all iterations |
65 | 65 | |
66 | - if (null === $subPathname = $this->subPath) { |
|
67 | - $subPathname = $this->subPath = (string) $this->getSubPath(); |
|
66 | + if ( null === $subPathname = $this->subPath ) { |
|
67 | + $subPathname = $this->subPath = (string)$this->getSubPath(); |
|
68 | 68 | } |
69 | - if ('' !== $subPathname) { |
|
69 | + if ( '' !== $subPathname ) { |
|
70 | 70 | $subPathname .= $this->directorySeparator; |
71 | 71 | } |
72 | 72 | $subPathname .= $this->getFilename(); |
73 | 73 | |
74 | - if ('/' !== $basePath = $this->rootPath) { |
|
74 | + if ( '/' !== $basePath = $this->rootPath ) { |
|
75 | 75 | $basePath .= $this->directorySeparator; |
76 | 76 | } |
77 | 77 | |
78 | - return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname); |
|
78 | + return new SplFileInfo( $basePath . $subPathname, $this->subPath, $subPathname ); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | try { |
90 | 90 | $children = parent::getChildren(); |
91 | 91 | |
92 | - if ($children instanceof self) { |
|
92 | + if ( $children instanceof self ) { |
|
93 | 93 | // parent method will call the constructor with default arguments, so unreadable dirs won't be ignored anymore |
94 | 94 | $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs; |
95 | 95 | |
@@ -99,12 +99,12 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | return $children; |
102 | - } catch (\UnexpectedValueException $e) { |
|
103 | - if ($this->ignoreUnreadableDirs) { |
|
102 | + } catch ( \UnexpectedValueException $e ) { |
|
103 | + if ( $this->ignoreUnreadableDirs ) { |
|
104 | 104 | // If directory is unreadable and finder is set to ignore it, a fake empty content is returned. |
105 | - return new \RecursiveArrayIterator([]); |
|
105 | + return new \RecursiveArrayIterator( [ ] ); |
|
106 | 106 | } else { |
107 | - throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e); |
|
107 | + throw new AccessDeniedException( $e->getMessage(), $e->getCode(), $e ); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | #[\ReturnTypeWillChange] |
118 | 118 | public function rewind() |
119 | 119 | { |
120 | - if (false === $this->isRewindable()) { |
|
120 | + if ( false === $this->isRewindable() ) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function isRewindable() |
133 | 133 | { |
134 | - if (null !== $this->rewindable) { |
|
134 | + if ( null !== $this->rewindable ) { |
|
135 | 135 | return $this->rewindable; |
136 | 136 | } |
137 | 137 | |
138 | - if (false !== $stream = @opendir($this->getPath())) { |
|
139 | - $infos = stream_get_meta_data($stream); |
|
140 | - closedir($stream); |
|
138 | + if ( false !== $stream = @opendir( $this->getPath() ) ) { |
|
139 | + $infos = stream_get_meta_data( $stream ); |
|
140 | + closedir( $stream ); |
|
141 | 141 | |
142 | - if ($infos['seekable']) { |
|
142 | + if ( $infos[ 'seekable' ] ) { |
|
143 | 143 | return $this->rewindable = true; |
144 | 144 | } |
145 | 145 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | { |
21 | 21 | private $iteratorFactory; |
22 | 22 | |
23 | - public function __construct(callable $iteratorFactory) |
|
23 | + public function __construct( callable $iteratorFactory ) |
|
24 | 24 | { |
25 | 25 | $this->iteratorFactory = $iteratorFactory; |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getIterator(): \Traversable |
29 | 29 | { |
30 | - yield from ($this->iteratorFactory)(); |
|
30 | + yield from ( $this->iteratorFactory )(); |
|
31 | 31 | } |
32 | 32 | } |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | */ |
21 | 21 | class SizeRangeFilterIterator extends \FilterIterator |
22 | 22 | { |
23 | - private $comparators = []; |
|
23 | + private $comparators = [ ]; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param \Iterator $iterator The Iterator to filter |
27 | 27 | * @param NumberComparator[] $comparators An array of NumberComparator instances |
28 | 28 | */ |
29 | - public function __construct(\Iterator $iterator, array $comparators) |
|
29 | + public function __construct( \Iterator $iterator, array $comparators ) |
|
30 | 30 | { |
31 | 31 | $this->comparators = $comparators; |
32 | 32 | |
33 | - parent::__construct($iterator); |
|
33 | + parent::__construct( $iterator ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | public function accept() |
43 | 43 | { |
44 | 44 | $fileinfo = $this->current(); |
45 | - if (!$fileinfo->isFile()) { |
|
45 | + if ( ! $fileinfo->isFile() ) { |
|
46 | 46 | return true; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $filesize = $fileinfo->getSize(); |
50 | - foreach ($this->comparators as $compare) { |
|
51 | - if (!$compare->test($filesize)) { |
|
50 | + foreach ( $this->comparators as $compare ) { |
|
51 | + if ( ! $compare->test( $filesize ) ) { |
|
52 | 52 | return false; |
53 | 53 | } |
54 | 54 | } |
@@ -18,25 +18,25 @@ discard block |
||
18 | 18 | */ |
19 | 19 | abstract class MultiplePcreFilterIterator extends \FilterIterator |
20 | 20 | { |
21 | - protected $matchRegexps = []; |
|
22 | - protected $noMatchRegexps = []; |
|
21 | + protected $matchRegexps = [ ]; |
|
22 | + protected $noMatchRegexps = [ ]; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * @param \Iterator $iterator The Iterator to filter |
26 | 26 | * @param string[] $matchPatterns An array of patterns that need to match |
27 | 27 | * @param string[] $noMatchPatterns An array of patterns that need to not match |
28 | 28 | */ |
29 | - public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns) |
|
29 | + public function __construct( \Iterator $iterator, array $matchPatterns, array $noMatchPatterns ) |
|
30 | 30 | { |
31 | - foreach ($matchPatterns as $pattern) { |
|
32 | - $this->matchRegexps[] = $this->toRegex($pattern); |
|
31 | + foreach ( $matchPatterns as $pattern ) { |
|
32 | + $this->matchRegexps[ ] = $this->toRegex( $pattern ); |
|
33 | 33 | } |
34 | 34 | |
35 | - foreach ($noMatchPatterns as $pattern) { |
|
36 | - $this->noMatchRegexps[] = $this->toRegex($pattern); |
|
35 | + foreach ( $noMatchPatterns as $pattern ) { |
|
36 | + $this->noMatchRegexps[ ] = $this->toRegex( $pattern ); |
|
37 | 37 | } |
38 | 38 | |
39 | - parent::__construct($iterator); |
|
39 | + parent::__construct( $iterator ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,19 +48,19 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return bool |
50 | 50 | */ |
51 | - protected function isAccepted(string $string) |
|
51 | + protected function isAccepted( string $string ) |
|
52 | 52 | { |
53 | 53 | // should at least not match one rule to exclude |
54 | - foreach ($this->noMatchRegexps as $regex) { |
|
55 | - if (preg_match($regex, $string)) { |
|
54 | + foreach ( $this->noMatchRegexps as $regex ) { |
|
55 | + if ( preg_match( $regex, $string ) ) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | 60 | // should at least match one rule |
61 | - if ($this->matchRegexps) { |
|
62 | - foreach ($this->matchRegexps as $regex) { |
|
63 | - if (preg_match($regex, $string)) { |
|
61 | + if ( $this->matchRegexps ) { |
|
62 | + foreach ( $this->matchRegexps as $regex ) { |
|
63 | + if ( preg_match( $regex, $string ) ) { |
|
64 | 64 | return true; |
65 | 65 | } |
66 | 66 | } |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | - protected function isRegex(string $str) |
|
80 | + protected function isRegex( string $str ) |
|
81 | 81 | { |
82 | - if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) { |
|
83 | - $start = substr($m[1], 0, 1); |
|
84 | - $end = substr($m[1], -1); |
|
82 | + if ( preg_match( '/^(.{3,}?)[imsxuADU]*$/', $str, $m ) ) { |
|
83 | + $start = substr( $m[ 1 ], 0, 1 ); |
|
84 | + $end = substr( $m[ 1 ], -1 ); |
|
85 | 85 | |
86 | - if ($start === $end) { |
|
87 | - return !preg_match('/[*?[:alnum:] \\\\]/', $start); |
|
86 | + if ( $start === $end ) { |
|
87 | + return ! preg_match( '/[*?[:alnum:] \\\\]/', $start ); |
|
88 | 88 | } |
89 | 89 | |
90 | - foreach ([['{', '}'], ['(', ')'], ['[', ']'], ['<', '>']] as $delimiters) { |
|
91 | - if ($start === $delimiters[0] && $end === $delimiters[1]) { |
|
90 | + foreach ( [ [ '{', '}' ], [ '(', ')' ], [ '[', ']' ], [ '<', '>' ] ] as $delimiters ) { |
|
91 | + if ( $start === $delimiters[ 0 ] && $end === $delimiters[ 1 ] ) { |
|
92 | 92 | return true; |
93 | 93 | } |
94 | 94 | } |
@@ -102,5 +102,5 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return string |
104 | 104 | */ |
105 | - abstract protected function toRegex(string $str); |
|
105 | + abstract protected function toRegex( string $str ); |
|
106 | 106 | } |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | { |
30 | 30 | $filename = $this->current()->getRelativePathname(); |
31 | 31 | |
32 | - if ('\\' === \DIRECTORY_SEPARATOR) { |
|
33 | - $filename = str_replace('\\', '/', $filename); |
|
32 | + if ( '\\' === \DIRECTORY_SEPARATOR ) { |
|
33 | + $filename = str_replace( '\\', '/', $filename ); |
|
34 | 34 | } |
35 | 35 | |
36 | - return $this->isAccepted($filename); |
|
36 | + return $this->isAccepted( $filename ); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return string regexp corresponding to a given string or regexp |
52 | 52 | */ |
53 | - protected function toRegex(string $str) |
|
53 | + protected function toRegex( string $str ) |
|
54 | 54 | { |
55 | - return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; |
|
55 | + return $this->isRegex( $str ) ? $str : '/' . preg_quote( $str, '/' ) . '/'; |
|
56 | 56 | } |
57 | 57 | } |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | * @param \Iterator $iterator The Iterator to filter |
28 | 28 | * @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES) |
29 | 29 | */ |
30 | - public function __construct(\Iterator $iterator, int $mode) |
|
30 | + public function __construct( \Iterator $iterator, int $mode ) |
|
31 | 31 | { |
32 | 32 | $this->mode = $mode; |
33 | 33 | |
34 | - parent::__construct($iterator); |
|
34 | + parent::__construct( $iterator ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | public function accept() |
44 | 44 | { |
45 | 45 | $fileinfo = $this->current(); |
46 | - if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) { |
|
46 | + if ( self::ONLY_DIRECTORIES === ( self::ONLY_DIRECTORIES & $this->mode ) && $fileinfo->isFile() ) { |
|
47 | 47 | return false; |
48 | - } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) { |
|
48 | + } elseif ( self::ONLY_FILES === ( self::ONLY_FILES & $this->mode ) && $fileinfo->isDir() ) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class CustomFilterIterator extends \FilterIterator |
23 | 23 | { |
24 | - private $filters = []; |
|
24 | + private $filters = [ ]; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param \Iterator $iterator The Iterator to filter |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @throws \InvalidArgumentException |
31 | 31 | */ |
32 | - public function __construct(\Iterator $iterator, array $filters) |
|
32 | + public function __construct( \Iterator $iterator, array $filters ) |
|
33 | 33 | { |
34 | - foreach ($filters as $filter) { |
|
35 | - if (!\is_callable($filter)) { |
|
36 | - throw new \InvalidArgumentException('Invalid PHP callback.'); |
|
34 | + foreach ( $filters as $filter ) { |
|
35 | + if ( ! \is_callable( $filter ) ) { |
|
36 | + throw new \InvalidArgumentException( 'Invalid PHP callback.' ); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | $this->filters = $filters; |
40 | 40 | |
41 | - parent::__construct($iterator); |
|
41 | + parent::__construct( $iterator ); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | { |
52 | 52 | $fileinfo = $this->current(); |
53 | 53 | |
54 | - foreach ($this->filters as $filter) { |
|
55 | - if (false === $filter($fileinfo)) { |
|
54 | + foreach ( $this->filters as $filter ) { |
|
55 | + if ( false === $filter( $fileinfo ) ) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | } |
@@ -40,59 +40,59 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return string |
42 | 42 | */ |
43 | - public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#') |
|
43 | + public static function toRegex( string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#' ) |
|
44 | 44 | { |
45 | 45 | $firstByte = true; |
46 | 46 | $escaping = false; |
47 | 47 | $inCurlies = 0; |
48 | 48 | $regex = ''; |
49 | - $sizeGlob = \strlen($glob); |
|
50 | - for ($i = 0; $i < $sizeGlob; ++$i) { |
|
51 | - $car = $glob[$i]; |
|
52 | - if ($firstByte && $strictLeadingDot && '.' !== $car) { |
|
49 | + $sizeGlob = \strlen( $glob ); |
|
50 | + for ( $i = 0; $i < $sizeGlob; ++$i ) { |
|
51 | + $car = $glob[ $i ]; |
|
52 | + if ( $firstByte && $strictLeadingDot && '.' !== $car ) { |
|
53 | 53 | $regex .= '(?=[^\.])'; |
54 | 54 | } |
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 | - if (!isset($glob[$i + 3])) { |
|
60 | + if ( ! isset( $glob[ $i + 3 ] ) ) { |
|
61 | 61 | $car .= '?'; |
62 | 62 | } |
63 | 63 | |
64 | - if ($strictLeadingDot) { |
|
65 | - $car = '(?=[^\.])'.$car; |
|
64 | + if ( $strictLeadingDot ) { |
|
65 | + $car = '(?=[^\.])' . $car; |
|
66 | 66 | } |
67 | 67 | |
68 | - $car = '/(?:'.$car.')*'; |
|
69 | - $i += 2 + isset($glob[$i + 3]); |
|
68 | + $car = '/(?:' . $car . ')*'; |
|
69 | + $i += 2 + isset( $glob[ $i + 3 ] ); |
|
70 | 70 | |
71 | - if ('/' === $delimiter) { |
|
72 | - $car = str_replace('/', '\\/', $car); |
|
71 | + if ( '/' === $delimiter ) { |
|
72 | + $car = str_replace( '/', '\\/', $car ); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) { |
|
76 | + if ( $delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car ) { |
|
77 | 77 | $regex .= "\\$car"; |
78 | - } elseif ('*' === $car) { |
|
79 | - $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*'); |
|
80 | - } elseif ('?' === $car) { |
|
81 | - $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.'); |
|
82 | - } elseif ('{' === $car) { |
|
78 | + } elseif ( '*' === $car ) { |
|
79 | + $regex .= $escaping ? '\\*' : ( $strictWildcardSlash ? '[^/]*' : '.*' ); |
|
80 | + } elseif ( '?' === $car ) { |
|
81 | + $regex .= $escaping ? '\\?' : ( $strictWildcardSlash ? '[^/]' : '.' ); |
|
82 | + } elseif ( '{' === $car ) { |
|
83 | 83 | $regex .= $escaping ? '\\{' : '('; |
84 | - if (!$escaping) { |
|
84 | + if ( ! $escaping ) { |
|
85 | 85 | ++$inCurlies; |
86 | 86 | } |
87 | - } elseif ('}' === $car && $inCurlies) { |
|
87 | + } elseif ( '}' === $car && $inCurlies ) { |
|
88 | 88 | $regex .= $escaping ? '}' : ')'; |
89 | - if (!$escaping) { |
|
89 | + if ( ! $escaping ) { |
|
90 | 90 | --$inCurlies; |
91 | 91 | } |
92 | - } elseif (',' === $car && $inCurlies) { |
|
92 | + } elseif ( ',' === $car && $inCurlies ) { |
|
93 | 93 | $regex .= $escaping ? ',' : '|'; |
94 | - } elseif ('\\' === $car) { |
|
95 | - if ($escaping) { |
|
94 | + } elseif ( '\\' === $car ) { |
|
95 | + if ( $escaping ) { |
|
96 | 96 | $regex .= '\\\\'; |
97 | 97 | $escaping = false; |
98 | 98 | } else { |
@@ -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 | } |
@@ -44,26 +44,26 @@ discard block |
||
44 | 44 | public const IGNORE_VCS_IGNORED_FILES = 4; |
45 | 45 | |
46 | 46 | private $mode = 0; |
47 | - private $names = []; |
|
48 | - private $notNames = []; |
|
49 | - private $exclude = []; |
|
50 | - private $filters = []; |
|
51 | - private $depths = []; |
|
52 | - private $sizes = []; |
|
47 | + private $names = [ ]; |
|
48 | + private $notNames = [ ]; |
|
49 | + private $exclude = [ ]; |
|
50 | + private $filters = [ ]; |
|
51 | + private $depths = [ ]; |
|
52 | + private $sizes = [ ]; |
|
53 | 53 | private $followLinks = false; |
54 | 54 | private $reverseSorting = false; |
55 | 55 | private $sort = false; |
56 | 56 | private $ignore = 0; |
57 | - private $dirs = []; |
|
58 | - private $dates = []; |
|
59 | - private $iterators = []; |
|
60 | - private $contains = []; |
|
61 | - private $notContains = []; |
|
62 | - private $paths = []; |
|
63 | - private $notPaths = []; |
|
57 | + private $dirs = [ ]; |
|
58 | + private $dates = [ ]; |
|
59 | + private $iterators = [ ]; |
|
60 | + private $contains = [ ]; |
|
61 | + private $notContains = [ ]; |
|
62 | + private $paths = [ ]; |
|
63 | + private $notPaths = [ ]; |
|
64 | 64 | private $ignoreUnreadableDirs = false; |
65 | 65 | |
66 | - private static $vcsPatterns = ['.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg']; |
|
66 | + private static $vcsPatterns = [ '.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg' ]; |
|
67 | 67 | |
68 | 68 | public function __construct() |
69 | 69 | { |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | * @see DepthRangeFilterIterator |
121 | 121 | * @see NumberComparator |
122 | 122 | */ |
123 | - public function depth($levels) |
|
123 | + public function depth( $levels ) |
|
124 | 124 | { |
125 | - foreach ((array) $levels as $level) { |
|
126 | - $this->depths[] = new Comparator\NumberComparator($level); |
|
125 | + foreach ( (array)$levels as $level ) { |
|
126 | + $this->depths[ ] = new Comparator\NumberComparator( $level ); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | return $this; |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | * @see DateRangeFilterIterator |
149 | 149 | * @see DateComparator |
150 | 150 | */ |
151 | - public function date($dates) |
|
151 | + public function date( $dates ) |
|
152 | 152 | { |
153 | - foreach ((array) $dates as $date) { |
|
154 | - $this->dates[] = new Comparator\DateComparator($date); |
|
153 | + foreach ( (array)$dates as $date ) { |
|
154 | + $this->dates[ ] = new Comparator\DateComparator( $date ); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $this; |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @see FilenameFilterIterator |
175 | 175 | */ |
176 | - public function name($patterns) |
|
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 | } |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @see FilenameFilterIterator |
191 | 191 | */ |
192 | - public function notName($patterns) |
|
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 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @see FilecontentFilterIterator |
213 | 213 | */ |
214 | - public function contains($patterns) |
|
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 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * |
234 | 234 | * @see FilecontentFilterIterator |
235 | 235 | */ |
236 | - public function notContains($patterns) |
|
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 | } |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @see FilenameFilterIterator |
259 | 259 | */ |
260 | - public function path($patterns) |
|
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 | } |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @see FilenameFilterIterator |
283 | 283 | */ |
284 | - public function notPath($patterns) |
|
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 | } |
@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | * @see SizeRangeFilterIterator |
304 | 304 | * @see NumberComparator |
305 | 305 | */ |
306 | - public function size($sizes) |
|
306 | + public function size( $sizes ) |
|
307 | 307 | { |
308 | - foreach ((array) $sizes as $size) { |
|
309 | - $this->sizes[] = new Comparator\NumberComparator($size); |
|
308 | + foreach ( (array)$sizes as $size ) { |
|
309 | + $this->sizes[ ] = new Comparator\NumberComparator( $size ); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | return $this; |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | * |
326 | 326 | * @see ExcludeDirectoryFilterIterator |
327 | 327 | */ |
328 | - public function exclude($dirs) |
|
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 | } |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @see ExcludeDirectoryFilterIterator |
343 | 343 | */ |
344 | - public function ignoreDotFiles(bool $ignoreDotFiles) |
|
344 | + public function ignoreDotFiles( bool $ignoreDotFiles ) |
|
345 | 345 | { |
346 | - if ($ignoreDotFiles) { |
|
346 | + if ( $ignoreDotFiles ) { |
|
347 | 347 | $this->ignore |= static::IGNORE_DOT_FILES; |
348 | 348 | } else { |
349 | 349 | $this->ignore &= ~static::IGNORE_DOT_FILES; |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @see ExcludeDirectoryFilterIterator |
363 | 363 | */ |
364 | - public function ignoreVCS(bool $ignoreVCS) |
|
364 | + public function ignoreVCS( bool $ignoreVCS ) |
|
365 | 365 | { |
366 | - if ($ignoreVCS) { |
|
366 | + if ( $ignoreVCS ) { |
|
367 | 367 | $this->ignore |= static::IGNORE_VCS_FILES; |
368 | 368 | } else { |
369 | 369 | $this->ignore &= ~static::IGNORE_VCS_FILES; |
@@ -379,9 +379,9 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return $this |
381 | 381 | */ |
382 | - public function ignoreVCSIgnored(bool $ignoreVCSIgnored) |
|
382 | + public function ignoreVCSIgnored( bool $ignoreVCSIgnored ) |
|
383 | 383 | { |
384 | - if ($ignoreVCSIgnored) { |
|
384 | + if ( $ignoreVCSIgnored ) { |
|
385 | 385 | $this->ignore |= static::IGNORE_VCS_IGNORED_FILES; |
386 | 386 | } else { |
387 | 387 | $this->ignore &= ~static::IGNORE_VCS_IGNORED_FILES; |
@@ -397,13 +397,13 @@ discard block |
||
397 | 397 | * |
398 | 398 | * @param string|string[] $pattern VCS patterns to ignore |
399 | 399 | */ |
400 | - public static function addVCSPattern($pattern) |
|
400 | + public static function addVCSPattern( $pattern ) |
|
401 | 401 | { |
402 | - foreach ((array) $pattern as $p) { |
|
403 | - self::$vcsPatterns[] = $p; |
|
402 | + foreach ( (array)$pattern as $p ) { |
|
403 | + self::$vcsPatterns[ ] = $p; |
|
404 | 404 | } |
405 | 405 | |
406 | - self::$vcsPatterns = array_unique(self::$vcsPatterns); |
|
406 | + self::$vcsPatterns = array_unique( self::$vcsPatterns ); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | * |
418 | 418 | * @see SortableIterator |
419 | 419 | */ |
420 | - public function sort(\Closure $closure) |
|
420 | + public function sort( \Closure $closure ) |
|
421 | 421 | { |
422 | 422 | $this->sort = $closure; |
423 | 423 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @see SortableIterator |
435 | 435 | */ |
436 | - public function sortByName(bool $useNaturalSort = false) |
|
436 | + public function sortByName( bool $useNaturalSort = false ) |
|
437 | 437 | { |
438 | 438 | $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME; |
439 | 439 | |
@@ -534,9 +534,9 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @see CustomFilterIterator |
536 | 536 | */ |
537 | - public function filter(\Closure $closure) |
|
537 | + public function filter( \Closure $closure ) |
|
538 | 538 | { |
539 | - $this->filters[] = $closure; |
|
539 | + $this->filters[ ] = $closure; |
|
540 | 540 | |
541 | 541 | return $this; |
542 | 542 | } |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return $this |
562 | 562 | */ |
563 | - public function ignoreUnreadableDirs(bool $ignore = true) |
|
563 | + public function ignoreUnreadableDirs( bool $ignore = true ) |
|
564 | 564 | { |
565 | 565 | $this->ignoreUnreadableDirs = $ignore; |
566 | 566 | |
@@ -576,22 +576,22 @@ discard block |
||
576 | 576 | * |
577 | 577 | * @throws DirectoryNotFoundException if one of the directories does not exist |
578 | 578 | */ |
579 | - public function in($dirs) |
|
579 | + public function in( $dirs ) |
|
580 | 580 | { |
581 | - $resolvedDirs = []; |
|
581 | + $resolvedDirs = [ ]; |
|
582 | 582 | |
583 | - foreach ((array) $dirs as $dir) { |
|
584 | - if (is_dir($dir)) { |
|
585 | - $resolvedDirs[] = $this->normalizeDir($dir); |
|
586 | - } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) { |
|
587 | - sort($glob); |
|
588 | - $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob)); |
|
583 | + foreach ( (array)$dirs as $dir ) { |
|
584 | + if ( is_dir( $dir ) ) { |
|
585 | + $resolvedDirs[ ] = $this->normalizeDir( $dir ); |
|
586 | + } elseif ( $glob = glob( $dir, ( \defined( 'GLOB_BRACE' ) ? \GLOB_BRACE : 0 ) | \GLOB_ONLYDIR | \GLOB_NOSORT ) ) { |
|
587 | + sort( $glob ); |
|
588 | + $resolvedDirs = array_merge( $resolvedDirs, array_map( [ $this, 'normalizeDir' ], $glob ) ); |
|
589 | 589 | } else { |
590 | - throw new DirectoryNotFoundException(sprintf('The "%s" directory does not exist.', $dir)); |
|
590 | + throw new DirectoryNotFoundException( sprintf( 'The "%s" directory does not exist.', $dir ) ); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | - $this->dirs = array_merge($this->dirs, $resolvedDirs); |
|
594 | + $this->dirs = array_merge( $this->dirs, $resolvedDirs ); |
|
595 | 595 | |
596 | 596 | return $this; |
597 | 597 | } |
@@ -608,33 +608,33 @@ discard block |
||
608 | 608 | #[\ReturnTypeWillChange] |
609 | 609 | public function getIterator() |
610 | 610 | { |
611 | - if (0 === \count($this->dirs) && 0 === \count($this->iterators)) { |
|
612 | - throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.'); |
|
611 | + if ( 0 === \count( $this->dirs ) && 0 === \count( $this->iterators ) ) { |
|
612 | + throw new \LogicException( 'You must call one of in() or append() methods before iterating over a Finder.' ); |
|
613 | 613 | } |
614 | 614 | |
615 | - if (1 === \count($this->dirs) && 0 === \count($this->iterators)) { |
|
616 | - $iterator = $this->searchInDirectory($this->dirs[0]); |
|
615 | + if ( 1 === \count( $this->dirs ) && 0 === \count( $this->iterators ) ) { |
|
616 | + $iterator = $this->searchInDirectory( $this->dirs[ 0 ] ); |
|
617 | 617 | |
618 | - if ($this->sort || $this->reverseSorting) { |
|
619 | - $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator(); |
|
618 | + if ( $this->sort || $this->reverseSorting ) { |
|
619 | + $iterator = ( new Iterator\SortableIterator( $iterator, $this->sort, $this->reverseSorting ) )->getIterator(); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | return $iterator; |
623 | 623 | } |
624 | 624 | |
625 | 625 | $iterator = new \AppendIterator(); |
626 | - foreach ($this->dirs as $dir) { |
|
627 | - $iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) { |
|
628 | - return $this->searchInDirectory($dir); |
|
629 | - }))); |
|
626 | + foreach ( $this->dirs as $dir ) { |
|
627 | + $iterator->append( new \IteratorIterator( new LazyIterator( function() use ( $dir ) { |
|
628 | + return $this->searchInDirectory( $dir ); |
|
629 | + }) ) ); |
|
630 | 630 | } |
631 | 631 | |
632 | - foreach ($this->iterators as $it) { |
|
633 | - $iterator->append($it); |
|
632 | + foreach ( $this->iterators as $it ) { |
|
633 | + $iterator->append( $it ); |
|
634 | 634 | } |
635 | 635 | |
636 | - if ($this->sort || $this->reverseSorting) { |
|
637 | - $iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator(); |
|
636 | + if ( $this->sort || $this->reverseSorting ) { |
|
637 | + $iterator = ( new Iterator\SortableIterator( $iterator, $this->sort, $this->reverseSorting ) )->getIterator(); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | return $iterator; |
@@ -649,21 +649,21 @@ discard block |
||
649 | 649 | * |
650 | 650 | * @throws \InvalidArgumentException when the given argument is not iterable |
651 | 651 | */ |
652 | - public function append(iterable $iterator) |
|
652 | + public function append( iterable $iterator ) |
|
653 | 653 | { |
654 | - if ($iterator instanceof \IteratorAggregate) { |
|
655 | - $this->iterators[] = $iterator->getIterator(); |
|
656 | - } elseif ($iterator instanceof \Iterator) { |
|
657 | - $this->iterators[] = $iterator; |
|
658 | - } elseif (is_iterable($iterator)) { |
|
654 | + if ( $iterator instanceof \IteratorAggregate ) { |
|
655 | + $this->iterators[ ] = $iterator->getIterator(); |
|
656 | + } elseif ( $iterator instanceof \Iterator ) { |
|
657 | + $this->iterators[ ] = $iterator; |
|
658 | + } elseif ( is_iterable( $iterator ) ) { |
|
659 | 659 | $it = new \ArrayIterator(); |
660 | - foreach ($iterator as $file) { |
|
661 | - $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file); |
|
662 | - $it[$file->getPathname()] = $file; |
|
660 | + foreach ( $iterator as $file ) { |
|
661 | + $file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo( $file ); |
|
662 | + $it[ $file->getPathname() ] = $file; |
|
663 | 663 | } |
664 | - $this->iterators[] = $it; |
|
664 | + $this->iterators[ ] = $it; |
|
665 | 665 | } else { |
666 | - throw new \InvalidArgumentException('Finder::append() method wrong argument type.'); |
|
666 | + throw new \InvalidArgumentException( 'Finder::append() method wrong argument type.' ); |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | return $this; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | */ |
677 | 677 | public function hasResults() |
678 | 678 | { |
679 | - foreach ($this->getIterator() as $_) { |
|
679 | + foreach ( $this->getIterator() as $_ ) { |
|
680 | 680 | return true; |
681 | 681 | } |
682 | 682 | |
@@ -691,35 +691,35 @@ discard block |
||
691 | 691 | #[\ReturnTypeWillChange] |
692 | 692 | public function count() |
693 | 693 | { |
694 | - return iterator_count($this->getIterator()); |
|
694 | + return iterator_count( $this->getIterator() ); |
|
695 | 695 | } |
696 | 696 | |
697 | - private function searchInDirectory(string $dir): \Iterator |
|
697 | + private function searchInDirectory( string $dir ): \Iterator |
|
698 | 698 | { |
699 | 699 | $exclude = $this->exclude; |
700 | 700 | $notPaths = $this->notPaths; |
701 | 701 | |
702 | - if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) { |
|
703 | - $exclude = array_merge($exclude, self::$vcsPatterns); |
|
702 | + if ( static::IGNORE_VCS_FILES === ( static::IGNORE_VCS_FILES & $this->ignore ) ) { |
|
703 | + $exclude = array_merge( $exclude, self::$vcsPatterns ); |
|
704 | 704 | } |
705 | 705 | |
706 | - if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) { |
|
707 | - $notPaths[] = '#(^|/)\..+(/|$)#'; |
|
706 | + if ( static::IGNORE_DOT_FILES === ( static::IGNORE_DOT_FILES & $this->ignore ) ) { |
|
707 | + $notPaths[ ] = '#(^|/)\..+(/|$)#'; |
|
708 | 708 | } |
709 | 709 | |
710 | - if (static::IGNORE_VCS_IGNORED_FILES === (static::IGNORE_VCS_IGNORED_FILES & $this->ignore)) { |
|
711 | - $gitignoreFilePath = sprintf('%s/.gitignore', $dir); |
|
712 | - if (!is_readable($gitignoreFilePath)) { |
|
713 | - throw new \RuntimeException(sprintf('The "ignoreVCSIgnored" option cannot be used by the Finder as the "%s" file is not readable.', $gitignoreFilePath)); |
|
710 | + if ( static::IGNORE_VCS_IGNORED_FILES === ( static::IGNORE_VCS_IGNORED_FILES & $this->ignore ) ) { |
|
711 | + $gitignoreFilePath = sprintf( '%s/.gitignore', $dir ); |
|
712 | + if ( ! is_readable( $gitignoreFilePath ) ) { |
|
713 | + throw new \RuntimeException( sprintf( 'The "ignoreVCSIgnored" option cannot be used by the Finder as the "%s" file is not readable.', $gitignoreFilePath ) ); |
|
714 | 714 | } |
715 | - $notPaths = array_merge($notPaths, [Gitignore::toRegex(file_get_contents($gitignoreFilePath))]); |
|
715 | + $notPaths = array_merge( $notPaths, [ Gitignore::toRegex( file_get_contents( $gitignoreFilePath ) ) ] ); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | $minDepth = 0; |
719 | 719 | $maxDepth = \PHP_INT_MAX; |
720 | 720 | |
721 | - foreach ($this->depths as $comparator) { |
|
722 | - switch ($comparator->getOperator()) { |
|
721 | + foreach ( $this->depths as $comparator ) { |
|
722 | + switch ( $comparator->getOperator() ) { |
|
723 | 723 | case '>': |
724 | 724 | $minDepth = $comparator->getTarget() + 1; |
725 | 725 | break; |
@@ -739,48 +739,48 @@ discard block |
||
739 | 739 | |
740 | 740 | $flags = \RecursiveDirectoryIterator::SKIP_DOTS; |
741 | 741 | |
742 | - if ($this->followLinks) { |
|
742 | + if ( $this->followLinks ) { |
|
743 | 743 | $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS; |
744 | 744 | } |
745 | 745 | |
746 | - $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs); |
|
746 | + $iterator = new Iterator\RecursiveDirectoryIterator( $dir, $flags, $this->ignoreUnreadableDirs ); |
|
747 | 747 | |
748 | - if ($exclude) { |
|
749 | - $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $exclude); |
|
748 | + if ( $exclude ) { |
|
749 | + $iterator = new Iterator\ExcludeDirectoryFilterIterator( $iterator, $exclude ); |
|
750 | 750 | } |
751 | 751 | |
752 | - $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); |
|
752 | + $iterator = new \RecursiveIteratorIterator( $iterator, \RecursiveIteratorIterator::SELF_FIRST ); |
|
753 | 753 | |
754 | - if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) { |
|
755 | - $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth); |
|
754 | + if ( $minDepth > 0 || $maxDepth < \PHP_INT_MAX ) { |
|
755 | + $iterator = new Iterator\DepthRangeFilterIterator( $iterator, $minDepth, $maxDepth ); |
|
756 | 756 | } |
757 | 757 | |
758 | - if ($this->mode) { |
|
759 | - $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode); |
|
758 | + if ( $this->mode ) { |
|
759 | + $iterator = new Iterator\FileTypeFilterIterator( $iterator, $this->mode ); |
|
760 | 760 | } |
761 | 761 | |
762 | - if ($this->names || $this->notNames) { |
|
763 | - $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames); |
|
762 | + if ( $this->names || $this->notNames ) { |
|
763 | + $iterator = new Iterator\FilenameFilterIterator( $iterator, $this->names, $this->notNames ); |
|
764 | 764 | } |
765 | 765 | |
766 | - if ($this->contains || $this->notContains) { |
|
767 | - $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains); |
|
766 | + if ( $this->contains || $this->notContains ) { |
|
767 | + $iterator = new Iterator\FilecontentFilterIterator( $iterator, $this->contains, $this->notContains ); |
|
768 | 768 | } |
769 | 769 | |
770 | - if ($this->sizes) { |
|
771 | - $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes); |
|
770 | + if ( $this->sizes ) { |
|
771 | + $iterator = new Iterator\SizeRangeFilterIterator( $iterator, $this->sizes ); |
|
772 | 772 | } |
773 | 773 | |
774 | - if ($this->dates) { |
|
775 | - $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates); |
|
774 | + if ( $this->dates ) { |
|
775 | + $iterator = new Iterator\DateRangeFilterIterator( $iterator, $this->dates ); |
|
776 | 776 | } |
777 | 777 | |
778 | - if ($this->filters) { |
|
779 | - $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters); |
|
778 | + if ( $this->filters ) { |
|
779 | + $iterator = new Iterator\CustomFilterIterator( $iterator, $this->filters ); |
|
780 | 780 | } |
781 | 781 | |
782 | - if ($this->paths || $notPaths) { |
|
783 | - $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths); |
|
782 | + if ( $this->paths || $notPaths ) { |
|
783 | + $iterator = new Iterator\PathFilterIterator( $iterator, $this->paths, $notPaths ); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | return $iterator; |
@@ -791,15 +791,15 @@ discard block |
||
791 | 791 | * |
792 | 792 | * Excluding: (s)ftp:// or ssh2.(s)ftp:// wrapper |
793 | 793 | */ |
794 | - private function normalizeDir(string $dir): string |
|
794 | + private function normalizeDir( string $dir ): string |
|
795 | 795 | { |
796 | - if ('/' === $dir) { |
|
796 | + if ( '/' === $dir ) { |
|
797 | 797 | return $dir; |
798 | 798 | } |
799 | 799 | |
800 | - $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); |
|
800 | + $dir = rtrim( $dir, '/' . \DIRECTORY_SEPARATOR ); |
|
801 | 801 | |
802 | - if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) { |
|
802 | + if ( preg_match( '#^(ssh2\.)?s?ftp://#', $dir ) ) { |
|
803 | 803 | $dir .= '/'; |
804 | 804 | } |
805 | 805 |