W3cubDocs

/Phalcon 3

Class Phalcon\Cli\Router\Route

Source on GitHub

This class represents every route added to the router

Constants

string DEFAULT_DELIMITER

Methods

public __construct (string $pattern, [array $paths])

Phalcon\Cli\Router\Route constructor

public compilePattern (mixed $pattern)

Replaces placeholders from pattern returning a valid PCRE regular expression

public array | boolean extractNamedParams (string $pattern)

Extracts parameters from a string

public reConfigure (string $pattern, [array $paths])

Reconfigure the route adding a new pattern and a set of paths

public getName ()

Returns the route’s name

public setName (mixed $name)

Sets the route’s name

$router->add(
    "/about",
    [
        "controller" => "about",
    ]
)->setName("about");

public Phalcon\Cli\Router\Route beforeMatch (callback $callback)

Sets a callback that is called if the route is matched. The developer can implement any arbitrary conditions here If the callback returns false the route is treated as not matched

public mixed getBeforeMatch ()

Returns the ‘before match’ callback if any

public getRouteId ()

Returns the route’s id

public getPattern ()

Returns the route’s pattern

public getCompiledPattern ()

Returns the route’s compiled pattern

public getPaths ()

Returns the paths

public getReversedPaths ()

Returns the paths using positions as keys and names as values

public Phalcon\Cli\Router\Route convert (string $name, callable $converter)

Adds a converter to perform an additional transformation for certain parameter

public getConverters ()

Returns the router converter

public static reset ()

Resets the internal route id generator

public static delimiter ([mixed $delimiter])

Set the routing delimiter

public static getDelimiter ()

Get routing delimiter

© 2011–2017 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/latest/api/Phalcon_Cli_Router_Route.html