protected function loadFromFile($path, ParserInterface $parser = null)
    {
        $paths      = $this->getValidPath($path);
        $this->data = [];

        foreach ($paths as $path) {
            if ($parser === null) {
                // Get file information
                $info      = pathinfo($path);
                $parts     = explode('.', $info['basename']);
                $extension = array_pop($parts);

                // Skip the `dist` extension
                if ($extension === 'dist') {
                    $extension = array_pop($parts);
                }

                // Get file parser
                $parser = $this->getParser($extension);

                // Try to load file
                $this->data = array_replace_recursive($this->data, $parser->parseFile($path));

                // Clean parser
                $parser = null;
            } else {
                // Try to load file using specified parser
                $this->data = array_replace_recursive($this->data, $parser->parseFile($path));
            }
        }
    }
protected function loadFromFile($path, ParserInterface $parser = null)
    {
        $paths      = $this->getValidPath($path);
        $this->data = [];

        foreach ($paths as $path) {
            if ($parser === null) {
                // Get file information
                $info      = pathinfo($path);
                $parts     = explode('.', $info['basename']);
                $extension = array_pop($parts);

                // Skip the `dist` extension
                if ($extension === 'dist') {
                    $extension = array_pop($parts);
                }

                // Get file parser
                $parser = $this->getParser($extension);

                // Try to load file
                $this->data = array_replace_recursive($this->data, $parser->parseFile($path));

                // Clean parser
                $parser = null;
            } else {
                // Try to load file using specified parser
                $this->data = array_replace_recursive($this->data, $parser->parseFile($path));
            }
        }
    }
protected function loadFromFile ( $ path , ParserInterface $ parser = null ) { $ paths = $ this -> getValidPath ( $ path ) ; $ this -> data = [ ] ; foreach ( $ paths as $ path ) { if ( $ parser === null ) { // Get file information $ info = pathinfo ( $ path ) ; $ parts = explode ( '.' , $ info [ 'basename' ] ) ; $ extension = array_pop ( $ parts ) ; // Skip the `dist` extension if ( $ extension === 'dist' ) { $ extension = array_pop ( $ parts ) ; } // Get file parser $ parser = $ this -> getParser ( $ extension ) ; // Try to load file $ this -> data = array_replace_recursive ( $ this -> data , $ parser -> parseFile ( $ path ) ) ; // Clean parser $ parser = null ; } else { // Try to load file using specified parser $ this -> data = array_replace_recursive ( $ this -> data , $ parser -> parseFile ( $ path ) ) ; } } }
Loads configuration from file.

@param  string|array     $path   Filenames or directories with configuration
@param  ParserInterface  $parser Configuration parser

@throws EmptyDirectoryException If `$path` is an empty directory
Loads configuration from file .