Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[zen-27] Renamed interfaces in Zend\Stdlib, refactored: use Zend\Stdl…

…ib\DispatchableInterface => use Zend\Stdlib\DispatchableInterface as Dispatchable, Zend\Stdlib\RequestInterface => Zend\Stdlib\RequestInterface as Request, ...
  • Loading branch information...
commit d3e604314eb9ecdd80bd3513bdc3276ccd08d422 1 parent 27a0fde
@prolic prolic authored
View
40 library/Zend/Http/Client.php
@@ -25,11 +25,13 @@
Zend\Uri\Http,
Zend\Http\Header\Cookie,
Zend\Http\Header\SetCookie,
+ Zend\Http\Request as HttpRequest,
+ Zend\Http\Response as HttpResponse,
+ Zend\Http\Response\Stream as HttpResponseStream,
Zend\Stdlib\Parameters,
- Zend\Stdlib\ParametersInterface,
- Zend\Stdlib\DispatchableInterface,
- Zend\Stdlib\RequestInterface,
- Zend\Stdlib\ResponseInterface;
+ Zend\Stdlib\DispatchableInterface as Dispatchable,
+ Zend\Stdlib\RequestInterface as Request,
+ Zend\Stdlib\ResponseInterface as Response;
/**
* Http client
@@ -39,7 +41,7 @@
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
-class Client implements DispatchableInterface
+class Client implements Dispatchable
{
/**
* @const string Supported HTTP Authentication methods
@@ -124,7 +126,7 @@ class Client implements DispatchableInterface
'useragent' => 'Zend\Http\Client',
'timeout' => 10,
'adapter' => 'Zend\Http\Client\Adapter\Socket',
- 'httpversion' => Request::VERSION_11,
+ 'httpversion' => HttpRequest::VERSION_11,
'storeresponse' => true,
'keepalive' => false,
'outputstream' => false,
@@ -195,7 +197,7 @@ public function setConfig($config = array())
*
* @param Client\Adapter|string $adapter
* @return Client
- * @throws \Zend\Http\Client\Exception
+ * @throws Client\Exception\InvalidArgumentException
*/
public function setAdapter($adapter)
{
@@ -247,7 +249,7 @@ public function setRequest(Request $request)
public function getRequest()
{
if (empty($this->request)) {
- $this->request = new Request();
+ $this->request = new HttpRequest();
}
return $this->request;
}
@@ -272,7 +274,7 @@ public function setResponse(Response $response)
public function getResponse()
{
if (empty($this->response)) {
- $this->response = new Response();
+ $this->response = new HttpResponse();
}
return $this->response;
}
@@ -352,8 +354,8 @@ public function setMethod($method)
{
$method = $this->getRequest()->setMethod($method)->getMethod();
- if (($method == Request::METHOD_POST || $method == Request::METHOD_PUT ||
- $method == Request::METHOD_DELETE || $method == Request::METHOD_PATCH)
+ if (($method == HttpRequest::METHOD_POST || $method == HttpRequest::METHOD_PUT ||
+ $method == HttpRequest::METHOD_DELETE || $method == HttpRequest::METHOD_PATCH)
&& empty($this->encType)) {
$this->setEncType(self::ENC_URLENCODED);
}
@@ -732,11 +734,11 @@ public function resetParameters($clearCookies = false)
/**
* Dispatch
*
- * @param RequestInterface $request
- * @param ResponseInterface $response
- * @return ResponseInterface
+ * @param Request $request
+ * @param Response $response
+ * @return Response
*/
- public function dispatch(RequestInterface $request, ResponseInterface $response = null)
+ public function dispatch(Request $request, Response $response = null)
{
$response = $this->send($request);
return $response;
@@ -846,14 +848,14 @@ public function send(Request $request = null)
}
// cleanup the adapter
$this->adapter->setOutputStream(null);
- $response = Response\Stream::fromStream($response, $stream);
+ $response = HttpResponseStream::fromStream($response, $stream);
$response->setStreamName($this->streamName);
if (!is_string($this->config['outputstream'])) {
// we used temp name, will need to clean up
$response->setCleanup(true);
}
} else {
- $response = Response::fromString($response);
+ $response = HttpResponse::fromString($response);
}
// Get the cookies from response (if any)
@@ -876,7 +878,7 @@ public function send(Request $request = null)
$response->getStatusCode() == 301))) {
$this->resetParameters();
- $this->setMethod(Request::METHOD_GET);
+ $this->setMethod(HttpRequest::METHOD_GET);
}
// If we got a well formed absolute URI
@@ -1016,7 +1018,7 @@ protected function prepareHeaders($body, $uri)
$headers = array();
// Set the host header
- if ($this->config['httpversion'] == Request::VERSION_11) {
+ if ($this->config['httpversion'] == HttpRequest::VERSION_11) {
$host = $uri->getHost();
// If the port is not default, add it
if (!(($uri->getScheme() == 'http' && $uri->getPort() == 80) ||
View
3  library/Zend/Http/Cookies.php
@@ -2,8 +2,7 @@
namespace Zend\Http;
-use Zend\Stdlib\ParametersInterface,
- Zend\Uri,
+use Zend\Uri,
Zend\Http\Header\Cookie,
Zend\Http\Response;
View
4 library/Zend/Mvc/Application.php
@@ -11,7 +11,7 @@
Zend\Http\PhpEnvironment\Request as PhpHttpRequest,
Zend\Http\PhpEnvironment\Response as PhpHttpResponse,
Zend\Uri\Http as HttpUri,
- Zend\Stdlib\DispatchableInterface,
+ Zend\Stdlib\DispatchableInterface as Dispatchable,
Zend\Stdlib\ArrayUtils,
Zend\Stdlib\Parameters,
Zend\Stdlib\RequestInterface as Request,
@@ -352,7 +352,7 @@ public function dispatch(MvcEvent $e)
$controller->setLocator($locator);
}
- if (!$controller instanceof DispatchableInterface) {
+ if (!$controller instanceof Dispatchable) {
$error = clone $e;
$error->setError(static::ERROR_CONTROLLER_INVALID)
->setController($controllerName)
View
8 library/Zend/Mvc/Controller/ActionController.php
@@ -14,7 +14,7 @@
Zend\Mvc\InjectApplicationEvent,
Zend\Mvc\LocatorAware,
Zend\Mvc\MvcEvent,
- Zend\Stdlib\DispatchableInterface,
+ Zend\Stdlib\DispatchableInterface as Dispatchable,
Zend\Stdlib\RequestInterface as Request,
Zend\Stdlib\ResponseInterface as Response,
Zend\View\Model\ViewModel;
@@ -22,7 +22,7 @@
/**
* Basic action controller
*/
-abstract class ActionController implements DispatchableInterface, EventManagerAware, InjectApplicationEvent, LocatorAware, Pluggable
+abstract class ActionController implements Dispatchable, EventManagerAware, InjectApplicationEvent, LocatorAware, Pluggable
{
//use \Zend\EventManager\ProvidesEvents;
@@ -128,7 +128,7 @@ public function execute(MvcEvent $e)
/**
* Get the request object
*
- * @return RequestInterface
+ * @return Request
*/
public function getRequest()
{
@@ -138,7 +138,7 @@ public function getRequest()
/**
* Get the response object
*
- * @return ResponseInterface
+ * @return Response
*/
public function getResponse()
{
View
4 library/Zend/Mvc/Controller/Plugin/AbstractPlugin.php
@@ -2,13 +2,13 @@
namespace Zend\Mvc\Controller\Plugin;
-use Zend\Stdlib\DispatchableInterface;
+use Zend\Stdlib\DispatchableInterface as Dispatchable;
abstract class AbstractPlugin
{
protected $controller;
- public function setController(DispatchableInterface $controller)
+ public function setController(Dispatchable $controller)
{
$this->controller = $controller;
}
View
4 library/Zend/Mvc/Controller/Plugin/Forward.php
@@ -8,7 +8,7 @@
Zend\Mvc\LocatorAware,
Zend\Mvc\MvcEvent,
Zend\Mvc\Router\RouteMatch,
- Zend\Stdlib\DispatchableInterface;
+ Zend\Stdlib\DispatchableInterface as Dispatchable;
class Forward extends AbstractPlugin
{
@@ -30,7 +30,7 @@ public function dispatch($name, array $params = null)
$locator = $this->getLocator();
$controller = $locator->get($name);
- if (!$controller instanceof DispatchableInterface) {
+ if (!$controller instanceof Dispatchable) {
throw new Exception\DomainException('Can only forward to DispatchableInterface classes; class of type ' . get_class($controller) . ' received');
}
if ($controller instanceof InjectApplicationEvent) {
View
10 library/Zend/Mvc/Controller/PluginBroker.php
@@ -3,7 +3,7 @@
namespace Zend\Mvc\Controller;
use Zend\Loader\PluginBroker as PluginBrokerBase,
- Zend\Stdlib\DispatchableInterface;
+ Zend\Stdlib\DispatchableInterface as Dispatchable;
class PluginBroker extends PluginBrokerBase
{
@@ -13,17 +13,17 @@ class PluginBroker extends PluginBrokerBase
protected $defaultClassLoader = 'Zend\Mvc\Controller\PluginLoader';
/**
- * @var DispatchableInterface
+ * @var Dispatchable
*/
protected $controller;
/**
* Set controller object
*
- * @param DispatchableInterface $controller
+ * @param Dispatchable $controller
* @return PluginBroker
*/
- public function setController(DispatchableInterface $controller)
+ public function setController(Dispatchable $controller)
{
$this->controller = $controller;
return $this;
@@ -32,7 +32,7 @@ public function setController(DispatchableInterface $controller)
/**
* Retrieve controller instance
*
- * @return null|DispatchableInterface
+ * @return null|Dispatchable
*/
public function getController()
{
View
8 library/Zend/Mvc/Controller/RestfulController.php
@@ -11,7 +11,7 @@
Zend\Http\PhpEnvironment\Response as HttpResponse,
Zend\Loader\Broker,
Zend\Loader\Pluggable,
- Zend\Stdlib\DispatchableInterface,
+ Zend\Stdlib\DispatchableInterface as Dispatchable,
Zend\Stdlib\RequestInterface as Request,
Zend\Stdlib\ResponseInterface as Response,
Zend\Mvc\Exception,
@@ -22,7 +22,7 @@
/**
* Abstract RESTful controller
*/
-abstract class RestfulController implements DispatchableInterface, EventManagerAware, InjectApplicationEvent, LocatorAware, Pluggable
+abstract class RestfulController implements Dispatchable, EventManagerAware, InjectApplicationEvent, LocatorAware, Pluggable
{
/**
* @var Broker
@@ -213,7 +213,7 @@ public function execute(MvcEvent $e)
/**
* Get request object
*
- * @return RequestInterface
+ * @return Request
*/
public function getRequest()
{
@@ -226,7 +226,7 @@ public function getRequest()
/**
* Get response object
*
- * @return ResponseInterface
+ * @return Response
*/
public function getResponse()
{
View
6 library/Zend/Mvc/Router/Http/Part.php
@@ -23,7 +23,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\RouteBroker,
Zend\Mvc\Router\Exception,
Zend\Mvc\Router\PriorityList;
@@ -128,11 +128,11 @@ public static function factory($options = array())
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @param int|null $pathOffset
* @return RouteMatch|null
*/
- public function match(RequestInterface $request, $pathOffset = null)
+ public function match(Request $request, $pathOffset = null)
{
if ($pathOffset === null) {
$pathOffset = 0;
View
6 library/Zend/Mvc/Router/Http/Query.php
@@ -25,7 +25,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\Exception;
/**
@@ -92,11 +92,11 @@ public static function factory($options = array())
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @param int|null $pathOffset
* @return RouteMatch
*/
- public function match(RequestInterface $request, $pathOffset = null)
+ public function match(Request $request, $pathOffset = null)
{
$matches = array();
View
6 library/Zend/Mvc/Router/Http/Regex.php
@@ -23,7 +23,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\Exception;
/**
@@ -117,10 +117,10 @@ public static function factory($options = array())
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch
*/
- public function match(RequestInterface $request, $pathOffset = null)
+ public function match(Request $request, $pathOffset = null)
{
if (!method_exists($request, 'uri')) {
return null;
View
6 library/Zend/Mvc/Router/Http/Scheme.php
@@ -23,7 +23,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\Exception;
/**
@@ -94,10 +94,10 @@ public static function factory($options = array())
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch
*/
- public function match(RequestInterface $request)
+ public function match(Request $request)
{
if (!method_exists($request, 'uri')) {
return null;
View
6 library/Zend/Mvc/Router/Http/Segment.php
@@ -23,7 +23,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\Exception;
/**
@@ -312,10 +312,10 @@ protected function buildPath(array $parts, array $mergedParams, $isOptional, $ha
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch
*/
- public function match(RequestInterface $request, $pathOffset = null)
+ public function match(Request $request, $pathOffset = null)
{
if (!method_exists($request, 'uri')) {
return null;
View
6 library/Zend/Mvc/Router/Http/TreeRouteStack.php
@@ -27,7 +27,7 @@
Zend\Mvc\Router\SimpleRouteStack,
Zend\Mvc\Router\Route as BaseRoute,
Zend\Mvc\Router\Http\Route,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Uri\Http as HttpUri;
/**
@@ -134,10 +134,10 @@ protected function routeFromArray($specs)
* match(): defined by BaseRoute interface.
*
* @see BaseRoute::match()
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch
*/
- public function match(RequestInterface $request)
+ public function match(Request $request)
{
if (!method_exists($request, 'uri')) {
return null;
View
6 library/Zend/Mvc/Router/Http/Wildcard.php
@@ -23,7 +23,7 @@
use Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface,
+ Zend\Stdlib\RequestInterface as Request,
Zend\Mvc\Router\Exception;
/**
@@ -114,11 +114,11 @@ public static function factory($options = array())
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @param int|null $pathOffset
* @return RouteMatch
*/
- public function match(RequestInterface $request, $pathOffset = null)
+ public function match(Request $request, $pathOffset = null)
{
if (!method_exists($request, 'uri')) {
return null;
View
6 library/Zend/Mvc/Router/Route.php
@@ -20,7 +20,7 @@
namespace Zend\Mvc\Router;
-use Zend\Stdlib\RequestInterface;
+use Zend\Stdlib\RequestInterface as Request;
/**
* Route interface.
@@ -49,10 +49,10 @@ public static function factory($options = array());
/**
* Match a given request.
*
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch
*/
- public function match(RequestInterface $request);
+ public function match(Request $request);
/**
* Assemble the route.
View
6 library/Zend/Mvc/Router/SimpleRouteStack.php
@@ -24,7 +24,7 @@
ArrayIterator,
Traversable,
Zend\Stdlib\ArrayUtils,
- Zend\Stdlib\RequestInterface;
+ Zend\Stdlib\RequestInterface as Request;
/**
* Simple route stack implementation.
@@ -259,10 +259,10 @@ protected function routeFromArray($specs)
* match(): defined by Route interface.
*
* @see Route::match()
- * @param RequestInterface $request
+ * @param Request $request
* @return RouteMatch|null
*/
- public function match(RequestInterface $request)
+ public function match(Request $request)
{
foreach ($this->routes as $name => $route) {
if (($match = $route->match($request)) instanceof RouteMatch) {
View
6 library/Zend/Mvc/View/DefaultRenderingStrategy.php
@@ -24,7 +24,7 @@
use Zend\EventManager\EventCollection,
Zend\EventManager\ListenerAggregate,
Zend\Mvc\MvcEvent,
- Zend\Stdlib\ResponseInterface,
+ Zend\Stdlib\ResponseInterface as Response,
Zend\View\Model as ViewModel,
Zend\View\View;
@@ -118,12 +118,12 @@ public function getLayoutTemplate()
* Render the view
*
* @param MvcEvent $e
- * @return ResponseInterface
+ * @return Response
*/
public function render(MvcEvent $e)
{
$result = $e->getResult();
- if ($result instanceof ResponseInterface) {
+ if ($result instanceof Response) {
return $result;
}
View
4 library/Zend/Mvc/View/ExceptionStrategy.php
@@ -26,7 +26,7 @@
Zend\Http\Response as HttpResponse,
Zend\Mvc\Application,
Zend\Mvc\MvcEvent,
- Zend\Stdlib\ResponseInterface,
+ Zend\Stdlib\ResponseInterface as Response,
Zend\View\Model as ViewModel;
/**
@@ -146,7 +146,7 @@ public function prepareExceptionViewModel(MvcEvent $e)
// Do nothing if the result is a response object
$result = $e->getResult();
- if ($result instanceof ResponseInterface) {
+ if ($result instanceof Response) {
return;
}
View
4 library/Zend/Mvc/View/RouteNotFoundStrategy.php
@@ -26,7 +26,7 @@
Zend\Http\Response as HttpResponse,
Zend\Mvc\Application,
Zend\Mvc\MvcEvent,
- Zend\Stdlib\ResponseInterface,
+ Zend\Stdlib\ResponseInterface as Response,
Zend\View\Model as ViewModel;
/**
@@ -207,7 +207,7 @@ public function detectNotFoundError(MvcEvent $e)
public function prepareNotFoundViewModel(MvcEvent $e)
{
$vars = $e->getResult();
- if ($vars instanceof ResponseInterface) {
+ if ($vars instanceof Response) {
// Already have a response as the result
return;
}
View
5 library/Zend/Stdlib/DispatchableInterface.php
@@ -1,7 +1,10 @@
<?php
namespace Zend\Stdlib;
+use Zend\Stdlib\ResponseInterface as Response,
+ Zend\Stdlib\RequestInterface as Request;
+
interface DispatchableInterface
{
- public function dispatch(RequestInterface $request, ResponseInterface $response = null);
+ public function dispatch(Request $request, Response $response = null);
}
Please sign in to comment.
Something went wrong with that request. Please try again.