public function fromFile($file)
    {
        $file = $this->getStringable($file);

        if ( ! $this->isFile($file)) throw new NotIsFileException('Not is file: ' . $file);

        $content = file_get_contents($file);

        if ($this->isJson($content))
        {
            return $this->initialize(json_decode($content, true));
        }
        elseif ($this->isSerialized($content))
        {
            return $this->initialize(unserialize($content));
        }

        throw new ContainerException('Can\'t convert file to Container');
    }
public function fromFile($file)
    {
        $file = $this->getStringable($file);

        if ( ! $this->isFile($file)) throw new NotIsFileException('Not is file: ' . $file);

        $content = file_get_contents($file);

        if ($this->isJson($content))
        {
            return $this->initialize(json_decode($content, true));
        }
        elseif ($this->isSerialized($content))
        {
            return $this->initialize(unserialize($content));
        }

        throw new ContainerException('Can\'t convert file to Container');
    }
public function fromFile ( $ file ) { $ file = $ this -> getStringable ( $ file ) ; if ( ! $ this -> isFile ( $ file ) ) throw new NotIsFileException ( 'Not is file: ' . $ file ) ; $ content = file_get_contents ( $ file ) ; if ( $ this -> isJson ( $ content ) ) { return $ this -> initialize ( json_decode ( $ content , true ) ) ; } elseif ( $ this -> isSerialized ( $ content ) ) { return $ this -> initialize ( unserialize ( $ content ) ) ; } throw new ContainerException ( 'Can\'t convert file to Container' ) ; }
Construct from file.
Contents can be json or serialized array.

@param string|StringContract $file
@throws ContainerException
@throws NotIsFileException
@return $this
Construct from file . Contents can be json or serialized array .