23 lines
508 B
PHP
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);
|
||
|
}
|
||
|
}
|