1 | <?php |
||
9 | class WebLibrary implements WebLibraryInterface { |
||
10 | |||
11 | |||
12 | /** |
||
13 | * List of JS files to add in header. |
||
14 | * If you don't specify http:// or https:// and if your URL does not start with /, the file is considered to be relative to ROOT_URL. |
||
15 | * |
||
16 | * @var array<string> |
||
17 | */ |
||
18 | private $jsFiles = array(); |
||
19 | |||
20 | /** |
||
21 | * List of CSS files to add in header. |
||
22 | * If you don't specify http:// or https:// and if your URL does not start with /, the file is considered to be relative to ROOT_URL. |
||
23 | * |
||
24 | * @var array<string> |
||
25 | */ |
||
26 | private $cssFiles = array(); |
||
27 | |||
28 | /** |
||
29 | * List of libraries this library depends on. |
||
30 | * |
||
31 | * @var array<WebLibraryInterface> |
||
32 | */ |
||
33 | private $dependencies = array(); |
||
34 | |||
35 | /** |
||
36 | * Boolean whether the dependencies are called asynchronously |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | private $async = false; |
||
41 | |||
42 | |||
43 | /** |
||
44 | * Constructor |
||
45 | * |
||
46 | * @param string[] $jsFiles List of JS files to add in header. If you don't specify http:// or https:// and if your URL does not start with /, the file is considered to be relative to ROOT_URL. |
||
47 | * @param string[] $cssFiles List of CSS files to add in header. If you don't specify http:// or https:// and if your URL does not start with /, the file is considered to be relative to ROOT_URL. |
||
48 | */ |
||
49 | |||
50 | public function __construct($jsFiles = array(), $cssFiles = array() ) { |
||
54 | |||
55 | /** |
||
56 | * Returns an array of Javascript files to be included for this library. |
||
57 | * |
||
58 | * @return array<string> |
||
59 | */ |
||
60 | public function getJsFiles() { |
||
63 | |||
64 | /** |
||
65 | * List of JS files to put in the web library. |
||
66 | * <p>If you don't specify http:// or https:// and if the file does not start with /, the file is considered to be relative to ROOT_URL.</p> |
||
67 | * <div class="info">It is a good practice to make sure the file does not start with /, http:// or https:// (unless you are using a CDN).</div> |
||
68 | * |
||
69 | * @Property |
||
70 | * @param array<string> $jsFiles |
||
71 | */ |
||
72 | public function setJsFiles($jsFiles) { |
||
75 | |||
76 | /** |
||
77 | * Adds a JS file to the web library. |
||
78 | * <p>If you don't specify http:// or https:// and if the file does not start with /, the file is considered to be relative to ROOT_URL.</p> |
||
79 | * <div class="info">It is a good practice to make sure the file does not start with /, http:// or https:// (unless you are using a CDN).</div> |
||
80 | * |
||
81 | * @param string $jsFile |
||
82 | */ |
||
83 | public function addJsFile($jsFile) { |
||
86 | |||
87 | /** |
||
88 | * Returns an array of CSS files to be included for this library. |
||
89 | * |
||
90 | * @return array<string> |
||
91 | */ |
||
92 | public function getCssFiles() { |
||
95 | |||
96 | /** |
||
97 | * List of CSS files to add in web library. |
||
98 | * <p>If you don't specify http:// or https:// and if the file does not start with /, the file is considered to be relative to ROOT_URL.</p> |
||
99 | * <div class="info">It is a good practice to make sure the file does not start with /, http:// or https:// (unless you are using a CDN).</div> |
||
100 | * |
||
101 | * @Property |
||
102 | * @param array<string> $cssFiles |
||
103 | */ |
||
104 | public function setCssFiles($cssFiles) { |
||
107 | |||
108 | /** |
||
109 | * Adds a CSS file to the web library. |
||
110 | * <p>If you don't specify http:// or https:// and if the file does not start with /, the file is considered to be relative to ROOT_URL.</p> |
||
111 | * <div class="info">It is a good practice to make sure the file does not start with /, http:// or https:// (unless you are using a CDN).</div> |
||
112 | * |
||
113 | * @param string $jsFile |
||
|
|||
114 | */ |
||
115 | public function addCssFile($cssFile) { |
||
118 | |||
119 | /** |
||
120 | * Returns a list of libraries that must be included before this library is included. |
||
121 | * |
||
122 | * @return array<WebLibraryInterface> |
||
123 | */ |
||
124 | public function getDependencies() { |
||
127 | |||
128 | /** |
||
129 | * Returns a list of features provided by this library. |
||
130 | * A feature is typically a string describing what the file contains. |
||
131 | * |
||
132 | * For instance, an object representing the JQuery library would provide the "jquery" feature. |
||
133 | * |
||
134 | * @return array<string> |
||
135 | */ |
||
136 | public function getFeatures() { |
||
139 | |||
140 | /** |
||
141 | * The list of all libraries that are needed for this library |
||
142 | * |
||
143 | * @Property |
||
144 | * @param array<WebLibraryInterface> $libraries |
||
145 | */ |
||
146 | public function setDependencies($libraries) { |
||
149 | |||
150 | /** |
||
151 | * Returns if the dependencies are loaded asynchronously |
||
152 | * |
||
153 | * @return bool |
||
154 | */ |
||
155 | public function isAsync() { |
||
158 | |||
159 | /** |
||
160 | * Set if the dependencies are loaded asynchronously |
||
161 | * |
||
162 | * @Property |
||
163 | * @param bool $async |
||
164 | */ |
||
165 | public function setIsAsync($async) { |
||
168 | } |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.