public function request(): Request
    {
        try {
            $request = $this->container->get(Request::class);
        } catch (ContainerExceptionInterface $e) {
            throw new ScopeException(
                "Unable to get `ServerRequestInterface` in active container scope",
                $e->getCode(),
                $e
            );
        }

        //Flushing input state
        if ($this->request !== $request) {
            $this->bags = [];
            $this->request = $request;
        }

        return $this->request;
    }
public function request(): Request
    {
        try {
            $request = $this->container->get(Request::class);
        } catch (ContainerExceptionInterface $e) {
            throw new ScopeException(
                "Unable to get `ServerRequestInterface` in active container scope",
                $e->getCode(),
                $e
            );
        }

        //Flushing input state
        if ($this->request !== $request) {
            $this->bags = [];
            $this->request = $request;
        }

        return $this->request;
    }
public function request ( ) : Request { try { $ request = $ this -> container -> get ( Request :: class ) ; } catch ( ContainerExceptionInterface $ e ) { throw new ScopeException ( "Unable to get `ServerRequestInterface` in active container scope" , $ e -> getCode ( ) , $ e ) ; } //Flushing input state if ( $ this -> request !== $ request ) { $ this -> bags = [ ] ; $ this -> request = $ request ; } return $ this -> request ; }
Get active instance of ServerRequestInterface and reset all bags if instance changed.

@return Request

@throws ScopeException
Get active instance of ServerRequestInterface and reset all bags if instance changed .