withType('f') ->withSuffix('conf.php') ->withFollowSymlinks(true) ->find(); foreach ($files as $key => $file) { $file = trim($file, './'); $files[$key] = preg_replace('/\.conf\.php$/', '', $file); } $files = " ".implode("\n ", $files); throw new Exception( "CONFIGURATION ERROR\n". "Config file '{$original_config}' does not exist. Valid config files ". "are:\n\n".$files); } throw new Exception("Failed to read config file '{$config}': {$errors}"); } return $conf; }