1 | <?php |
||
33 | abstract class ComponentAbstract implements ComponentInterface |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * Array of dom attributes |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $dom_attributes = array(); |
||
42 | |||
43 | /** |
||
44 | * Array of component scripts |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $component_scripts = array(); |
||
49 | |||
50 | /** |
||
51 | * Name of DOM attribute |
||
52 | * |
||
53 | * @var unknown |
||
54 | */ |
||
55 | protected $dom_attribute_name; |
||
56 | |||
57 | /** |
||
58 | * Loaded Component Method object |
||
59 | * |
||
60 | * @var object |
||
61 | */ |
||
62 | protected $methodProvider; |
||
63 | |||
64 | /** |
||
65 | * Component Constructor |
||
66 | */ |
||
67 | 51 | public function __construct() |
|
72 | |||
73 | /** |
||
74 | * Call passes all calls to no existing methods to self::methodProvider |
||
75 | * |
||
76 | * @param string $method |
||
77 | * @param array $args |
||
78 | * @throws InvalidComponentMethodException |
||
79 | */ |
||
80 | 51 | public function __call(string $method, $args) |
|
95 | |||
96 | /** |
||
97 | * Set class providing component methods |
||
98 | * |
||
99 | * @param string $method_provider |
||
100 | * @return void |
||
101 | */ |
||
102 | 51 | public function setMethodProvider(string $method_provider = 'DefaultMethods') |
|
107 | |||
108 | /** |
||
109 | * Does component have DOM Atributes |
||
110 | * |
||
111 | * {@inheritdoc} |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | 5 | public function hasDOMAttributes(): bool |
|
119 | |||
120 | /** |
||
121 | * Get component DOM Atributes array |
||
122 | * |
||
123 | * {@inheritdoc} |
||
124 | * |
||
125 | * @return bool |
||
|
|||
126 | */ |
||
127 | 15 | public function getDOMAttributesArray(): array |
|
131 | |||
132 | /** |
||
133 | * Get Component scripts |
||
134 | * |
||
135 | * {@inheritdoc} |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | 2 | public function getComponentScripts(): array |
|
143 | |||
144 | /** |
||
145 | * Add component scripts |
||
146 | * |
||
147 | * {@inheritdoc} |
||
148 | * |
||
149 | */ |
||
150 | 1 | public function addComponentScripts(string $vendor_component, string $script_name) |
|
154 | |||
155 | /** |
||
156 | * Get DOMAttr for the entity |
||
157 | * |
||
158 | * @return DOMAttr |
||
159 | */ |
||
160 | 5 | public function getDOMAttr(): DOMAttr |
|
164 | |||
165 | /** |
||
166 | * Get Dom attribute name |
||
167 | * |
||
168 | * @return string |
||
169 | */ |
||
170 | 5 | public function getDomAttributeName(): string |
|
174 | |||
175 | /** |
||
176 | * Set Dom Attribute name |
||
177 | * |
||
178 | * @return void |
||
179 | */ |
||
180 | 51 | public function setDomAttributeName(string $dom_attribute_name) |
|
184 | } |
||
185 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.If the return type contains the type array, this check recommends the use of a more specific type like
String[]
orarray<String>
.