diff --git a/src/AbstractResourceListener.php b/src/AbstractResourceListener.php index fff584f..2ab39a3 100644 --- a/src/AbstractResourceListener.php +++ b/src/AbstractResourceListener.php @@ -46,6 +46,9 @@ abstract class AbstractResourceListener implements ListenerAggregateInterface /** * Set the entity_class for the controller config calling this resource + * + * @param string $className + * @return self */ public function setEntityClass($className) { diff --git a/src/Factory/RestControllerFactory.php b/src/Factory/RestControllerFactory.php index 06000e9..753be63 100644 --- a/src/Factory/RestControllerFactory.php +++ b/src/Factory/RestControllerFactory.php @@ -9,6 +9,7 @@ use Interop\Container\ContainerInterface; use Zend\EventManager\Event; use Zend\EventManager\ListenerAggregateInterface; +use Zend\Mvc\Controller\ControllerManager; use Zend\ServiceManager\AbstractFactoryInterface; use Zend\ServiceManager\Exception\ServiceNotCreatedException; use Zend\ServiceManager\Exception\ServiceNotFoundException; @@ -34,7 +35,7 @@ class RestControllerFactory implements AbstractFactoryInterface * * Provided for backwards compatibility; proxies to canCreate(). * - * @param ContainerInterface $controllers + * @param ContainerInterface $container * @param string $requestedName * @return bool */ @@ -89,14 +90,14 @@ public function canCreate(ContainerInterface $container, $requestedName) * * Provided for backwards compatibility; proxies to canCreate(). * - * @param ServiceLocatorInterface $controllers + * @param ServiceLocatorInterface|ControllerManager $serviceLocator * @param string $name * @param string $requestedName * @return bool */ - public function canCreateServiceWithName(ServiceLocatorInterface $controllers, $name, $requestedName) + public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - $container = $controllers->getServiceLocator() ?: $controllers; + $container = $serviceLocator->getServiceLocator() ?: $serviceLocator; return $this->canCreate($container, $requestedName); } @@ -179,15 +180,15 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o * * Provided for backwards compatibility; proxies to __invoke(). * - * @param ServiceLocatorInterface $controllers + * @param ServiceLocatorInterface|ControllerManager $serviceLocator * @param string $name * @param string $requestedName * @return RestController * @throws ServiceNotCreatedException if listener specified is not a ListenerAggregate */ - public function createServiceWithName(ServiceLocatorInterface $controllers, $name, $requestedName) + public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName) { - $container = $controllers->getServiceLocator() ?: $controllers; + $container = $serviceLocator->getServiceLocator() ?: $serviceLocator; return $this($container, $requestedName); } diff --git a/src/Listener/OptionsListener.php b/src/Listener/OptionsListener.php index 5147d79..99b5b43 100644 --- a/src/Listener/OptionsListener.php +++ b/src/Listener/OptionsListener.php @@ -110,8 +110,8 @@ protected function normalizeMethods($methods) /** * Create the Allow header * - * @param array $options - * @param Response $response + * @param array $options + * @param Response $response */ protected function createAllowHeader(array $options, Response $response) { @@ -136,7 +136,7 @@ protected function getOptionsResponse(MvcEvent $event, array $options) } /** - * Prepare a 405 response + * Prepare a 405 ('method not allowed') response * * @param MvcEvent $event * @param array $options @@ -145,7 +145,7 @@ protected function getOptionsResponse(MvcEvent $event, array $options) protected function get405Response(MvcEvent $event, array $options) { $response = $this->getOptionsResponse($event, $options); - $response->setStatusCode(405, 'Method Not Allowed'); + $response->setStatusCode(405); return $response; } @@ -159,7 +159,7 @@ protected function get405Response(MvcEvent $event, array $options) * * @param mixed $config * @param mixed $matches - * @return void + * @return array */ protected function getConfigForControllerAndMatches($config, $matches) { diff --git a/src/Module.php b/src/Module.php index 6f0e57f..13c6013 100644 --- a/src/Module.php +++ b/src/Module.php @@ -6,7 +6,7 @@ namespace ZF\Rest; -use Zend\Loader\StandardAutoloader; +use Zend\Mvc\Application; use Zend\Mvc\MvcEvent; /** @@ -33,6 +33,7 @@ public function getConfig() */ public function onBootstrap(MvcEvent $e) { + /** @var Application $app */ $app = $e->getTarget(); $services = $app->getServiceManager(); $events = $app->getEventManager(); diff --git a/src/Resource.php b/src/Resource.php index 437b5be..14bb1ff 100644 --- a/src/Resource.php +++ b/src/Resource.php @@ -208,7 +208,7 @@ public function setEventManager(EventManagerInterface $events) * * Lazy-instantiates an EM instance if none provided. * - * @return EventManagerInterface + * @return EventManagerInterface|EventManager */ public function getEventManager() { diff --git a/src/ResourceInterface.php b/src/ResourceInterface.php index e3faa9a..d033727 100644 --- a/src/ResourceInterface.php +++ b/src/ResourceInterface.php @@ -7,6 +7,8 @@ namespace ZF\Rest; use Zend\EventManager\EventManagerAwareInterface; +use Zend\InputFilter\InputFilterInterface; +use ZF\MvcAuth\Identity\IdentityInterface; /** * Interface describing operations for a given resource. @@ -65,7 +67,7 @@ public function update($id, $data); /** * Update (replace) an existing collection of records * - * @param array $data + * @param array|object $data * @return array|object */ public function replaceList($data); @@ -79,6 +81,14 @@ public function replaceList($data); */ public function patch($id, $data); + /** + * Partial update an existing collection of records + * + * @param array|object $data + * @return array|object + */ + public function patchList($data); + /** * Delete an existing record * @@ -109,4 +119,26 @@ public function fetch($id); * @return \Zend\Paginator\Paginator */ public function fetchAll(); + + /** + * @param null|IdentityInterface $identity + * @return self + */ + public function setIdentity(IdentityInterface $identity = null); + + /** + * @return null|IdentityInterface + */ + public function getIdentity(); + + /** + * @param null|InputFilterInterface $inputFilter + * @return self + */ + public function setInputFilter(InputFilterInterface $inputFilter = null); + + /** + * @return null|InputFilterInterface + */ + public function getInputFilter(); }