Component/HttpKernel/Kernel.php
public function loadConfig($fileName)
    {
        // Check if the given file exists
        if (file_exists($fileName)) {
            $file = file_get_contents($fileName);
        } else {
            // So the file can not be located
            // Check in config folder
            if (file_exists($this->getRootDir() . '/config/' . $fileName)) {
                $file = file_get_contents($this->getRootDir() . '/config/' . $fileName);
            } else {
                throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $fileName));
            }
        }

        $array  = Yaml::parse($file);

        // make sure we dealing with array first
        if (is_array($array)) {
            // Discover configuration
            foreach ($array as $key => $params) {
                // Import Resources
                if ($key == 'imports') {
                    foreach ($params as $resource) {
                        foreach ($resource as $key => $resourceName) {
                            if ($key == 'resource') {
                                $this->loadConfig($resourceName);
                            }
                        }
                    }
                // Direct parameters input
                } elseif ($key == 'parameters') {
                    foreach ($params as $paramName => $param) {
                        $this->config->setParameter($paramName, $param);
                    }
                // Save parameters in the Config
                } else {
                    $this->config->setParameter($key, $params);
                }
            }
        }

        return $this->config;
    }
public function loadConfig($fileName)
    {
        // Check if the given file exists
        if (file_exists($fileName)) {
            $file = file_get_contents($fileName);
        } else {
            // So the file can not be located
            // Check in config folder
            if (file_exists($this->getRootDir() . '/config/' . $fileName)) {
                $file = file_get_contents($this->getRootDir() . '/config/' . $fileName);
            } else {
                throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $fileName));
            }
        }

        $array  = Yaml::parse($file);

        // make sure we dealing with array first
        if (is_array($array)) {
            // Discover configuration
            foreach ($array as $key => $params) {
                // Import Resources
                if ($key == 'imports') {
                    foreach ($params as $resource) {
                        foreach ($resource as $key => $resourceName) {
                            if ($key == 'resource') {
                                $this->loadConfig($resourceName);
                            }
                        }
                    }
                // Direct parameters input
                } elseif ($key == 'parameters') {
                    foreach ($params as $paramName => $param) {
                        $this->config->setParameter($paramName, $param);
                    }
                // Save parameters in the Config
                } else {
                    $this->config->setParameter($key, $params);
                }
            }
        }

        return $this->config;
    }
public function loadConfig ( $ fileName ) { // Check if the given file exists if ( file_exists ( $ fileName ) ) { $ file = file_get_contents ( $ fileName ) ; } else { // So the file can not be located // Check in config folder if ( file_exists ( $ this -> getRootDir ( ) . '/config/' . $ fileName ) ) { $ file = file_get_contents ( $ this -> getRootDir ( ) . '/config/' . $ fileName ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'The file "%s" does not exist.' , $ fileName ) ) ; } } $ array = Yaml :: parse ( $ file ) ; // make sure we dealing with array first if ( is_array ( $ array ) ) { // Discover configuration foreach ( $ array as $ key => $ params ) { // Import Resources if ( $ key == 'imports' ) { foreach ( $ params as $ resource ) { foreach ( $ resource as $ key => $ resourceName ) { if ( $ key == 'resource' ) { $ this -> loadConfig ( $ resourceName ) ; } } } // Direct parameters input } elseif ( $ key == 'parameters' ) { foreach ( $ params as $ paramName => $ param ) { $ this -> config -> setParameter ( $ paramName , $ param ) ; } // Save parameters in the Config } else { $ this -> config -> setParameter ( $ key , $ params ) ; } } } return $ this -> config ; }
Loads app Configuration.

@return ConfigInterface
Loads app Configuration .