Files
kupshop/bundles/External/HannahBundle/SAP/Util/SAPLocator.php
2025-08-02 16:30:27 +02:00

31 lines
689 B
PHP

<?php
declare(strict_types=1);
namespace External\HannahBundle\SAP\Util;
use External\HannahBundle\SAP\Exception\SAPException;
use External\HannahBundle\SAP\Synchronizer\SynchronizerInterface;
use Symfony\Component\DependencyInjection\ServiceLocator;
class SAPLocator
{
private $locator;
public function __construct(ServiceLocator $locator)
{
$this->locator = $locator;
}
public function get(string $type): SynchronizerInterface
{
if (!$this->locator->has($type)) {
throw new SAPException(
sprintf('Unknown synchronizer type: %s', $type)
);
}
return $this->locator->get($type);
}
}