PHP Class Zend\Mvc\View\Http\RouteNotFoundStrategy

Inheritance: extends Zend\EventManager\AbstractListenerAggregate
Afficher le fichier Open project: zendframework/zend-mvc Class Usage Examples

Protected Properties

Свойство Type Description
$displayExceptions boolean Whether or not to display exceptions related to the 404 condition
$displayNotFoundReason boolean Whether or not to display the reason for a 404
$notFoundTemplate string Template to use to report page not found conditions
$reason false | string The reason for a not-found condition

Méthodes publiques

Méthode Description
attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 ) {@inheritDoc}
detectNotFoundError ( MvcEvent $e ) : void Detect if an error is a 404 condition
displayExceptions ( ) : boolean Should we display exceptions related to a not-found condition?
displayNotFoundReason ( ) : boolean Should we display the reason for a not-found condition?
getNotFoundTemplate ( ) : string Get template for not found conditions
prepareNotFoundViewModel ( MvcEvent $e ) : void Create and return a 404 view model
setDisplayExceptions ( boolean $displayExceptions ) : RouteNotFoundStrategy Set value indicating whether or not to display exceptions related to a not-found condition
setDisplayNotFoundReason ( boolean $displayNotFoundReason ) : RouteNotFoundStrategy Set value indicating whether or not to display the reason for a not-found condition
setNotFoundTemplate ( string $notFoundTemplate ) : RouteNotFoundStrategy Get template for not found conditions

Méthodes protégées

Méthode Description
injectController ( Zend\View\Model\ViewModel $model, MvcEvent $e ) : void Inject the controller and controller class into the model
injectException ( Zend\View\Model\ViewModel $model, MvcEvent $e ) : void Inject the exception message into the model
injectNotFoundReason ( Zend\View\Model\ViewModel $model ) : void Inject the not-found reason into the model

Method Details

attach() public méthode

{@inheritDoc}
public attach ( Zend\EventManager\EventManagerInterface $events, $priority = 1 )
$events Zend\EventManager\EventManagerInterface

detectNotFoundError() public méthode

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
Résultat void

displayExceptions() public méthode

Should we display exceptions related to a not-found condition?
public displayExceptions ( ) : boolean
Résultat boolean

displayNotFoundReason() public méthode

Should we display the reason for a not-found condition?
public displayNotFoundReason ( ) : boolean
Résultat boolean

getNotFoundTemplate() public méthode

Get template for not found conditions
public getNotFoundTemplate ( ) : string
Résultat string

injectController() protected méthode

If either $displayExceptions or $displayNotFoundReason are enabled, injects the controllerClass from the MvcEvent. It checks to see if a controller is present in the MvcEvent, and, if not, grabs it from the route match if present; if a controller is found, it injects it into the model.
protected injectController ( Zend\View\Model\ViewModel $model, MvcEvent $e ) : void
$model Zend\View\Model\ViewModel
$e Zend\Mvc\MvcEvent
Résultat void

injectException() protected méthode

If $displayExceptions is enabled, and an exception is found in the event, inject it into the model.
protected injectException ( Zend\View\Model\ViewModel $model, MvcEvent $e ) : void
$model Zend\View\Model\ViewModel
$e Zend\Mvc\MvcEvent
Résultat void

injectNotFoundReason() protected méthode

If $displayNotFoundReason is enabled, checks to see if $reason is set, and, if so, injects it into the model. If not, it injects Application::ERROR_CONTROLLER_CANNOT_DISPATCH.
protected injectNotFoundReason ( Zend\View\Model\ViewModel $model ) : void
$model Zend\View\Model\ViewModel
Résultat void

prepareNotFoundViewModel() public méthode

Create and return a 404 view model
public prepareNotFoundViewModel ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent
Résultat void

setDisplayExceptions() public méthode

Set value indicating whether or not to display exceptions related to a not-found condition
public setDisplayExceptions ( boolean $displayExceptions ) : RouteNotFoundStrategy
$displayExceptions boolean
Résultat RouteNotFoundStrategy

setDisplayNotFoundReason() public méthode

Set value indicating whether or not to display the reason for a not-found condition
public setDisplayNotFoundReason ( boolean $displayNotFoundReason ) : RouteNotFoundStrategy
$displayNotFoundReason boolean
Résultat RouteNotFoundStrategy

setNotFoundTemplate() public méthode

Get template for not found conditions
public setNotFoundTemplate ( string $notFoundTemplate ) : RouteNotFoundStrategy
$notFoundTemplate string
Résultat RouteNotFoundStrategy

Property Details

$displayExceptions protected_oe property

Whether or not to display exceptions related to the 404 condition
protected bool $displayExceptions
Résultat boolean

$displayNotFoundReason protected_oe property

Whether or not to display the reason for a 404
protected bool $displayNotFoundReason
Résultat boolean

$notFoundTemplate protected_oe property

Template to use to report page not found conditions
protected string $notFoundTemplate
Résultat string

$reason protected_oe property

The reason for a not-found condition
protected false|string $reason
Résultat false | string