Class Controller_Routing_DynamicSegment

Description

A routing segment that matches a URL based on a simple pattern with embedded parameter names.

Located in /controller/lib/Controller/Routing/DynamicSegment.php (line 10)

Controller_Routing_Segment
   |
   --Controller_Routing_DynamicSegment
Variable Summary
 mixed $pattern
 mixed $regex
 mixed $vars
Method Summary
 Controller_Routing_DynamicSegment __construct (string $pattern, [Controller_Routing_Segment $next = null])
 void build_regex ( $pattern)
 boolean match (string $url, array &$params, string &$unmatched)
 string regex ()
 void regex_replace_var ( $matches)
 mixed url_for (array &$params)
 string value ()
Variables
mixed $pattern (line 12)
  • access: protected
mixed $regex (line 13)
  • access: protected
mixed $vars (line 14)
  • access: protected

Inherited Variables

Inherited from Controller_Routing_Segment

Controller_Routing_Segment::$next
Methods
Constructor __construct (line 22)

Constructor

  • access: public
Controller_Routing_DynamicSegment __construct (string $pattern, [Controller_Routing_Segment $next = null])

Redefinition of:
Controller_Routing_Segment::__construct()
Constructor
build_regex (line 122)

Build the regular expression for matching URLs

  • access: protected
void build_regex ( $pattern)
  • $pattern
compare (line 85)

Compares this segment to another segment.

Returns a value of -1, 0, 1 to indicate $segment is less than, equal to, or greater than this segment, respectively. This method is used to construct routing trees. Segments which are equal will all be grouped together in a branch.

  • access: public
int compare (Controller_Routing_Segment $segment)

Redefinition of:
Controller_Routing_Segment::compare()
Compares this segment to another segment.
match (line 57)

Test a portion of a URL against this segment. Returns true if this segment matches, false otherwise.

  • access: public
boolean match (string $url, array &$params, string &$unmatched)
  • string $url: The URL portion to match
  • array &$params: Output parameter for any parameters discovered by this segment
  • string &$unmatched: Output parameter for the portion of the URL that was not matched (to be passed to the next segment

Redefinition of:
Controller_Routing_Segment::match()
Test a portion of a URL against this segment. Returns true if this segment matches, false otherwise.
regex (line 44)

Return the regular expression used to match this segment

  • access: public
string regex ()
regex_replace_var (line 148)

Callback for build_regex replacements

  • access: protected
void regex_replace_var ( $matches)
  • $matches
url_for (line 101)

Essentially the reverse of match(), this method assembles a URL segment from a set of parameters. If this segment cannot construct a URL chunk for the parameters, it returns false. Note that upon completion, $params contains only unconsumed parameters.

  • access: public
mixed url_for (array &$params)
  • array &$params: The parameters to use for assembling the URL

Redefinition of:
Controller_Routing_Segment::url_for()
Essentially the reverse of match(), this method assembles a URL segment from a set of parameters. If this segment cannot construct a URL chunk for the parameters, it returns false. Note that upon completion, $params contains only unconsumed parameters.
value (line 35)

Return the value of this segment in human readable form.

  • access: public
string value ()

Redefinition of:
Controller_Routing_Segment::value()
Return the value of this segment in human readable form.

Inherited Methods

Inherited From Controller_Routing_Segment

 Controller_Routing_Segment::__construct()
 Controller_Routing_Segment::compare()
 Controller_Routing_Segment::match()
 Controller_Routing_Segment::next()
 Controller_Routing_Segment::next_url_token()
 Controller_Routing_Segment::set_next()
 Controller_Routing_Segment::url_for()
 Controller_Routing_Segment::value()

Documentation generated on Wed, 25 Apr 2012 09:46:42 -0700 by phpDocumentor 1.4.3