public function addPHPConfig($filename)
    {
        $filename = trim($filename);
        
        if (strlen($filename) === 0) {
            throw new ConfiguratorException("Zero length filename is bogus.");
        }
        
        if (file_exists($filename) === false) {
            throw new ConfiguratorException("File `$filename` does not exist.");
        }
        
        ob_start();
        require($filename);
        $contents = ob_get_contents();
        ob_end_clean();

        if (strlen($contents) !== 0) {
            $message = sprintf(
                "Filename `%s` output some characters. Please check it is a valid PHP file.\n",
                $filename
            );

            throw new ConfiguratorException($message);
        }

        if (isset($default) === true) {
            $this->configuratorData->addConfigDefault($default);
        }

        foreach ($this->environmentList as $environment) {
            if (isset($$environment) === true) {
                $this->configuratorData->addConfigEnvironment($$environment);
            }
        }

        if (isset($override) === true) {
            $this->configuratorData->addConfigOverride($override);
        }

        if (isset($evaluate) === true) {
            $calculatedValues = $evaluate($this->configuratorData->getConfig(), $this->environment);
            $this->configuratorData->addConfigOverride($calculatedValues);
        }
    }
public function addPHPConfig($filename)
    {
        $filename = trim($filename);
        
        if (strlen($filename) === 0) {
            throw new ConfiguratorException("Zero length filename is bogus.");
        }
        
        if (file_exists($filename) === false) {
            throw new ConfiguratorException("File `$filename` does not exist.");
        }
        
        ob_start();
        require($filename);
        $contents = ob_get_contents();
        ob_end_clean();

        if (strlen($contents) !== 0) {
            $message = sprintf(
                "Filename `%s` output some characters. Please check it is a valid PHP file.\n",
                $filename
            );

            throw new ConfiguratorException($message);
        }

        if (isset($default) === true) {
            $this->configuratorData->addConfigDefault($default);
        }

        foreach ($this->environmentList as $environment) {
            if (isset($$environment) === true) {
                $this->configuratorData->addConfigEnvironment($$environment);
            }
        }

        if (isset($override) === true) {
            $this->configuratorData->addConfigOverride($override);
        }

        if (isset($evaluate) === true) {
            $calculatedValues = $evaluate($this->configuratorData->getConfig(), $this->environment);
            $this->configuratorData->addConfigOverride($calculatedValues);
        }
    }
public function addPHPConfig ( $ filename ) { $ filename = trim ( $ filename ) ; if ( strlen ( $ filename ) === 0 ) { throw new ConfiguratorException ( "Zero length filename is bogus." ) ; } if ( file_exists ( $ filename ) === false ) { throw new ConfiguratorException ( "File `$filename` does not exist." ) ; } ob_start ( ) ; require ( $ filename ) ; $ contents = ob_get_contents ( ) ; ob_end_clean ( ) ; if ( strlen ( $ contents ) !== 0 ) { $ message = sprintf ( "Filename `%s` output some characters. Please check it is a valid PHP file.\n" , $ filename ) ; throw new ConfiguratorException ( $ message ) ; } if ( isset ( $ default ) === true ) { $ this -> configuratorData -> addConfigDefault ( $ default ) ; } foreach ( $ this -> environmentList as $ environment ) { if ( isset ( $ $ environment ) === true ) { $ this -> configuratorData -> addConfigEnvironment ( $ $ environment ) ; } } if ( isset ( $ override ) === true ) { $ this -> configuratorData -> addConfigOverride ( $ override ) ; } if ( isset ( $ evaluate ) === true ) { $ calculatedValues = $ evaluate ( $ this -> configuratorData -> getConfig ( ) , $ this -> environment ) ; $ this -> configuratorData -> addConfigOverride ( $ calculatedValues ) ; } }
Adds an ini file to the configurator. All of the options are then available for
generating config files from.
@param $environment
@param $filename
Adds an ini file to the configurator . All of the options are then available for generating config files from .