@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function files(string $pattern = null) : array |
| 30 | 30 | { |
| 31 | - $pattern = "/". $pattern ."/"; |
|
| 31 | + $pattern = "/" . $pattern . "/"; |
|
| 32 | 32 | |
| 33 | 33 | $this->scan($this->path(), $pattern); |
| 34 | 34 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function setPath(string $path) : FileSearch |
| 100 | 100 | { |
| 101 | - if (! is_dir($path)) { |
|
| 101 | + if (!is_dir($path)) { |
|
| 102 | 102 | throw new Exception('Path not found.'); |
| 103 | 103 | } |
| 104 | 104 | |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | { |
| 46 | 46 | $items = array_diff(scandir($path), array('.', '..')); |
| 47 | 47 | |
| 48 | - foreach ($items as $item) { |
|
| 48 | + foreach ($items as $item) { |
|
| 49 | 49 | |
| 50 | 50 | $item = "$path/$item"; |
| 51 | 51 | |
| 52 | - if (is_dir($item)) { |
|
| 52 | + if (is_dir($item)) { |
|
| 53 | 53 | return $this->scan($item, $pattern); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | static public function read(string $path, int $level) : array |
| 10 | 10 | { |
| 11 | - if (! is_dir($path)) return []; |
|
| 11 | + if (!is_dir($path)) return []; |
|
| 12 | 12 | |
| 13 | 13 | self::scan($path, 1, $level); |
| 14 | 14 | |
@@ -31,18 +31,18 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | static private function scan(string $path, int $step, int $level) : void |
| 33 | 33 | { |
| 34 | - $items = array_diff(scandir($path), array('.', '..')); |
|
| 34 | + $items = array_diff(scandir($path), array('.', '..')); |
|
| 35 | 35 | |
| 36 | - foreach($items as $item) { |
|
| 36 | + foreach ($items as $item) { |
|
| 37 | 37 | |
| 38 | 38 | $folder = "$path/$item"; |
| 39 | 39 | |
| 40 | - if (! is_dir($folder)) { |
|
| 40 | + if (!is_dir($folder)) { |
|
| 41 | 41 | continue; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (is_dir($folder) && $step < $level) { |
| 45 | - self::scan($folder, $step+1, $level); |
|
| 45 | + self::scan($folder, $step + 1, $level); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if ($step == $level) { |