public function loadConfig(string $file): self
    {
        if (file_exists($file) === false) {
            throw new \RuntimeException('No such config file.');
        }
        $data = json_decode(file_get_contents($file), true);
        if ($data === null) {
            throw new \RuntimeException('Invalid config file.');
        }
        return $this->setConfigs($data);
    }
public function loadConfig(string $file): self
    {
        if (file_exists($file) === false) {
            throw new \RuntimeException('No such config file.');
        }
        $data = json_decode(file_get_contents($file), true);
        if ($data === null) {
            throw new \RuntimeException('Invalid config file.');
        }
        return $this->setConfigs($data);
    }
public function loadConfig ( string $ file ) : self { if ( file_exists ( $ file ) === false ) { throw new \ RuntimeException ( 'No such config file.' ) ; } $ data = json_decode ( file_get_contents ( $ file ) , true ) ; if ( $ data === null ) { throw new \ RuntimeException ( 'Invalid config file.' ) ; } return $ this -> setConfigs ( $ data ) ; }
Set configuration from a JSON file.

@param string $file The file containing the configuration attributes.

@return self Allow method chaining.

@throws \RuntimeException On error.
Set configuration from a JSON file .