RouterHelper
class RouterHelper
Methods that may be useful for processing routing activity
Adapted from october\rain\router\Helper
Methods
Adds leading slash and removes trailing slash from the URL.
Splits an URL by segments separated by the slash symbol.
Rebuilds a URL from an array of segments.
Replaces :column_name with it's object value. Example: /some/link/:id/:name -> /some/link/1/Joe
Replaces :column_name with object value without requiring a list of names. Example: /some/link/:id/:name -> /some/link/1/Joe
Checks whether an URL pattern segment is a wildcard.
Checks whether an URL pattern segment is optional.
Extracts the parameter name from a URL pattern segment definition.
Extracts the regular expression from a URL pattern segment definition.
Extracts the default parameter value from a URL pattern segment definition.
Details
at line 18
static string
normalizeUrl(string $url)
Adds leading slash and removes trailing slash from the URL.
at line 41
static array
segmentizeUrl(string $url)
Splits an URL by segments separated by the slash symbol.
at line 62
static string
rebuildUrl(array $urlArray)
Rebuilds a URL from an array of segments.
at line 82
static string
parseValues(stdClass $object, array $columns, string $string)
Replaces :column_name with it's object value. Example: /some/link/:id/:name -> /some/link/1/Joe
at line 110
static string
replaceParameters(stdClass $object, string $string)
Replaces :column_name with object value without requiring a list of names. Example: /some/link/:id/:name -> /some/link/1/Joe
at line 124
static bool
segmentIsWildcard(string $segment)
Checks whether an URL pattern segment is a wildcard.
at line 134
static bool
segmentIsOptional(string $segment)
Checks whether an URL pattern segment is optional.
at line 160
static string
getParameterName(string $segment)
Extracts the parameter name from a URL pattern segment definition.
at line 200
static string
getSegmentRegExp(string $segment)
Extracts the regular expression from a URL pattern segment definition.
at line 219
static string
getSegmentDefaultValue(string $segment)
Extracts the default parameter value from a URL pattern segment definition.