SVGDefs example

continue;
                }
            } catch (\Exception $e) {
                $this->io->warning($e->getMessage() . ' ' . $file . \PHP_EOL . 'You have to handle this file by hand.');

                continue;
            }

            $defs = $svg->getDocument()->getChild(0);
            if (!($defs instanceof SVGDefs)) {
                $defs = new SVGDefs();
                foreach ($this->getChildren($svg->getDocument()) as $child) {
                    $svg->getDocument()->removeChild($child);
                    $defs->addChild($child);
                }
                $svg->getDocument()->addChild($defs);
            }

            $child = $defs->getChild(0);

            if ($child->getAttribute('id') === null || $cleanup) {
                $id = 'icons-' . $package . '-' . self::toKebabCase(basename($file, '.svg'));
                
Home | Imprint | This part of the site doesn't use cookies.