protected function loadFiles($path)
{
$config = [];
if (!is_dir($path)) {
throw new ConfigException('Configuration directory `' . $path . '` not found');
}
$iterator = new \GlobIterator($path . '/*.php', \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_PATHNAME);
foreach ($iterator as $name => $file) {
$name = substr($name, 0, -4);
$config[$name] = $this->loadFile($file);
}
return $config;
}