src/RestPHP/Configuration.php
public function createFromFile($file)
    {
        // Check if the file exists
        if (!$file || !file_exists($file)) {
            throw new \Exception("Configuration file \"{$file}\" could not be found.");
        }

        // Include the file while suppressing warnings
        // - so we can check if we could include it
        $config = @include($file);
        if (!$config) {
            throw new \Exception("Configuration file \"{$file}\" could not be included.");
        }

        // Set the properties
        $this->useAuthorization = $config['useAuthorization'];
        $this->authorizationMode = $config['authorizationMode'];
        $this->redirectAuthorization = $config['redirectAuthorization'];
        $this->authorizationForm = $config['authorizationForm'];
        $this->dsn = $config['dsn'];
        $this->username = $config['username'];
        $this->password = $config['password'];
        $this->responseType = $config['responseType'];
        $this->clientResponseType = $config['clientResponseType'];
        return $this;
    }
public function createFromFile($file)
    {
        // Check if the file exists
        if (!$file || !file_exists($file)) {
            throw new \Exception("Configuration file \"{$file}\" could not be found.");
        }

        // Include the file while suppressing warnings
        // - so we can check if we could include it
        $config = @include($file);
        if (!$config) {
            throw new \Exception("Configuration file \"{$file}\" could not be included.");
        }

        // Set the properties
        $this->useAuthorization = $config['useAuthorization'];
        $this->authorizationMode = $config['authorizationMode'];
        $this->redirectAuthorization = $config['redirectAuthorization'];
        $this->authorizationForm = $config['authorizationForm'];
        $this->dsn = $config['dsn'];
        $this->username = $config['username'];
        $this->password = $config['password'];
        $this->responseType = $config['responseType'];
        $this->clientResponseType = $config['clientResponseType'];
        return $this;
    }
public function createFromFile ( $ file ) { // Check if the file exists if ( ! $ file || ! file_exists ( $ file ) ) { throw new \ Exception ( "Configuration file \"{$file}\" could not be found." ) ; } // Include the file while suppressing warnings // - so we can check if we could include it $ config = @ include ( $ file ) ; if ( ! $ config ) { throw new \ Exception ( "Configuration file \"{$file}\" could not be included." ) ; } // Set the properties $ this -> useAuthorization = $ config [ 'useAuthorization' ] ; $ this -> authorizationMode = $ config [ 'authorizationMode' ] ; $ this -> redirectAuthorization = $ config [ 'redirectAuthorization' ] ; $ this -> authorizationForm = $ config [ 'authorizationForm' ] ; $ this -> dsn = $ config [ 'dsn' ] ; $ this -> username = $ config [ 'username' ] ; $ this -> password = $ config [ 'password' ] ; $ this -> responseType = $ config [ 'responseType' ] ; $ this -> clientResponseType = $ config [ 'clientResponseType' ] ; return $ this ; }
Creates a configuration object by loading the parameters from a file.
This file has to be a PHP file returning an array with the parameters.

@param string $file The path to the file.

@throws Exception Throws an exception if the file can't be found.
@throws Exception Throws an exception if the file could not be included.

@return $this The current object.
Creates a configuration object by loading the parameters from a file . This file has to be a PHP file returning an array with the parameters .