CMS Made Simple API

CmsRoute
in package
implements ArrayAccess

Simple global convenience object to hold information for a single route.

Tags
license

GPL

author

Robert Campbell calguy1000@cmsmadesimple.org

since
1.9
@property

string absolute

@property

string results

Table of Contents

Interfaces

ArrayAccess

Properties

$defaults  : array<string|int, mixed>
$key1  : string
$key2  : string
$key3  : string
$term  : string

Methods

__construct()  : mixed
Construct a new route object.
get_content()  : int
Retrieve the page id, if the destination is a content page.
get_defaults()  : array<string|int, mixed>
Retrieve the default parameters for this route
get_dest()  : string
Retrieve the destination module name.
get_results()  : array<string|int, mixed>
Get matching parameter results.
get_term()  : string
Returns the route term (string or regex)
is_content()  : bool
Test whether this route is for a page.
matches()  : bool
Test if this route matches the specified string Depending upon the route, either a string comparison or regular expression match is performed.
new_builder()  : CmsRoute
Static convenience function to create a new route.
signature()  : string
Return the signature for a route

Properties

Methods

__construct()

Construct a new route object.

public __construct(string $term[, string $key1 = '' ][, array<string|int, mixed> $defaults = null ][, bool $is_absolute = FALSE ][, string $key2 = null ][, string $key3 = null ]) : mixed
Parameters
$term : string

The route string (or regular expression)

$key1 : string = ''

The first key. Usually a module name.

$defaults : array<string|int, mixed> = null

An array of parameter defaults for this module. Only applicable when the destination is a module.

$is_absolute : bool = FALSE

Flag indicating wether the term is a regular expression or an absolute string.

$key2 : string = null

The second key.

$key3 : string = null

The second key.

get_content()

Retrieve the page id, if the destination is a content page.

public get_content() : int
Attributes
#[ReturnTypeWillChange]
Return values
int

Page id, or null.

get_defaults()

Retrieve the default parameters for this route

public get_defaults() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

The default parameters for the route.. Null if no defaults specified.

get_dest()

Retrieve the destination module name.

public get_dest() : string
Attributes
#[ReturnTypeWillChange]
Return values
string

Destination module name. or null.

get_results()

Get matching parameter results.

public get_results() : array<string|int, mixed>
Attributes
#[ReturnTypeWillChange]
Return values
array<string|int, mixed>

Matching parameters... or Null

get_term()

Returns the route term (string or regex)

public get_term() : string
Return values
string

is_content()

Test whether this route is for a page.

public is_content() : bool
Return values
bool

matches()

Test if this route matches the specified string Depending upon the route, either a string comparison or regular expression match is performed.

public matches(string $str[, bool $exact = false ]) : bool
Parameters
$str : string

The input string

$exact : bool = false

Perform an exact string match rather than depending on the route values.

Return values
bool

new_builder()

Static convenience function to create a new route.

public static & new_builder(string $term, string $key1[, string $key2 = '' ][, array<string|int, mixed> $defaults = null ][, bool $is_absolute = FALSE ][, string $key3 = '' ]) : CmsRoute
Parameters
$term : string

The route string (or regular expression)

$key1 : string

The first key. Usually a module name

$key2 : string = ''

The second key

$defaults : array<string|int, mixed> = null

An array of parameter defaults for this module. Only applicable when the destination is a module

$is_absolute : bool = FALSE

Flag indicating wether the term is a regular expression or an absolute string

$key3 : string = ''

The second key

Return values
CmsRoute

signature()

Return the signature for a route

public signature() : string
Return values
string

        
On this page

Search results