Passed
Push — master ( 507915...bc62fe )
by Gabriel
03:45
created

Asset   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 57.89%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 17
dl 0
loc 74
ccs 11
cts 19
cp 0.5789
rs 10
c 1
b 0
f 1
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A __construct() 0 5 1
A setType() 0 3 1
A getAttribs() 0 3 1
A setSource() 0 3 1
A getSource() 0 3 1
A setAttribs() 0 3 1
1
<?php
2
3
namespace ByTIC\Assets\Assets;
4
5
use ByTIC\Assets\Assets\Asset\AssetAttributes;
6
7
/**
8
 * Class Asset
9
 * @package ByTIC\Assets\Assets
10
 */
11
class Asset
12
{
13
    use Asset\Traits\CanRenderTrait;
14
    use Asset\Traits\HasContentTrait;
15
16
    const TYPE_STYLES = 'STYLES';
17
    const TYPE_SCRIPTS = 'SCRIPTS';
18
19
    /**
20
     * @var string
21
     */
22
    protected $type;
23
24
    protected $source = false;
25
    protected $attribs = [];
26
27
    /**
28
     * Asset constructor.
29
     * @param string $source
30
     * @param string $type
31
     */
32 9
    public function __construct(string $source = '', $type = '')
33
    {
34 9
        $this->source = $source;
35 9
        $this->type = $type;
36 9
        $this->attribs = AssetAttributes::defaultFor($type);
37 9
    }
38
39
    /**
40
     * @return string
41
     */
42 4
    public function getSource(): string
43
    {
44 4
        return $this->source;
45
    }
46
47
    /**
48
     * @param string $source
49
     */
50
    public function setSource(string $source): void
51
    {
52
        $this->source = $source;
53
    }
54
55
    /**
56
     * @return string
57
     */
58 4
    public function getType(): string
59
    {
60 4
        return $this->type;
61
    }
62
63
    /**
64
     * @param string $type
65
     */
66
    public function setType(string $type): void
67
    {
68
        $this->type = $type;
69
    }
70
71
    /**
72
     * @return array
73
     */
74 4
    public function getAttribs(): array
75
    {
76 4
        return $this->attribs;
77
    }
78
79
    /**
80
     * @param array $attribs
81
     */
82
    public function setAttribs(array $attribs): void
83
    {
84
        $this->attribs = $attribs;
85
    }
86
}