Code Duplication    Length = 41-41 lines in 2 locations

library/WebinoViewLib/Component/Javascript/Src.php 1 location

@@ 11-51 (lines=41) @@
8
/**
9
 * Class ScriptSrc
10
 */
11
class Src extends AbstractBaseViewComponent
12
{
13
    /**
14
     * @var string
15
     */
16
    private $src;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @param string|null $src Javascript source URL
25
     * @param string|null $name Config spec key name
26
     */
27
    public function __construct($src = null, $name = null)
28
    {
29
        $this->src  = (string) $src;
30
        $this->name = (string) $name;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function getSpecName()
37
    {
38
        return $this->name;
39
    }
40
41
    /**
42
     * @param NodeView $node
43
     */
44
    public function configure(NodeView $node)
45
    {
46
        $node
47
            ->setPriority(-110)
48
            ->setLocator('head')
49
            ->setHtml('{$_innerHtml} <script src="' . $this->src . '"></script>');
50
    }
51
}
52

library/WebinoViewLib/Component/Stylesheet/Link.php 1 location

@@ 11-51 (lines=41) @@
8
/**
9
 * Class Link
10
 */
11
class Link extends AbstractBaseViewComponent
12
{
13
    /**
14
     * @var string
15
     */
16
    private $href;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @param string|null $href Stylesheet source URL
25
     * @param string|null $name Config spec key name
26
     */
27
    public function __construct($href = null, $name = null)
28
    {
29
        $this->href = (string) $href;
30
        $this->name = (string) $name;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    protected function getSpecName()
37
    {
38
        return $this->name;
39
    }
40
41
    /**
42
     * @param NodeView $node
43
     */
44
    public function configure(NodeView $node)
45
    {
46
        $node
47
            ->setPriority(-100)
48
            ->setLocator('head')
49
            ->setHtml('{$_innerHtml} <link href="' . $this->href . '" rel="stylesheet"/>');
50
    }
51
}
52