예제 #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');
     }
 }
예제 #2
0
파일: Request.php 프로젝트: Mosaic/Mosaic
 /**
  * {@inheritdoc}
  */
 public function withMethod($method)
 {
     return new static($this->wrapped->withMethod($method));
 }
예제 #3
0
파일: Request.php 프로젝트: tonis-io/tonis
 /**
  * {@inheritDoc}
  */
 public function withMethod($method)
 {
     return new self($this->app, $this->psrRequest->withMethod($method));
 }
예제 #4
0
 /**
  * Proxy to ServerRequestInterface::withMethod()
  *
  * {@inheritdoc}
  */
 public function withMethod($method)
 {
     $new = $this->psrRequest->withMethod($method);
     return new self($new, $this->originalRequest);
 }
예제 #5
0
파일: Request.php 프로젝트: superbull/super
 /**
  * @inheritDoc
  */
 public function withMethod($method)
 {
     $self = clone $this;
     $self->serverRequest = $this->serverRequest->withMethod($method);
     return $self;
 }
예제 #6
0
파일: Dispatcher.php 프로젝트: wandu/router
 /**
  * @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']));
 }