@@ -8,71 +8,71 @@ |
||
8 | 8 | |
9 | 9 | class Migrator extends M |
10 | 10 | { |
11 | - /** |
|
12 | - * Get all of the migration files in a given path. |
|
13 | - * |
|
14 | - * @param string $path |
|
15 | - * @param bool $recursive |
|
16 | - * |
|
17 | - * @return array |
|
18 | - */ |
|
19 | - public function getMigrationFiles($paths = [], $recursive = true) |
|
20 | - { |
|
21 | - if ($recursive) { |
|
22 | - $paths = $this->getRecursiveFolders($paths); |
|
23 | - } |
|
11 | + /** |
|
12 | + * Get all of the migration files in a given path. |
|
13 | + * |
|
14 | + * @param string $path |
|
15 | + * @param bool $recursive |
|
16 | + * |
|
17 | + * @return array |
|
18 | + */ |
|
19 | + public function getMigrationFiles($paths = [], $recursive = true) |
|
20 | + { |
|
21 | + if ($recursive) { |
|
22 | + $paths = $this->getRecursiveFolders($paths); |
|
23 | + } |
|
24 | 24 | |
25 | - $files = parent::getMigrationFiles($paths); |
|
25 | + $files = parent::getMigrationFiles($paths); |
|
26 | 26 | |
27 | - return $files; |
|
28 | - } |
|
27 | + return $files; |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Get all subdirectories located in an array of folders. |
|
32 | - * |
|
33 | - * @param array $folders |
|
34 | - * |
|
35 | - * @return array |
|
36 | - */ |
|
37 | - public function getRecursiveFolders($folders) |
|
38 | - { |
|
39 | - if (! is_array($folders)) { |
|
40 | - $folders = [$folders]; |
|
41 | - } |
|
30 | + /** |
|
31 | + * Get all subdirectories located in an array of folders. |
|
32 | + * |
|
33 | + * @param array $folders |
|
34 | + * |
|
35 | + * @return array |
|
36 | + */ |
|
37 | + public function getRecursiveFolders($folders) |
|
38 | + { |
|
39 | + if (! is_array($folders)) { |
|
40 | + $folders = [$folders]; |
|
41 | + } |
|
42 | 42 | |
43 | - $paths = []; |
|
43 | + $paths = []; |
|
44 | 44 | |
45 | - foreach ($folders as $folder) { |
|
46 | - $iter = new Iterator( |
|
47 | - new DirectoryIterator($folder, DirectoryIterator::SKIP_DOTS), |
|
48 | - Iterator::SELF_FIRST, |
|
49 | - Iterator::CATCH_GET_CHILD // Ignore "Permission denied" |
|
50 | - ); |
|
45 | + foreach ($folders as $folder) { |
|
46 | + $iter = new Iterator( |
|
47 | + new DirectoryIterator($folder, DirectoryIterator::SKIP_DOTS), |
|
48 | + Iterator::SELF_FIRST, |
|
49 | + Iterator::CATCH_GET_CHILD // Ignore "Permission denied" |
|
50 | + ); |
|
51 | 51 | |
52 | - $subPaths = [$folder]; |
|
53 | - foreach ($iter as $path => $dir) { |
|
54 | - if ($dir->isDir()) { |
|
55 | - $subPaths[] = $path; |
|
56 | - } |
|
57 | - } |
|
52 | + $subPaths = [$folder]; |
|
53 | + foreach ($iter as $path => $dir) { |
|
54 | + if ($dir->isDir()) { |
|
55 | + $subPaths[] = $path; |
|
56 | + } |
|
57 | + } |
|
58 | 58 | |
59 | - $paths = array_merge($paths, $subPaths); |
|
60 | - } |
|
59 | + $paths = array_merge($paths, $subPaths); |
|
60 | + } |
|
61 | 61 | |
62 | - return $paths; |
|
63 | - } |
|
62 | + return $paths; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Add date folders to migrations path. |
|
67 | - * |
|
68 | - * @param string $file |
|
69 | - * |
|
70 | - * @return string |
|
71 | - */ |
|
72 | - public function getDateFolderStructure($file) |
|
73 | - { |
|
74 | - $parts = explode('_', $file); |
|
65 | + /** |
|
66 | + * Add date folders to migrations path. |
|
67 | + * |
|
68 | + * @param string $file |
|
69 | + * |
|
70 | + * @return string |
|
71 | + */ |
|
72 | + public function getDateFolderStructure($file) |
|
73 | + { |
|
74 | + $parts = explode('_', $file); |
|
75 | 75 | |
76 | - return $parts[0].'/'.$parts[1].'/'; |
|
77 | - } |
|
76 | + return $parts[0].'/'.$parts[1].'/'; |
|
77 | + } |
|
78 | 78 | } |