31 lines
622 B
PHP
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);
|
|
}
|
|
}
|