1 | <?php |
||
29 | abstract class AssetsAbstract implements AssetsInterface |
||
30 | { |
||
31 | |||
32 | /** |
||
33 | * DOM tag name of asset item |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $element_tag = 'a-asset-item'; |
||
38 | |||
39 | protected $attrs = array(); |
||
40 | |||
41 | protected $components = array(); |
||
42 | /** |
||
43 | * Asset constructor set asset ID |
||
44 | * |
||
45 | * @param string $id |
||
46 | */ |
||
47 | 3 | public function __construct(string $id) |
|
51 | |||
52 | /** |
||
53 | * Set ID attribute of the asset |
||
54 | * |
||
55 | * {@inheritdoc} |
||
56 | * |
||
57 | * @param string $id |
||
58 | * @return AssetsInterface |
||
59 | */ |
||
60 | 6 | public function id(string $id = 'untitled'): AssetsInterface |
|
65 | |||
66 | /** |
||
67 | * Set Assets src attribute |
||
68 | * |
||
69 | * {@inheritdoc} |
||
70 | * |
||
71 | * @param null|string $src |
||
72 | * @return AssetsInterface |
||
73 | */ |
||
74 | 1 | public function src(string $src = null): AssetsInterface |
|
79 | |||
80 | /** |
||
81 | * Create and add DOM element of the asset |
||
82 | * |
||
83 | * @param \DOMDocument $aframe_dom |
||
84 | * @return \DOMElement |
||
85 | */ |
||
86 | 2 | public function domElement(\DOMDocument &$aframe_dom): DOMElement |
|
103 | |||
104 | /** |
||
105 | * Set Dom element name |
||
106 | * |
||
107 | * @param string $element_tag |
||
108 | * @return void |
||
109 | */ |
||
110 | 3 | public function setDomElementTag(string $element_tag) |
|
114 | |||
115 | /** |
||
116 | * Append DOM attributes no set by components |
||
117 | * |
||
118 | * @param \DOMElement $a_entity |
||
119 | */ |
||
120 | 2 | private function appendAttributes(\DOMElement &$a_entity) |
|
126 | |||
127 | 2 | private function setAttribute(&$a_entity, $attr, $val) |
|
134 | } |
||
135 |