php-spark/src/Plugin/PluginManager.php

27 lines
453 B
PHP
Raw Normal View History

2021-12-07 16:26:34 +00:00
<?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];
}
}