code: public function withRequest(RequestInterface $request)
      {
          $object = clone $this;
          $object->request = $request;
          $object->method  = $request->getMethod();
          return $object;
      }
docs: With Set Request
  
  @param RequestInterface $request
  @return mixed