1 | <?php |
||
18 | class PluginRepository |
||
19 | { |
||
20 | /** |
||
21 | * @var array array of \Phile\Plugin\PluginDirectory |
||
22 | */ |
||
23 | protected $directories = []; |
||
24 | |||
25 | /** |
||
26 | * @var Event the event-bus |
||
27 | */ |
||
28 | protected $eventBus; |
||
29 | |||
30 | 31 | public function __construct(Event $eventBus) |
|
34 | |||
35 | /** |
||
36 | * Adds plugin directory to repository |
||
37 | * |
||
38 | * @param string $directory path to plugin-directory |
||
39 | * @return self |
||
40 | */ |
||
41 | 31 | public function addDirectory(string $directory): self |
|
46 | |||
47 | /** |
||
48 | * Loads all plug-ins |
||
49 | * |
||
50 | * @param Config $config phile config with plugin config |
||
51 | * @throws Exception\PluginException |
||
52 | */ |
||
53 | 31 | public function load(Config $config): void |
|
87 | |||
88 | /** |
||
89 | * Loads and returns single plugin |
||
90 | * |
||
91 | * @param string $pluginKey plugin key e.g. 'phile\errorHandler' |
||
92 | * @return AbstractPlugin Plugin class |
||
93 | * @throws PluginException |
||
94 | */ |
||
95 | 31 | protected function loadSingle(string $pluginKey, Config $config): AbstractPlugin |
|
114 | } |
||
115 |