Link::getSpecName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace WebinoViewLib\Component\Stylesheet;
4
5
use WebinoViewLib\Component\AbstractBaseViewComponent;
6
use WebinoViewLib\Feature\NodeView;
7
8
/**
9
 * Class Link
10
 */
11 View Code Duplication
class Link extends AbstractBaseViewComponent
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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