parseImport example

protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file)
    {
        if (self::NAMESPACE_URI !== $node->namespaceURI) {
            return;
        }

        switch ($node->localName) {
            case 'route':
                $this->parseRoute($collection$node$path);
                break;
            case 'import':
                $this->parseImport($collection$node$path$file);
                break;
            case 'when':
                if (!$this->env || $node->getAttribute('env') !== $this->env) {
                    break;
                }
                foreach ($node->childNodes as $node) {
                    if ($node instanceof \DOMElement) {
                        $this->parseNode($collection$node$path$file);
                    }
                }
                break;
            
protected function parseNode(RouteCollection $collection, \DOMElement $node, string $path, string $file)
    {
        if (self::NAMESPACE_URI !== $node->namespaceURI) {
            return;
        }

        switch ($node->localName) {
            case 'route':
                $this->parseRoute($collection$node$path);
                break;
            case 'import':
                $this->parseImport($collection$node$path$file);
                break;
            case 'when':
                if (!$this->env || $node->getAttribute('env') !== $this->env) {
                    break;
                }
                foreach ($node->childNodes as $node) {
                    if ($node instanceof \DOMElement) {
                        $this->parseNode($collection$node$path$file);
                    }
                }
                break;
            
foreach ($parsedConfig as $name => $config) {
            if (str_starts_with($name, 'when@')) {
                if (!$this->env || 'when@'.$this->env !== $name) {
                    continue;
                }

                foreach ($config as $name => $config) {
                    $this->validate($config$name.'" when "@'.$this->env, $path);

                    if (isset($config['resource'])) {
                        $this->parseImport($collection$config$path$file);
                    } else {
                        $this->parseRoute($collection$name$config$path);
                    }
                }

                continue;
            }

            $this->validate($config$name$path);

            if (isset($config['resource'])) {
                
foreach ($parsedConfig as $name => $config) {
            if (str_starts_with($name, 'when@')) {
                if (!$this->env || 'when@'.$this->env !== $name) {
                    continue;
                }

                foreach ($config as $name => $config) {
                    $this->validate($config$name.'" when "@'.$this->env, $path);

                    if (isset($config['resource'])) {
                        $this->parseImport($collection$config$path$file);
                    } else {
                        $this->parseRoute($collection$name$config$path);
                    }
                }

                continue;
            }

            $this->validate($config$name$path);

            if (isset($config['resource'])) {
                
Home | Imprint | This part of the site doesn't use cookies.