| Total Complexity | 7 |
| Total Lines | 74 |
| Duplicated Lines | 0 % |
| Coverage | 57.89% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 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 |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @param string $type |
||
| 65 | */ |
||
| 66 | public function setType(string $type): void |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return array |
||
| 73 | */ |
||
| 74 | 4 | public function getAttribs(): array |
|
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param array $attribs |
||
| 81 | */ |
||
| 82 | public function setAttribs(array $attribs): void |
||
| 85 | } |
||
| 86 | } |