From 1f1980ba235606294d8b382c9da57488da08d481 Mon Sep 17 00:00:00 2001 From: Joby Elliott Date: Thu, 18 Jun 2020 10:28:25 -0600 Subject: [PATCH] adding readDir to Config --- src/Config/Config.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Config/Config.php b/src/Config/Config.php index 6d7ffa4..2928a7c 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -8,6 +8,23 @@ use Flatrr\FlatArray; class Config extends SelfReferencingFlatArray implements ConfigInterface { + public function readDir($dir, string $name = null, bool $overwrite = null) + { + $dir = realpath($dir); + if (!$dir || !is_dir($dir)) { + return; + } + foreach (glob("$dir/*") as $f) { + if (is_file($f)) { + try { + $this->readFile($f, $name, $overwrite); + } catch (\Throwable $th) { + //ignore exceptions + } + } + } + } + protected function parse(string $input, string $format) : array { $fn = 'parse_'.$format;