1 | <?php |
||
7 | class FileLoader |
||
8 | { |
||
9 | /** |
||
10 | * Iterates through a directory and executes the provided callback function |
||
11 | * on each file or folder in the directory (excluding dot files). |
||
12 | * |
||
13 | * @since 0.1.0 |
||
14 | * |
||
15 | * @param $dir string Absolute path to the directory. |
||
16 | * @param $callback callable The callback function. |
||
17 | * |
||
18 | * @return array An array of the callback results. |
||
19 | */ |
||
20 | public static function iterateDir($dir, callable $callback) |
||
40 | |||
41 | /** |
||
42 | * Recursively require all files in a specific directory. |
||
43 | * |
||
44 | * By default, requires all php files in a specific directory once. |
||
45 | * Optionally able to specify the files in an array to load in a certain order. |
||
46 | * Starting and trailing slashes will be stripped for the directory and all files provided. |
||
47 | * |
||
48 | * @since 0.1.0 |
||
49 | * |
||
50 | * @param string $dir Directory to search through. |
||
51 | * @param array $files Optional array of files to include. If this is set, only the files specified will be loaded. |
||
52 | */ |
||
53 | public static function loadPhpFiles($dir, $files = []) |
||
82 | } |
||
83 |