Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
[zen-27] Renamed interfaces in Zend\Mvc
Browse files Browse the repository at this point in the history
  • Loading branch information
prolic committed Apr 21, 2012
1 parent 52120c3 commit cb731b9
Show file tree
Hide file tree
Showing 53 changed files with 208 additions and 219 deletions.
14 changes: 7 additions & 7 deletions library/Zend/Mvc/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* application, first routing, then dispatching the discovered controller. A
* response will then be returned, which may then be sent to the caller.
*/
class Application implements AppContext
class Application implements ApplicationInterface
{
const ERROR_CONTROLLER_CANNOT_DISPATCH = 'error-controller-cannot-dispatch';
const ERROR_CONTROLLER_NOT_FOUND = 'error-controller-not-found';
Expand Down Expand Up @@ -93,10 +93,10 @@ public function setResponse(Response $response)
*
* A router should return a metadata object containing a controller key.
*
* @param Router\RouteStack $router
* @param Router\RouteStackInterface $router
* @return Application
*/
public function setRouter(Router\RouteStack $router)
public function setRouter(Router\RouteStackInterface $router)
{
$this->router = $router;
return $this;
Expand Down Expand Up @@ -157,7 +157,7 @@ public function getResponse()
*/
public function getRouter()
{
if (!$this->router instanceof Router\RouteStack) {
if (!$this->router instanceof Router\RouteStackInterface) {
$this->setRouter(new Router\SimpleRouteStack());
}
return $this->router;
Expand Down Expand Up @@ -284,7 +284,7 @@ protected function completeRequest(MvcEvent $event)
}

/**
* Route the request
* RouteInterface the request
*
* @param MvcEvent $e
* @return Router\RouteMatch
Expand Down Expand Up @@ -348,7 +348,7 @@ public function dispatch(MvcEvent $e)
goto complete;
}

if ($controller instanceof LocatorAware) {
if ($controller instanceof LocatorAwareInterface) {
$controller->setLocator($locator);
}

Expand All @@ -370,7 +370,7 @@ public function dispatch(MvcEvent $e)
$request = $e->getRequest();
$response = $this->getResponse();

if ($controller instanceof InjectApplicationEvent) {
if ($controller instanceof InjectApplicationEventInterface) {
$controller->setEvent($e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
Zend\Stdlib\RequestDescription as Request,
Zend\Stdlib\ResponseDescription as Response;

interface AppContext extends EventManagerAware
interface ApplicationInterface extends EventManagerAware
{
/**
* Set a service locator/DI object
*
* @param Locator $locator
* @return AppContext
* @return ApplicationInterface
*/
public function setLocator(Locator $locator);

/**
* Set request object that will be consumed
*
* @param Request $request
* @return AppContext
* @return ApplicationInterface
*/
public function setRequest(Request $request);

/**
* Set response object that will be returned
*
* @param Response $request
* @return AppContext
* @return ApplicationInterface
*/
public function setResponse(Response $response);

Expand All @@ -38,10 +38,10 @@ public function setResponse(Response $response);
*
* A router should return a metadata object containing a controller key.
*
* @param Router\RouteStack $router
* @return AppContext
* @param Router\RouteStackInterface $router
* @return ApplicationInterface
*/
public function setRouter(Router\RouteStack $router);
public function setRouter(Router\RouteStackInterface $router);

/**
* Get the locator object
Expand Down
18 changes: 9 additions & 9 deletions library/Zend/Mvc/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Zend\EventManager\StaticEventManager,
Zend\Mvc\Router\Http\TreeRouteStack as Router;

class Bootstrap implements Bootstrapper, EventManagerAware
class Bootstrap implements BootstrapInterface, EventManagerAware
{
/**
* @var \Zend\Config\Config
Expand Down Expand Up @@ -78,7 +78,7 @@ public function events()
* @param Application $application
* @return void
*/
public function bootstrap(AppContext $application)
public function bootstrap(ApplicationInterface $application)
{
$this->setupLocator($application);
$this->setupRouter($application);
Expand All @@ -90,17 +90,17 @@ public function bootstrap(AppContext $application)
/**
* Sets up the locator based on the configuration provided
*
* @param AppContext $application
* @param ApplicationInterface $application
* @return void
*/
protected function setupLocator(AppContext $application)
protected function setupLocator(ApplicationInterface $application)
{
$di = new Di;
$di->instanceManager()->addTypePreference('Zend\Di\Locator', $di);

// Default configuration for common MVC classes
$diConfig = new DiConfiguration(array('definition' => array('class' => array(
'Zend\Mvc\Router\RouteStack' => array(
'Zend\Mvc\Router\RouteStackInterface' => array(
'instantiator' => array(
'Zend\Mvc\Router\Http\TreeRouteStack',
'factory'
Expand Down Expand Up @@ -243,9 +243,9 @@ protected function setupLocator(AppContext $application)
* @param Application $application
* @return void
*/
protected function setupRouter(AppContext $application)
protected function setupRouter(ApplicationInterface $application)
{
$router = $application->getLocator()->get('Zend\Mvc\Router\RouteStack');
$router = $application->getLocator()->get('Zend\Mvc\Router\RouteStackInterface');
$application->setRouter($router);
}

Expand Down Expand Up @@ -304,10 +304,10 @@ protected function setupView($application)
* Triggers with the keys "application" and "config", the latter pointing
* to the Module Manager attached to the bootstrap.
*
* @param AppContext $application
* @param ApplicationInterface $application
* @return void
*/
protected function setupEvents(AppContext $application)
protected function setupEvents(ApplicationInterface $application)
{
$params = array(
'application' => $application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
* @copyright Copyright (C) 2005-2011, Zend Technologies, Inc.
* @license New BSD {@link http://framework.zend.com/license}
*/
interface Bootstrapper
interface BootstrapInterface
{
/**
* Bootstrap an application
*
* @param AppContext $application
* @param ApplicationInterface $application
* @return void
*/
public function bootstrap(AppContext $application);
public function bootstrap(ApplicationInterface $application);
}
6 changes: 3 additions & 3 deletions library/Zend/Mvc/Controller/ActionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
Zend\Loader\Broker,
Zend\Loader\Pluggable,
Zend\Mvc\Exception,
Zend\Mvc\InjectApplicationEvent,
Zend\Mvc\LocatorAware,
Zend\Mvc\InjectApplicationEventInterface,
Zend\Mvc\LocatorAwareInterface,
Zend\Mvc\MvcEvent,
Zend\Stdlib\Dispatchable,
Zend\Stdlib\RequestDescription as Request,
Expand All @@ -22,7 +22,7 @@
/**
* Basic action controller
*/
abstract class ActionController implements Dispatchable, EventManagerAware, InjectApplicationEvent, LocatorAware, Pluggable
abstract class ActionController implements Dispatchable, EventManagerAware, InjectApplicationEventInterface, LocatorAwareInterface, Pluggable
{
//use \Zend\EventManager\ProvidesEvents;

Expand Down
18 changes: 9 additions & 9 deletions library/Zend/Mvc/Controller/Plugin/Forward.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Zend\Mvc\Controller\Plugin;

use Zend\Di\Locator,
Zend\Mvc\InjectApplicationEvent,
Zend\Mvc\InjectApplicationEventInterface,
Zend\Mvc\Exception,
Zend\Mvc\LocatorAware,
Zend\Mvc\LocatorAwareInterface,
Zend\Mvc\MvcEvent,
Zend\Mvc\Router\RouteMatch,
Zend\Stdlib\Dispatchable;
Expand All @@ -21,7 +21,7 @@ class Forward extends AbstractPlugin
* @param string $name Controller name; either a class name or an alias used in the DI container or service locator
* @param null|array $params Parameters with which to seed a custom RouteMatch object for the new controller
* @return mixed
* @throws Exception\DomainException if composed controller does not define InjectApplicationEvent
* @throws Exception\DomainException if composed controller does not define InjectApplicationEventInterface
* or Locator aware; or if the discovered controller is not dispatchable
*/
public function dispatch($name, array $params = null)
Expand All @@ -33,10 +33,10 @@ public function dispatch($name, array $params = null)
if (!$controller instanceof Dispatchable) {
throw new Exception\DomainException('Can only forward to Dispatchable classes; class of type ' . get_class($controller) . ' received');
}
if ($controller instanceof InjectApplicationEvent) {
if ($controller instanceof InjectApplicationEventInterface) {
$controller->setEvent($event);
}
if ($controller instanceof LocatorAware) {
if ($controller instanceof LocatorAwareInterface) {
$controller->setLocator($locator);
}

Expand Down Expand Up @@ -71,8 +71,8 @@ protected function getLocator()

$controller = $this->getController();

if (!$controller instanceof LocatorAware) {
throw new Exception\DomainException('Forward plugin requires controller implements LocatorAware');
if (!$controller instanceof LocatorAwareInterface) {
throw new Exception\DomainException('Forward plugin requires controller implements LocatorAwareInterface');
}
$locator = $controller->getLocator();
if (!$locator instanceof Locator) {
Expand All @@ -95,8 +95,8 @@ protected function getEvent()
}

$controller = $this->getController();
if (!$controller instanceof InjectApplicationEvent) {
throw new Exception\DomainException('Redirect plugin requires a controller that implements InjectApplicationEvent');
if (!$controller instanceof InjectApplicationEventInterface) {
throw new Exception\DomainException('Redirect plugin requires a controller that implements InjectApplicationEventInterface');
}

$event = $controller->getEvent();
Expand Down
6 changes: 3 additions & 3 deletions library/Zend/Mvc/Controller/Plugin/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace Zend\Mvc\Controller\Plugin;

use Zend\Mvc\InjectApplicationEvent,
use Zend\Mvc\InjectApplicationEventInterface,
Zend\Mvc\Exception,
Zend\Mvc\MvcEvent,
Zend\View\Model;
Expand Down Expand Up @@ -83,8 +83,8 @@ protected function getEvent()
}

$controller = $this->getController();
if (!$controller instanceof InjectApplicationEvent) {
throw new Exception\DomainException('Layout plugin requires a controller that implements InjectApplicationEvent');
if (!$controller instanceof InjectApplicationEventInterface) {
throw new Exception\DomainException('Layout plugin requires a controller that implements InjectApplicationEventInterface');
}

$event = $controller->getEvent();
Expand Down
18 changes: 9 additions & 9 deletions library/Zend/Mvc/Controller/Plugin/Redirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Zend\Mvc\Controller\Plugin;

use Zend\Http\Response,
Zend\Mvc\InjectApplicationEvent,
Zend\Mvc\InjectApplicationEventInterface,
Zend\Mvc\Exception,
Zend\Mvc\MvcEvent,
Zend\Mvc\Router\RouteStack;
Zend\Mvc\Router\RouteStackInterface;

/**
* @todo allow specifying status code as a default, or as an option to methods
Expand All @@ -20,11 +20,11 @@ class Redirect extends AbstractPlugin
/**
* Generates a URL based on a route
*
* @param string $route Route name
* @param string $route RouteInterface name
* @param array $params Parameters to use in url generation, if any
* @param array $options Route-specific options to use in url generation, if any
* @param array $options RouteInterface-specific options to use in url generation, if any
* @return Response
* @throws Exception\DomainException if composed controller does not implement InjectApplicationEvent, or
* @throws Exception\DomainException if composed controller does not implement InjectApplicationEventInterface, or
* router cannot be found in controller event
*/
public function toRoute($route, array $params = array(), array $options = array())
Expand Down Expand Up @@ -56,7 +56,7 @@ public function toUrl($url)
/**
* Get the router
*
* @return RouteStack
* @return RouteStackInterface
* @throws Exception\DomainException if unable to find router
*/
protected function getRouter()
Expand All @@ -67,7 +67,7 @@ protected function getRouter()

$event = $this->getEvent();
$router = $event->getRouter();
if (!$router instanceof RouteStack) {
if (!$router instanceof RouteStackInterface) {
throw new Exception\DomainException('Redirect plugin requires event compose a router');
}
$this->router = $router;
Expand Down Expand Up @@ -108,8 +108,8 @@ protected function getEvent()
}

$controller = $this->getController();
if (!$controller instanceof InjectApplicationEvent) {
throw new Exception\DomainException('Redirect plugin requires a controller that implements InjectApplicationEvent');
if (!$controller instanceof InjectApplicationEventInterface) {
throw new Exception\DomainException('Redirect plugin requires a controller that implements InjectApplicationEventInterface');
}

$event = $controller->getEvent();
Expand Down
16 changes: 8 additions & 8 deletions library/Zend/Mvc/Controller/Plugin/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

namespace Zend\Mvc\Controller\Plugin;

use Zend\Mvc\InjectApplicationEvent,
use Zend\Mvc\InjectApplicationEventInterface,
Zend\Mvc\Exception,
Zend\Mvc\MvcEvent,
Zend\Mvc\Router\RouteStack;
Zend\Mvc\Router\RouteStackInterface;

class Url extends AbstractPlugin
{
/**
* Generates a URL based on a route
*
* @param string $route Route name
* @param string $route RouteInterface name
* @param array $params Parameters to use in url generation, if any
* @param array $options Route-specific options to use in url generation, if any
* @param array $options RouteInterface-specific options to use in url generation, if any
* @return string
* @throws Exception\DomainException if composed controller does not implement InjectApplicationEvent, or
* @throws Exception\DomainException if composed controller does not implement InjectApplicationEventInterface, or
* router cannot be found in controller event
*/
public function fromRoute($route, array $params = array(), array $options = array())
{
$controller = $this->getController();
if (!$controller instanceof InjectApplicationEvent) {
throw new Exception\DomainException('Url plugin requires a controller that implements InjectApplicationEvent');
if (!$controller instanceof InjectApplicationEventInterface) {
throw new Exception\DomainException('Url plugin requires a controller that implements InjectApplicationEventInterface');
}

$event = $controller->getEvent();
Expand All @@ -33,7 +33,7 @@ public function fromRoute($route, array $params = array(), array $options = arra
} elseif ($event instanceof Event) {
$router = $event->getParam('router', false);
}
if (!$router instanceof RouteStack) {
if (!$router instanceof RouteStackInterface) {
throw new Exception\DomainException('Url plugin requires that controller event compose a router; none found');
}

Expand Down
Loading

0 comments on commit cb731b9

Please sign in to comment.