Bolt\Config::parseConfigYaml PHP Method

parseConfigYaml() protected method

Read and parse a YAML configuration file
protected parseConfigYaml ( string $filename, string $path = null ) : array
$filename string The name of the YAML file to read
$path string The (optional) path to the YAML file
return array
    protected function parseConfigYaml($filename, $path = null)
    {
        // Initialise parser
        if ($this->yamlParser === false) {
            $this->yamlParser = new Parser();
        }
        // By default we assume that config files are located in app/config/
        $path = $path ?: $this->app['resources']->getPath('config');
        $filename = $path . '/' . $filename;
        if (!is_readable($filename)) {
            return [];
        }
        $yml = $this->yamlParser->parse(file_get_contents($filename) . "\n");
        // Unset the repeated nodes key after parse
        unset($yml['__nodes']);
        // Invalid, non-existing, or empty files return NULL
        return $yml ?: [];
    }