public function makeConfig($configFile = [], $requiredConfig = [])
    {
        if (!$configFile) {
            $configFile = [];
        }

        /*
         * Config already made
         */
        if (is_object($configFile)) {
            $config = $configFile;
        }
        /*
         * Embedded config
         */
        elseif (is_array($configFile)) {
            $config = $this->makeConfigFromArray($configFile);
        }
        /*
         * Process config from file contents
         */
        else {

            if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) {
                $configFile = $this->controller->getConfigPath($configFile);
            }
            else {
                $configFile = $this->getConfigPath($configFile);
            }

            if (!File::isFile($configFile)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.not_found',
                    ['file' => $configFile, 'location' => get_called_class()]
                ));
            }

            $config = Yaml::parse(File::get($configFile));

            /*
             * Extensibility
             */
            $publicFile = File::localToPublic($configFile);
            if ($results = Event::fire('system.extendConfigFile', [$publicFile, $config])) {
                foreach ($results as $result) {
                    if (!is_array($result)) {
                        continue;
                    }
                    $config = array_merge($config, $result);
                }
            }

            $config = $this->makeConfigFromArray($config);
        }

        /*
         * Validate required configuration
         */
        foreach ($requiredConfig as $property) {
            if (!property_exists($config, $property)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.required',
                    ['property' => $property, 'location' => get_called_class()]
                ));
            }
        }

        return $config;
    }
public function makeConfig($configFile = [], $requiredConfig = [])
    {
        if (!$configFile) {
            $configFile = [];
        }

        /*
         * Config already made
         */
        if (is_object($configFile)) {
            $config = $configFile;
        }
        /*
         * Embedded config
         */
        elseif (is_array($configFile)) {
            $config = $this->makeConfigFromArray($configFile);
        }
        /*
         * Process config from file contents
         */
        else {

            if (isset($this->controller) && method_exists($this->controller, 'getConfigPath')) {
                $configFile = $this->controller->getConfigPath($configFile);
            }
            else {
                $configFile = $this->getConfigPath($configFile);
            }

            if (!File::isFile($configFile)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.not_found',
                    ['file' => $configFile, 'location' => get_called_class()]
                ));
            }

            $config = Yaml::parse(File::get($configFile));

            /*
             * Extensibility
             */
            $publicFile = File::localToPublic($configFile);
            if ($results = Event::fire('system.extendConfigFile', [$publicFile, $config])) {
                foreach ($results as $result) {
                    if (!is_array($result)) {
                        continue;
                    }
                    $config = array_merge($config, $result);
                }
            }

            $config = $this->makeConfigFromArray($config);
        }

        /*
         * Validate required configuration
         */
        foreach ($requiredConfig as $property) {
            if (!property_exists($config, $property)) {
                throw new SystemException(Lang::get(
                    'system::lang.config.required',
                    ['property' => $property, 'location' => get_called_class()]
                ));
            }
        }

        return $config;
    }
public function makeConfig ( $ configFile = [ ] , $ requiredConfig = [ ] ) { if ( ! $ configFile ) { $ configFile = [ ] ; } /*
         * Config already made
         */ if ( is_object ( $ configFile ) ) { $ config = $ configFile ; } /*
         * Embedded config
         */ elseif ( is_array ( $ configFile ) ) { $ config = $ this -> makeConfigFromArray ( $ configFile ) ; } /*
         * Process config from file contents
         */ else { if ( isset ( $ this -> controller ) && method_exists ( $ this -> controller , 'getConfigPath' ) ) { $ configFile = $ this -> controller -> getConfigPath ( $ configFile ) ; } else { $ configFile = $ this -> getConfigPath ( $ configFile ) ; } if ( ! File :: isFile ( $ configFile ) ) { throw new SystemException ( Lang :: get ( 'system::lang.config.not_found' , [ 'file' => $ configFile , 'location' => get_called_class ( ) ] ) ) ; } $ config = Yaml :: parse ( File :: get ( $ configFile ) ) ; /*
             * Extensibility
             */ $ publicFile = File :: localToPublic ( $ configFile ) ; if ( $ results = Event :: fire ( 'system.extendConfigFile' , [ $ publicFile , $ config ] ) ) { foreach ( $ results as $ result ) { if ( ! is_array ( $ result ) ) { continue ; } $ config = array_merge ( $ config , $ result ) ; } } $ config = $ this -> makeConfigFromArray ( $ config ) ; } /*
         * Validate required configuration
         */ foreach ( $ requiredConfig as $ property ) { if ( ! property_exists ( $ config , $ property ) ) { throw new SystemException ( Lang :: get ( 'system::lang.config.required' , [ 'property' => $ property , 'location' => get_called_class ( ) ] ) ) ; } } return $ config ; }
Reads the contents of the supplied file and applies it to this object.
@param array $configFile
@param array $requiredConfig
@return array|stdClass
Reads the contents of the supplied file and applies it to this object .