Files
models/src/Implement/Model/Factory.php

30 lines
767 B
PHP

<?php
namespace ProVM\Implement\Model;
use Psr\Container\ContainerInterface;
use ProVM\Concept\Model\Factory as FactoryInterface;
use ProVM\Concept\Model\Repository;
class Factory implements FactoryInterface
{
public function __construct(ContainerInterface $container)
{
$this->setContainer($container);
}
protected ContainerInterface $container;
public function setContainer(ContainerInterface $container): FactoryInterface
{
$this->container = $container;
return $this;
}
public function getContainer(): ContainerInterface
{
return $this->container;
}
public function get(string $repository_class): Repository
{
return $this->getContainer()->get($repository_class);
}
}