27 lines
453 B
PHP
27 lines
453 B
PHP
<?php
|
|
|
|
namespace Spark\Plugin;
|
|
|
|
use SparkPlug;
|
|
|
|
class PluginManager
|
|
{
|
|
private $plugins = [];
|
|
|
|
public function registerPlugin(string $name, SparkPlug $plugin)
|
|
{
|
|
$this->plugins[$name] = $plugin;
|
|
}
|
|
|
|
public function initializePlugins()
|
|
{
|
|
foreach ($this->plugins as $plugin) {
|
|
$plugin->load();
|
|
}
|
|
}
|
|
|
|
public function getPlugin(string $name)
|
|
{
|
|
return $this->plugins[$name];
|
|
}
|
|
} |