Skip to content

Commit

Permalink
Abstract console controller
Browse files Browse the repository at this point in the history
  • Loading branch information
snapshotpl committed Nov 12, 2013
1 parent 883b818 commit 3577cd2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions library/Zend/Mvc/Controller/AbstractConsoleController.php
@@ -0,0 +1,32 @@
<?php

/**
* Description of AbstractConsoleController
*
* @author Witold Wasiczko <witold@wasiczko.pl>
*/
namespace Zend\Mvc\Controller;

use Zend\Console\Request as ConsoleRequest;
use Zend\Stdlib\RequestInterface;
use Zend\Stdlib\ResponseInterface;

class AbstractConsoleController extends AbstractActionController
{
protected $console;

public function setConsole(Zend\Console\Adapter\AdapterInterface $console)
{
$this->console = $console;
}

public function dispatch(RequestInterface $request, ResponseInterface $response = null)
{
if (! $request instanceof ConsoleRequest) {
throw new Exception\InvalidArgumentException(
'Expected an Console request');
}

parent::dispatch($request, $response);
}
}

0 comments on commit 3577cd2

Please sign in to comment.