Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| RecursiveDirectoryConfig | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * This file is part of php-fast-forward/config. |
| 7 | * |
| 8 | * This source file is subject to the license bundled |
| 9 | * with this source code in the file LICENSE. |
| 10 | * |
| 11 | * @link https://github.com/php-fast-forward/config |
| 12 | * @copyright Copyright (c) 2025 Felipe Sayão Lobato Abreu <github@mentordosnerds.com> |
| 13 | * @license https://opensource.org/licenses/MIT MIT License |
| 14 | */ |
| 15 | |
| 16 | namespace FastForward\Config; |
| 17 | |
| 18 | /** |
| 19 | * Class RecursiveDirectoryConfig. |
| 20 | * |
| 21 | * Extends DirectoryConfig to support recursive loading of configuration files from a root directory. |
| 22 | * This class SHALL match both top-level and nested PHP files using a recursive glob pattern. |
| 23 | */ |
| 24 | final class RecursiveDirectoryConfig extends DirectoryConfig |
| 25 | { |
| 26 | use LazyLoadConfigTrait; |
| 27 | |
| 28 | /** |
| 29 | * @const string Recursive pattern to match all *.php files in all nested directories. |
| 30 | */ |
| 31 | protected const PATTERN = '{*,**/*}.php'; |
| 32 | |
| 33 | /** |
| 34 | * Constructs a RecursiveDirectoryConfig instance. |
| 35 | * |
| 36 | * This constructor SHALL initialize the parent DirectoryConfig with a modified pattern |
| 37 | * that supports recursive file discovery. It MAY optionally use a cached configuration file. |
| 38 | * |
| 39 | * @param string $rootDirectory the root directory to search recursively for config files |
| 40 | * @param null|string $cachedConfigFile optional path to a cache file for aggregated configuration |
| 41 | */ |
| 42 | public function __construct(string $rootDirectory, ?string $cachedConfigFile = null) |
| 43 | { |
| 44 | parent::__construct( |
| 45 | directory: $rootDirectory, |
| 46 | cachedConfigFile: $cachedConfigFile, |
| 47 | ); |
| 48 | } |
| 49 | } |