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 | protected $attrs = array(); |
||
|
|||
39 | protected $components = array(); |
||
40 | protected $assets_uri; |
||
41 | |||
42 | /** |
||
43 | * Asset constructor set asset ID |
||
44 | * |
||
45 | * @param string $id |
||
46 | */ |
||
47 | 7 | public function __construct(string $id, string $assets_uri) |
|
53 | |||
54 | 4 | public function init() |
|
57 | |||
58 | /** |
||
59 | * Set ID attribute of the asset |
||
60 | * |
||
61 | * {@inheritdoc} |
||
62 | * |
||
63 | * @param string $id |
||
64 | * @return AssetsInterface |
||
65 | */ |
||
66 | 7 | public function id(string $id = '0'): AssetsInterface |
|
71 | |||
72 | /** |
||
73 | * Set Assets src attribute |
||
74 | * |
||
75 | * {@inheritdoc} |
||
76 | * |
||
77 | * @param null|string $src |
||
78 | * @return AssetsInterface |
||
79 | */ |
||
80 | 1 | public function src(string $src = null): AssetsInterface |
|
85 | |||
86 | /** |
||
87 | * Create and add DOM element of the asset |
||
88 | * |
||
89 | * @param \DOMDocument $aframe_dom |
||
90 | * @return \DOMElement |
||
91 | */ |
||
92 | 3 | public function domElement(\DOMDocument &$aframe_dom): DOMElement |
|
109 | |||
110 | /** |
||
111 | * Set Dom element name |
||
112 | * |
||
113 | * @param string $element_tag |
||
114 | * @return void |
||
115 | */ |
||
116 | 3 | public function setDomElementTag(string $element_tag) |
|
120 | |||
121 | /** |
||
122 | * Create asset URL |
||
123 | * |
||
124 | * If it is remote resource use fully qualified |
||
125 | * URL instead creating it relative to local assets url |
||
126 | * |
||
127 | * @param string $url |
||
128 | * @return string |
||
129 | */ |
||
130 | 1 | private function createURL(string $url) |
|
134 | |||
135 | /** |
||
136 | * Append DOM attributes no set by components |
||
137 | * |
||
138 | * @param \DOMElement $a_entity |
||
139 | */ |
||
140 | 3 | private function appendAttributes(\DOMElement &$a_entity) |
|
146 | |||
147 | 3 | private function setAttribute(&$a_entity, $attr, $val) |
|
154 | } |
||
155 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.