Code Duplication    Length = 5-7 lines in 2 locations

src/svg/filter/BaseFilter.php 1 location

@@ 66-72 (lines=7) @@
63
64
    protected static function filterWithOptions(ContainerInterface $container, array $options)
65
    {
66
        if ($container instanceof SVGElement) {
67
            $defs = $container->getSVG()->getFirstChild();
68
        } elseif ($container instanceof SVG) {
69
            $defs = $container->getFirstChild();
70
        } else {
71
            $defs = new Defs($container);
72
        }
73
        $filter = new Filter($defs, $options['id']);
74
        unset($options['id']);
75
        KeyValueWriter::apply($filter->getElement(), $options);

src/svg/gradient/Gradient.php 1 location

@@ 23-27 (lines=5) @@
20
21
    public function __construct(ElementInterface $parent, $id = null)
22
    {
23
        if ($parent instanceof SVG) {
24
            $parent = $parent->getFirstChild();
25
        } elseif ($parent instanceof SVGElement) {
26
            $parent = $parent->getSVG()->getFirstChild();
27
        }
28
29
        parent::__construct($parent);
30