0.1.0
This commit is contained in:
22
common/Factory/Mapper.php
Normal file
22
common/Factory/Mapper.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user