PHP Класс yii\web\UrlNormalizer

С версии: 2.0.10
Автор: Robert Korulczyk ([email protected])
Автор: Cronfy ([email protected])
Наследование: extends yii\base\Object
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$action action to perform during route normalization. Available options are: - null - no special action will be performed - 301 - the request should be redirected to the normalized URL using permanent redirection - 302 - the request should be redirected to the normalized URL using temporary redirection - 404 - NotFoundHttpException will be thrown - callable - custom user callback, for example: php function ($route, $normalizer) { use custom action for redirections $route[1]['oldRoute'] = $route[0]; $route[0] = 'site/redirect'; return $route; }
$collapseSlashes whether slashes should be collapsed, for example site///index will be converted into site/index
$normalizeTrailingSlash whether trailing slash should be normalized according to the suffix settings of the rule

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

Метод Описание
normalizePathInfo ( string $pathInfo, string $suffix, boolean &$normalized = false ) : string Normalizes specified pathInfo.
normalizeRoute ( array $route ) : array Performs normalization action for the specified $route.

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

Метод Описание
collapseSlashes ( string $pathInfo ) : string Collapse consecutive slashes in $pathInfo, for example converts site///index into site/index.
normalizeTrailingSlash ( string $pathInfo, string $suffix ) : string Adds or removes trailing slashes from $pathInfo depending on whether the $suffix has a trailing slash or not.

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

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

Collapse consecutive slashes in $pathInfo, for example converts site///index into site/index.
protected collapseSlashes ( string $pathInfo ) : string
$pathInfo string raw path info.
Результат string normalized path info.

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

Normalizes specified pathInfo.
public normalizePathInfo ( string $pathInfo, string $suffix, boolean &$normalized = false ) : string
$pathInfo string pathInfo for normalization
$suffix string current rule suffix
$normalized boolean if specified, this variable will be set to `true` if $pathInfo was changed during normalization
Результат string normalized pathInfo

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

Performs normalization action for the specified $route.
public normalizeRoute ( array $route ) : array
$route array route for normalization
Результат array normalized route

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

Adds or removes trailing slashes from $pathInfo depending on whether the $suffix has a trailing slash or not.
protected normalizeTrailingSlash ( string $pathInfo, string $suffix ) : string
$pathInfo string raw path info.
$suffix string
Результат string normalized path info.

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

$action публичное свойство

action to perform during route normalization. Available options are: - null - no special action will be performed - 301 - the request should be redirected to the normalized URL using permanent redirection - 302 - the request should be redirected to the normalized URL using temporary redirection - 404 - NotFoundHttpException will be thrown - callable - custom user callback, for example: php function ($route, $normalizer) { use custom action for redirections $route[1]['oldRoute'] = $route[0]; $route[0] = 'site/redirect'; return $route; }
public $action

$collapseSlashes публичное свойство

whether slashes should be collapsed, for example site///index will be converted into site/index
public $collapseSlashes

$normalizeTrailingSlash публичное свойство

whether trailing slash should be normalized according to the suffix settings of the rule
public $normalizeTrailingSlash