RouteMaskHelper
in package
Parses the `cms_system_routes.mask` route mask (Nette route mask syntax, see `Route::parseMask()`/`compileUrl()` in `nette/routing`) and returns the names of required parameters, i.e. those `Route::constructUrl()` refuses to leave out.
Rules, derived from the real Nette grammar:
<name>or<name [regex]>outside a[...]block and without=defaultis required.- Anything inside
[...](an optional block, also nested) is always optional. <name=default>or<name=default [regex]>is optional even outside[...], becausecompileUrl()substitutes the default for a missing value and never returnsnull.
Used by PageFormTrait to name a missing
parameter in the message. The decision whether a URL can be built is made by the live
Nette\Application\Routers\Route; RouteMaskHelperTest compares this parser with it.
NOTE: the parser ignores the regex content inside <...> (e.g. {3,}, (?!...)); it only
affects which concrete value passes, not whether the parameter is required. A regex may
contain [ and ] (character classes); they do not count as an optional block because the
parser reads the <...> token atomically up to >.
Table of Contents
Methods
- requiredParams() : array<int, string>
Methods
requiredParams()
public
static requiredParams(string $mask) : array<int, string>
Parameters
- $mask : string
Return values
array<int, string> —names of required parameters, in order of appearance in the mask