PHP Класс Zend\Mvc\View\Http\RouteNotFoundStrategy

Наследование: extends Zend\EventManager\AbstractListenerAggregate
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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

Описание методов

attach() публичный Метод

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

detectNotFoundError() публичный Метод

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
Результат void

displayExceptions() публичный Метод

Should we display exceptions related to a not-found condition?
public displayExceptions ( ) : boolean
Результат boolean

displayNotFoundReason() публичный Метод

Should we display the reason for a not-found condition?
public displayNotFoundReason ( ) : boolean
Результат boolean

getNotFoundTemplate() публичный Метод

Get template for not found conditions
public getNotFoundTemplate ( ) : string
Результат string

injectController() защищенный Метод

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
Результат void

injectException() защищенный Метод

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
Результат void

injectNotFoundReason() защищенный Метод

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
Результат void

prepareNotFoundViewModel() публичный Метод

Create and return a 404 view model
public prepareNotFoundViewModel ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent
Результат void

setDisplayExceptions() публичный Метод

Set value indicating whether or not to display exceptions related to a not-found condition
public setDisplayExceptions ( boolean $displayExceptions ) : RouteNotFoundStrategy
$displayExceptions boolean
Результат RouteNotFoundStrategy

setDisplayNotFoundReason() публичный Метод

Set value indicating whether or not to display the reason for a not-found condition
public setDisplayNotFoundReason ( boolean $displayNotFoundReason ) : RouteNotFoundStrategy
$displayNotFoundReason boolean
Результат RouteNotFoundStrategy

setNotFoundTemplate() публичный Метод

Get template for not found conditions
public setNotFoundTemplate ( string $notFoundTemplate ) : RouteNotFoundStrategy
$notFoundTemplate string
Результат RouteNotFoundStrategy

Описание свойств

$displayExceptions защищенное свойство

Whether or not to display exceptions related to the 404 condition
protected bool $displayExceptions
Результат boolean

$displayNotFoundReason защищенное свойство

Whether or not to display the reason for a 404
protected bool $displayNotFoundReason
Результат boolean

$notFoundTemplate защищенное свойство

Template to use to report page not found conditions
protected string $notFoundTemplate
Результат string

$reason защищенное свойство

The reason for a not-found condition
protected false|string $reason
Результат false | string