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

Asset::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 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
}