/**
  * @param \Psr\Http\Message\ServerRequestInterface $request
  * @param \Psr\Http\Message\ResponseInterface      $response
  * @param array                                    $args
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function getAll(Request $request, Response $response, $args)
 {
     $this->logger->info(substr(strrchr(rtrim(__CLASS__, '\\'), '\\'), 1) . ': ' . __FUNCTION__);
     $path = explode('/', $request->getUri()->getPath())[1];
     $arrparams = $request->getParams();
     return $response->write(json_encode($this->dataaccess->getAll($path, $arrparams)));
 }
 /**
  * Validation middleware invokable class.
  *
  * @param \Psr\Http\Message\ServerRequestInterface $request  PSR7 request
  * @param \Psr\Http\Message\ResponseInterface      $response PSR7 response
  * @param callable                                 $next     Next middleware
  *
  * @return \Psr\Http\Message\ResponseInterface
  */
 public function __invoke($request, $response, $next)
 {
     $this->errors = [];
     $params = $request->getParams();
     $this->validate($params, $this->validators);
     return $next($request, $response);
 }
Exemple #3
0
 /**
  * Get the original parameters of the request.
  *
  * @return array
  */
 protected function getParams()
 {
     if (method_exists($this->request, 'getParams')) {
         return $this->request->getParams();
     }
     return array();
 }