for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the CrossContainerExtension package.
*
* (c) Kamil Kokot <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FriendsOfBehat\CrossContainerExtension;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\HttpKernel\KernelInterface;
final class KernelBasedContainerAccessor implements ContainerAccessor
{
/**
* @var KernelInterface
private $kernel;
* @param KernelInterface $kernel
public function __construct(KernelInterface $kernel)
$this->kernel = $kernel;
}
* {@inheritdoc}
public function getService($id)
return $this->kernel->getContainer()->get($id);
public function getParameters()
$container = $this->kernel->getContainer();
if (!$container instanceof Container) {
throw new \DomainException('Could not get the parameters of kernel\'s container.');
return $container->getParameterBag()->all();