public function pageNotFound(ServerRequestInterface $request) : ResponseInterface
    {
        $acceptType = $request->getHeader('Accept');
        if (is_array($acceptType) && count($acceptType) > 0 && strpos($acceptType[0], 'json') !== false) {
            return new JsonResponse(['error' => ['message' => 'Page not found', 'type' => 'page_not_found']], 404);
        }

        if ($this->contentFor404) {
            $this->contentBlock->addHtmlElement($this->contentFor404);
        } else {
            $this->contentBlock->addFile(__DIR__ . '/../../../../views/404.php', $this);
        }

        return HtmlResponse::create($this->template, 404);
    }
public function pageNotFound(ServerRequestInterface $request) : ResponseInterface
    {
        $acceptType = $request->getHeader('Accept');
        if (is_array($acceptType) && count($acceptType) > 0 && strpos($acceptType[0], 'json') !== false) {
            return new JsonResponse(['error' => ['message' => 'Page not found', 'type' => 'page_not_found']], 404);
        }

        if ($this->contentFor404) {
            $this->contentBlock->addHtmlElement($this->contentFor404);
        } else {
            $this->contentBlock->addFile(__DIR__ . '/../../../../views/404.php', $this);
        }

        return HtmlResponse::create($this->template, 404);
    }
public function pageNotFound ( ServerRequestInterface $ request ) : ResponseInterface { $ acceptType = $ request -> getHeader ( 'Accept' ) ; if ( is_array ( $ acceptType ) && count ( $ acceptType ) > 0 && strpos ( $ acceptType [ 0 ] , 'json' ) !== false ) { return new JsonResponse ( [ 'error' => [ 'message' => 'Page not found' , 'type' => 'page_not_found' ] ] , 404 ) ; } if ( $ this -> contentFor404 ) { $ this -> contentBlock -> addHtmlElement ( $ this -> contentFor404 ) ; } else { $ this -> contentBlock -> addFile ( __DIR__ . '/../../../../views/404.php' , $ this ) ; } return HtmlResponse :: create ( $ this -> template , 404 ) ; }
This function is called when a HTTP 404 error is triggered by the user.

@param ServerRequestInterface $request

@return ResponseInterface
This function is called when a HTTP 404 error is triggered by the user .