PHP Class Webiny\Component\Router\Route\RouteOption

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Show file Open project: Webiny/Framework

Public Methods

Method Description
__construct ( string $name, array $attributes = [] ) Base constructor.
addAttribute ( string $name, string $value ) Adds an attribute to the parameter.
getAttribute ( string $name, null | mixed $default = null ) : string Returns the attribute value.
getAttributes ( ) : array Returns all the attributes.
hasAttribute ( string $name ) : boolean Checks if current option contains the given attribute.

Private Methods

Method Description
sanitizePattern ( string $name, string $pattern ) : string Sanitizes the given pattern.

Method Details

__construct() public method

Base constructor.
public __construct ( string $name, array $attributes = [] )
$name string Name of the route parameter.
$attributes array An array of attributes that are going to be attached to the parameter.

addAttribute() public method

Adds an attribute to the parameter.
public addAttribute ( string $name, string $value )
$name string Name of the attribute.
$value string Value of the attribute.

getAttribute() public method

Returns the attribute value.
public getAttribute ( string $name, null | mixed $default = null ) : string
$name string Name of the attribute for which you wish to get the value.
$default null | mixed If attribute is not found, what to return. Default is null.
return string

getAttributes() public method

Returns all the attributes.
public getAttributes ( ) : array
return array

hasAttribute() public method

Checks if current option contains the given attribute.
public hasAttribute ( string $name ) : boolean
$name string Attribute name.
return boolean