Source of file ContainerAwareCommand.php
Size: 1,137 Bytes - Last Modified: 2013-07-17T08:22:21+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/ContainerAwareCommand.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\FrameworkBundle\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; /** * Command. * * @author Fabien Potencier <fabien@symfony.com> */ abstract class ContainerAwareCommand extends Command implements ContainerAwareInterface { /** * @var ContainerInterface|null */ private $container; /** * @return ContainerInterface */ protected function getContainer() { if (null === $this->container) { $this->container = $this->getApplication()->getKernel()->getContainer(); } return $this->container; } /** * {@inheritdoc} */ public function setContainer(ContainerInterface $container = null) { $this->container = $container; } } |