public function getRequest()
    {
        if (!$this->getContainer()->has(ServerRequestInterface::class)) {
            $this->getContainer()->share(ServerRequestInterface::class,function(){
                $beforeIndexPosition = strpos($_SERVER['PHP_SELF'],'/index.php');
                /**
                 * If there is some string before /index.php then remove this string from REQUEST_URI
                 */
                if(false !== $beforeIndexPosition && $beforeIndexPosition > 0){
                    $scriptUrl =  substr($_SERVER['PHP_SELF'],0,$beforeIndexPosition);
                    $_SERVER['REQUEST_URI'] = str_replace(['/index.php',$scriptUrl],'',$_SERVER['REQUEST_URI']);
                }
                return  ServerRequestFactory::fromGlobals()->withHeader('content-type', $this->getContentType());
            });
        }

        /** @var ServerRequestInterface $request */
        $request = $this->validateContract($this->getContainer()->get(ServerRequestInterface::class),
            ServerRequestInterface::class);
        return $request;
    }
public function getRequest()
    {
        if (!$this->getContainer()->has(ServerRequestInterface::class)) {
            $this->getContainer()->share(ServerRequestInterface::class,function(){
                $beforeIndexPosition = strpos($_SERVER['PHP_SELF'],'/index.php');
                /**
                 * If there is some string before /index.php then remove this string from REQUEST_URI
                 */
                if(false !== $beforeIndexPosition && $beforeIndexPosition > 0){
                    $scriptUrl =  substr($_SERVER['PHP_SELF'],0,$beforeIndexPosition);
                    $_SERVER['REQUEST_URI'] = str_replace(['/index.php',$scriptUrl],'',$_SERVER['REQUEST_URI']);
                }
                return  ServerRequestFactory::fromGlobals()->withHeader('content-type', $this->getContentType());
            });
        }

        /** @var ServerRequestInterface $request */
        $request = $this->validateContract($this->getContainer()->get(ServerRequestInterface::class),
            ServerRequestInterface::class);
        return $request;
    }
public function getRequest ( ) { if ( ! $ this -> getContainer ( ) -> has ( ServerRequestInterface :: class ) ) { $ this -> getContainer ( ) -> share ( ServerRequestInterface :: class , function ( ) { $ beforeIndexPosition = strpos ( $ _SERVER [ 'PHP_SELF' ] , '/index.php' ) ; /**
                 * If there is some string before /index.php then remove this string from REQUEST_URI
                 */ if ( false !== $ beforeIndexPosition && $ beforeIndexPosition > 0 ) { $ scriptUrl = substr ( $ _SERVER [ 'PHP_SELF' ] , 0 , $ beforeIndexPosition ) ; $ _SERVER [ 'REQUEST_URI' ] = str_replace ( [ '/index.php' , $ scriptUrl ] , '' , $ _SERVER [ 'REQUEST_URI' ] ) ; } return ServerRequestFactory :: fromGlobals ( ) -> withHeader ( 'content-type' , $ this -> getContentType ( ) ) ; } ) ; } /** @var ServerRequestInterface $request */ $ request = $ this -> validateContract ( $ this -> getContainer ( ) -> get ( ServerRequestInterface :: class ) , ServerRequestInterface :: class ) ; return $ request ; }
Get the request

@return \Psr\Http\Message\ServerRequestInterface
Get the request