1 | <?php |
||
10 | class WebpackWebLibrary implements WebLibraryInterface |
||
11 | { |
||
12 | /** |
||
13 | * The path to the JSON manifest file, relative to ROOT_PATH. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | private $jsonManifestPath; |
||
18 | |||
19 | /** @var null|array<string,string[]> */ |
||
20 | private $filesPaths = null; |
||
21 | |||
22 | /** |
||
23 | * List of libraries this library depends on. |
||
24 | * |
||
25 | * @var array<WebLibraryInterface> |
||
26 | */ |
||
27 | private $dependencies = array(); |
||
28 | |||
29 | /** |
||
30 | * Constructor |
||
31 | * |
||
32 | * @param string $jsonManifestPath The path to the JSON manifest file, relative to ROOT_PATH. |
||
33 | */ |
||
34 | public function __construct($jsonManifestPath) { |
||
37 | |||
38 | /** |
||
39 | * Returns an array of Javascript files to be included for this library. |
||
40 | * |
||
41 | * @return array<string> |
||
42 | * @throws \Exception |
||
43 | */ |
||
44 | public function getJsFiles() { |
||
48 | |||
49 | |||
50 | /** |
||
51 | * Returns an array of CSS files to be included for this library. |
||
52 | * |
||
53 | * @return array<string> |
||
54 | * @throws \Exception |
||
55 | */ |
||
56 | public function getCssFiles() { |
||
60 | |||
61 | /** |
||
62 | * Returns a list of libraries that must be included before this library is included. |
||
63 | * |
||
64 | * @return array<WebLibraryInterface> |
||
65 | */ |
||
66 | public function getDependencies() { |
||
69 | |||
70 | /** |
||
71 | * Returns a list of features provided by this library. |
||
72 | * A feature is typically a string describing what the file contains. |
||
73 | * |
||
74 | * For instance, an object representing the JQuery library would provide the "jquery" feature. |
||
75 | * |
||
76 | * @return array<string> |
||
77 | */ |
||
78 | public function getFeatures() { |
||
81 | |||
82 | /** |
||
83 | * Reads the manifest file and returns an array |
||
84 | * of CSS (key = 'css') and JS (key = 'js') files paths. |
||
85 | * |
||
86 | * @return array<string,string[]> |
||
87 | * @throws \Exception |
||
88 | */ |
||
89 | private function readManifestFile() { |
||
112 | } |