Files
api/common/Factory/Mapper.php
2022-06-13 21:36:52 -04:00

23 lines
508 B
PHP

<?php
namespace Incoviba\API\Common\Factory;
use Incoviba\Mapper\Mapper as BaseMapper;
use Psr\Container\ContainerInterface;
class Mapper
{
protected ContainerInterface $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function get(string $name): BaseMapper
{
if (!class_exists($name)) {
throw new \InvalidArgumentException();
}
return $this->container->get($name);
}
}