public function addFile($file, $resource = null)
    {
        if (!file_exists($file) || !is_file($file)) {
            throw new \Exception('The configuration file ' . $file . ' does not exist.');
        } else {
            if ($resource === null) {
                $resource = $file;
            }

            if (!array_key_exists($resource, self::$parameters)) {
                self::$parameters[$resource] = new ParameterBag();
            }

            $content = YamlParser::parse(file_get_contents($file));

            if ($content !== null) {
                $content = self::parseImports($content, $resource);

                $content = self::parseParameters($content, $resource);

                self::addConfig($content, $resource);
            }
        }

        return self::getInstance();
    }
public function addFile($file, $resource = null)
    {
        if (!file_exists($file) || !is_file($file)) {
            throw new \Exception('The configuration file ' . $file . ' does not exist.');
        } else {
            if ($resource === null) {
                $resource = $file;
            }

            if (!array_key_exists($resource, self::$parameters)) {
                self::$parameters[$resource] = new ParameterBag();
            }

            $content = YamlParser::parse(file_get_contents($file));

            if ($content !== null) {
                $content = self::parseImports($content, $resource);

                $content = self::parseParameters($content, $resource);

                self::addConfig($content, $resource);
            }
        }

        return self::getInstance();
    }
public function addFile ( $ file , $ resource = null ) { if ( ! file_exists ( $ file ) || ! is_file ( $ file ) ) { throw new \ Exception ( 'The configuration file ' . $ file . ' does not exist.' ) ; } else { if ( $ resource === null ) { $ resource = $ file ; } if ( ! array_key_exists ( $ resource , self :: $ parameters ) ) { self :: $ parameters [ $ resource ] = new ParameterBag ( ) ; } $ content = YamlParser :: parse ( file_get_contents ( $ file ) ) ; if ( $ content !== null ) { $ content = self :: parseImports ( $ content , $ resource ) ; $ content = self :: parseParameters ( $ content , $ resource ) ; self :: addConfig ( $ content , $ resource ) ; } } return self :: getInstance ( ) ; }
Parse .yml file and add it to slim.

@param string $file
@param string $resource (optional)

@return self
Parse . yml file and add it to slim .