Exemple #1
0
 public function __construct(Request $request, Response $response, DB $db)
 {
     $this->request = $request;
     $this->response = $response;
     $this->db = $db;
     if (!$request->withMethod('POST')) {
         die('Not allowed');
     }
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function withMethod($method)
 {
     return new static($this->wrapped->withMethod($method));
 }
Exemple #3
0
 /**
  * {@inheritDoc}
  */
 public function withMethod($method)
 {
     return new self($this->app, $this->psrRequest->withMethod($method));
 }
 /**
  * Proxy to ServerRequestInterface::withMethod()
  *
  * {@inheritdoc}
  */
 public function withMethod($method)
 {
     $new = $this->psrRequest->withMethod($method);
     return new self($new, $this->originalRequest);
 }
Exemple #5
0
 /**
  * @inheritDoc
  */
 public function withMethod($method)
 {
     $self = clone $this;
     $self->serverRequest = $this->serverRequest->withMethod($method);
     return $self;
 }
Exemple #6
0
 /**
  * @param \Psr\Http\Message\ServerRequestInterface $request
  * @return \Psr\Http\Message\ServerRequestInterface
  */
 protected function applyVirtualMethod(ServerRequestInterface $request)
 {
     if (!$this->config->isVirtualMethodEnabled()) {
         return $request;
     }
     $parsedBody = $request->getParsedBody();
     if (!isset($parsedBody['_method'])) {
         return $request;
     }
     return $request->withMethod(strtoupper($parsedBody['_method']));
 }