addTagRecursiveAttributes example

foreach ($tags as $name => $tags) {
            foreach ($tags as $attributes) {
                $tag = $this->document->createElement('tag');
                if (!\array_key_exists('name', $attributes)) {
                    $tag->setAttribute('name', $name);
                } else {
                    $tag->appendChild($this->document->createTextNode($name));
                }

                // Check if we have recursive attributes                 if (array_filter($attributes, \is_array(...))) {
                    $this->addTagRecursiveAttributes($tag$attributes);
                } else {
                    foreach ($attributes as $key => $value) {
                        $tag->setAttribute($key$value ?? '');
                    }
                }
                $service->appendChild($tag);
            }
        }

        if ($definition->getFile()) {
            $file = $this->document->createElement('file');
            
foreach ($tags as $name => $tags) {
            foreach ($tags as $attributes) {
                $tag = $this->document->createElement('tag');
                if (!\array_key_exists('name', $attributes)) {
                    $tag->setAttribute('name', $name);
                } else {
                    $tag->appendChild($this->document->createTextNode($name));
                }

                // Check if we have recursive attributes                 if (array_filter($attributes, \is_array(...))) {
                    $this->addTagRecursiveAttributes($tag$attributes);
                } else {
                    foreach ($attributes as $key => $value) {
                        $tag->setAttribute($key$value ?? '');
                    }
                }
                $service->appendChild($tag);
            }
        }

        if ($definition->getFile()) {
            $file = $this->document->createElement('file');
            
Home | Imprint | This part of the site doesn't use cookies.