protected function parseConfigYaml($filename, DirectoryInterface $directory = null)
    {
        $directory = $directory ?: $this->app['filesystem']->getDir('config://');

        try {
            $file = $directory->get($filename);
        } catch (FileNotFoundException $e) {
            // Copy in dist files if applicable
            $distFiles = ['config.yml', 'contenttypes.yml', 'menu.yml', 'permissions.yml', 'routing.yml', 'taxonomy.yml'];
            if ($directory->getMountPoint() !== 'config' || !in_array($filename, $distFiles)) {
                return [];
            }

            $this->app['filesystem']->copy("bolt://app/config/$filename.dist", "config://$filename");
            $file = $directory->get($filename);
        }

        if (!$file instanceof ParsableInterface) {
            throw new \LogicException('File is not parsable.');
        }

        $yml = $file->parse() ?: [];

        // Unset the repeated nodes key after parse
        unset($yml['__nodes']);

        return $yml;
    }
protected function parseConfigYaml($filename, DirectoryInterface $directory = null)
    {
        $directory = $directory ?: $this->app['filesystem']->getDir('config://');

        try {
            $file = $directory->get($filename);
        } catch (FileNotFoundException $e) {
            // Copy in dist files if applicable
            $distFiles = ['config.yml', 'contenttypes.yml', 'menu.yml', 'permissions.yml', 'routing.yml', 'taxonomy.yml'];
            if ($directory->getMountPoint() !== 'config' || !in_array($filename, $distFiles)) {
                return [];
            }

            $this->app['filesystem']->copy("bolt://app/config/$filename.dist", "config://$filename");
            $file = $directory->get($filename);
        }

        if (!$file instanceof ParsableInterface) {
            throw new \LogicException('File is not parsable.');
        }

        $yml = $file->parse() ?: [];

        // Unset the repeated nodes key after parse
        unset($yml['__nodes']);

        return $yml;
    }
protected function parseConfigYaml ( $ filename , DirectoryInterface $ directory = null ) { $ directory = $ directory ? : $ this -> app [ 'filesystem' ] -> getDir ( 'config://' ) ; try { $ file = $ directory -> get ( $ filename ) ; } catch ( FileNotFoundException $ e ) { // Copy in dist files if applicable $ distFiles = [ 'config.yml' , 'contenttypes.yml' , 'menu.yml' , 'permissions.yml' , 'routing.yml' , 'taxonomy.yml' ] ; if ( $ directory -> getMountPoint ( ) !== 'config' || ! in_array ( $ filename , $ distFiles ) ) { return [ ] ; } $ this -> app [ 'filesystem' ] -> copy ( "bolt://app/config/$filename.dist" , "config://$filename" ) ; $ file = $ directory -> get ( $ filename ) ; } if ( ! $ file instanceof ParsableInterface ) { throw new \ LogicException ( 'File is not parsable.' ) ; } $ yml = $ file -> parse ( ) ? : [ ] ; // Unset the repeated nodes key after parse unset ( $ yml [ '__nodes' ] ) ; return $ yml ; }
Read and parse a YAML configuration file.

@param string             $filename  The name of the YAML file to read
@param DirectoryInterface $directory The (optional) directory to the YAML file

@return array
Read and parse a YAML configuration file .