Files
kupshop/bundles/KupShop/KupShopBundle/Util/KupShopContainer.php
2025-08-02 16:30:27 +02:00

31 lines
622 B
PHP

<?php
namespace KupShop\KupShopBundle\Util;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\ServiceLocator;
class KupShopContainer
{
private $locator;
public function __construct(ServiceLocator $locator)
{
$this->locator = $locator;
}
public function has($id)
{
return $this->locator->has(strtolower($id));
}
public function get($id)
{
if ($this->has($id)) {
return $this->locator->get(strtolower($id));
}
throw new ServiceNotFoundException($id);
}
}