30 lines
600 B
PHP
30 lines
600 B
PHP
|
<?php
|
||
|
|
||
|
namespace NoccyLabs\Hotwire;
|
||
|
|
||
|
use RecursiveIteratorIterator;
|
||
|
use RecursiveFilesystemIterator;
|
||
|
use Psr\Container\ContainerInterface;
|
||
|
|
||
|
class StaticBuilder implements BuilderInterface
|
||
|
{
|
||
|
public function __construct(
|
||
|
private array $services = []
|
||
|
)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public function addService(string $id, array $arguments): void
|
||
|
{
|
||
|
$this->services[$id] = $arguments;
|
||
|
}
|
||
|
|
||
|
public function buildServices(Container $container): void
|
||
|
{
|
||
|
foreach ($this->services as $id=>$args) {
|
||
|
$container->addShared($id)->addArguments($args);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|