src/Charcoal/Model/Service/MetadataLoader.php
private function loadFile($path)
    {
        if (file_exists($path)) {
            return $this->loadJsonFile($path);
        }

        $dirs = $this->paths();
        if (empty($dirs)) {
            return null;
        }

        $data = [];
        $dirs = array_reverse($dirs);
        foreach ($dirs as $dir) {
            $file = $dir.DIRECTORY_SEPARATOR.$path;
            if (file_exists($file)) {
                $data = array_replace_recursive($data, $this->loadJsonFile($file));
            }
        }

        if (empty($data)) {
            return null;
        }

        return $data;
    }
private function loadFile($path)
    {
        if (file_exists($path)) {
            return $this->loadJsonFile($path);
        }

        $dirs = $this->paths();
        if (empty($dirs)) {
            return null;
        }

        $data = [];
        $dirs = array_reverse($dirs);
        foreach ($dirs as $dir) {
            $file = $dir.DIRECTORY_SEPARATOR.$path;
            if (file_exists($file)) {
                $data = array_replace_recursive($data, $this->loadJsonFile($file));
            }
        }

        if (empty($data)) {
            return null;
        }

        return $data;
    }
private function loadFile ( $ path ) { if ( file_exists ( $ path ) ) { return $ this -> loadJsonFile ( $ path ) ; } $ dirs = $ this -> paths ( ) ; if ( empty ( $ dirs ) ) { return null ; } $ data = [ ] ; $ dirs = array_reverse ( $ dirs ) ; foreach ( $ dirs as $ dir ) { $ file = $ dir . DIRECTORY_SEPARATOR . $ path ; if ( file_exists ( $ file ) ) { $ data = array_replace_recursive ( $ data , $ this -> loadJsonFile ( $ file ) ) ; } } if ( empty ( $ data ) ) { return null ; } return $ data ; }
Load a file as an array.

Supported file types: JSON.

@param  string $path A file path to resolve and fetch.
@return array|null An associative array on success, NULL on failure.
Load a file as an array .