Initial commit
This commit is contained in:
29
src/StaticBuilder.php
Normal file
29
src/StaticBuilder.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user