Zend\Mvc\View\Http\RouteNotFoundStrategy::detectNotFoundError PHP Method

detectNotFoundError() public method

If a "controller not found" or "invalid controller" error type is encountered, sets the response status code to 404.
public detectNotFoundError ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent
return void
    public function detectNotFoundError(MvcEvent $e)
    {
        $error = $e->getError();
        if (empty($error)) {
            return;
        }
        switch ($error) {
            case Application::ERROR_CONTROLLER_NOT_FOUND:
            case Application::ERROR_CONTROLLER_INVALID:
            case Application::ERROR_ROUTER_NO_MATCH:
                $this->reason = $error;
                $response = $e->getResponse();
                if (!$response) {
                    $response = new HttpResponse();
                    $e->setResponse($response);
                }
                $response->setStatusCode(404);
                break;
            default:
                return;
        }
    }