1 | <?php |
||
40 | final class ModulesManager |
||
41 | { |
||
42 | private $vendors = []; |
||
43 | |||
44 | /** |
||
45 | * Add a new path and extract the modules from it |
||
46 | * |
||
47 | * @param string $path The path to the Vendors directory |
||
48 | * |
||
49 | * @return ModulesManager |
||
50 | */ |
||
51 | public function addPath(string $path) : self |
||
66 | |||
67 | /** |
||
68 | * Add a new path and extract the modules from it, using a default Vendor name. |
||
69 | * |
||
70 | * @param string $vendor_name The Vendor name |
||
71 | * @param string $path The path to the Modules directory |
||
72 | * |
||
73 | * @return ModulesManager |
||
74 | */ |
||
75 | public function addVendor(string $vendor_name, string $path) : self |
||
89 | |||
90 | /** |
||
91 | * Add a new path and extract the module, using a default Vendor and Module name. |
||
92 | * |
||
93 | * @param string $vendor_name The Vendor name |
||
94 | * @param string $module_name The Module name |
||
95 | * @param string $path The path to the Module's directory |
||
96 | * |
||
97 | * @return ModulesManager |
||
98 | */ |
||
99 | public function addModule(string $vendor_name, string $module_name, string $path) : self |
||
104 | |||
105 | /** |
||
106 | * Get an array of all the modules listed under a Vendor. |
||
107 | * |
||
108 | * @param string $vendor_name The Vendor name |
||
109 | * |
||
110 | * @return array |
||
111 | */ |
||
112 | public function getVendorModules(string $vendor_name) : array |
||
116 | |||
117 | /** |
||
118 | * Get the root path of a module. |
||
119 | * |
||
120 | * @param string $vendor_name The Vendor's name |
||
121 | * @param string $module_name The Module's name |
||
122 | * |
||
123 | * @return null|string |
||
124 | */ |
||
125 | public function getModulePath(string $vendor_name, string $module_name) : ?string |
||
129 | |||
130 | /** |
||
131 | * Return a generator of every modules. |
||
132 | * Each iterations are formatted like this: |
||
133 | * [$vendor_name, $module_name, $path] |
||
134 | * |
||
135 | * You should use a list() to extract the data. |
||
136 | * |
||
137 | * @return \Generator |
||
138 | */ |
||
139 | public function getAllModules() : \Generator |
||
147 | } |
||
148 |