for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of CacheTool.
*
* (c) Samuel Gordalina <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CacheTool\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class AbstractCommand extends Command implements ContainerAwareInterface
{
/**
* @var ContainerInterface
protected $container;
* @return CacheTool
protected function getCacheTool()
return $this->container->get('cachetool');
}
* @param string $extension
protected function ensureExtensionLoaded($extension)
if (!$this->getCacheTool()->extension_loaded($extension)) {
throw new \Exception("Extension `{$extension}` is not loaded");
* {@inheritdoc}
public function setContainer(ContainerInterface $container = null)
$this->container = $container;