Abstract Class Controller_Routing_Segment

Description

Represents a segment of a route. A segment is a list of rules for matching a portion of a route. A collection of one or more segments comprise a route.

  • abstract:

Located in /controller/lib/Controller/Routing/Segment.php (line 11)


	
			
Direct descendents
Class Description
 class Controller_Routing_ControllerSegment A routing segment that matches a controller name in the URL.
 class Controller_Routing_DynamicSegment A routing segment that matches a URL based on a simple pattern with embedded parameter names.
 class Controller_Routing_RegExSegment A routing segment that matches a URL based on a regular expression.
 class Controller_Routing_StaticSegment A routing segment that matches a URL based on straight string comparison.
Variable Summary
 mixed $next
Method Summary
 Controller_Routing_Segment __construct ([Controller_Routing_Segment $next = null])
 boolean match (string $url, array &$params, string &$unmatched)
 string next_url_token (string $url, string &$remainder)
 mixed url_for (array &$params)
 string value ()
Variables
mixed $next (line 13)
  • access: protected
Methods
Constructor __construct (line 20)

Constructor

  • access: public
Controller_Routing_Segment __construct ([Controller_Routing_Segment $next = null])

Redefined in descendants as:
compare (line 71)

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.

  • abstract:
  • access: public
int compare (Controller_Routing_Segment $segment)

Redefined in descendants as:
match (line 58)

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

  • abstract:
  • 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

Redefined in descendants as:
next (line 29)

Return the next segment in the route

  • access: public
next_url_token (line 91)

Breaks a URL into a next token and remaining segment

  • access: protected
string next_url_token (string $url, string &$remainder)
  • string $url: The URL to tokenize
  • string &$remainder: Output parameter for the remaining segment
set_next (line 38)

Set the next segment in the route

  • access: public
void set_next (Controller_Routing_Segment $next)
url_for (line 82)

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.

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

Redefined in descendants as:
  • Controller_Routing_ControllerSegment::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.
  • Controller_Routing_DynamicSegment::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.
  • Controller_Routing_RegExSegment::url_for() : Essentially the reverse of match(), this method assembles a URL segment from a set of parameters. Note that a RegExSegment is never capable of constructing a URL and so will return false.
  • Controller_Routing_StaticSegment::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 47)

Return the value of this segment in human readable form.

  • abstract:
  • access: public
string value ()

Redefined in descendants as:

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