Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

RouterRegexpRule Class Reference

Inheritance diagram for RouterRegexpRule:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 __construct ($route)
 setMap (array $map)
 getMap ()
 setReverse ($reverse)
 getReverse ()
 match (HttpRequest $request)
 Matches a user submitted path with parts defined by a map.
 assembly (array $data=array(), $reset=false, $encode=false)

Static Public Member Functions

static create ($route)

Protected Member Functions

 arrayMergeNumericKeys (array $array1, array $array2)
 getMappedValues ($values, $reversed=false, $preserve=false)
 Maps numerically indexed array values to it's associative mapped counterpart.

Protected Attributes

 $regexp = null
 $reverse = null
 $route = null
 $map = array()
 $values = array()

Detailed Description

Definition at line 12 of file RouterRegexpRule.class.php.


Constructor & Destructor Documentation

RouterRegexpRule::__construct ( route  ) 

Definition at line 29 of file RouterRegexpRule.class.php.

References $route.


Member Function Documentation

RouterRegexpRule::arrayMergeNumericKeys ( array $  array1,
array $  array2 
) [protected]
Returns:
array

Definition at line 142 of file RouterRegexpRule.class.php.

Referenced by assembly().

RouterRegexpRule::assembly ( array $  data = array(),
reset = false,
encode = false 
)

Implements RouterRule.

Definition at line 97 of file RouterRegexpRule.class.php.

References arrayMergeNumericKeys(), and getMappedValues().

Here is the call graph for this function:

static RouterRegexpRule::create ( route  )  [static]
Returns:
RouterRegexpRule

Definition at line 24 of file RouterRegexpRule.class.php.

References $route.

RouterRegexpRule::getMap (  ) 

Definition at line 45 of file RouterRegexpRule.class.php.

RouterRegexpRule::getMappedValues ( values,
reversed = false,
preserve = false 
) [protected]

Maps numerically indexed array values to it's associative mapped counterpart.

Or vice versa. Uses user provided map array which consists of index => name parameter mapping. If map is not found, it returns original array.

Method strips destination type of keys form source array. Ie. if source array is indexed numerically then every associative key will be stripped. Vice versa if reversed is set to true.

Returns:
array

Definition at line 163 of file RouterRegexpRule.class.php.

References $values.

Referenced by assembly(), and match().

RouterRegexpRule::getReverse (  ) 

Definition at line 62 of file RouterRegexpRule.class.php.

RouterRegexpRule::match ( HttpRequest request  ) 

Matches a user submitted path with parts defined by a map.

Assigns and returns an array of variables on a successful match.

Returns:
array An array of assigned values or empty array() on a mismatch

TODO: array_filter_key()? Why isn't this in a standard PHP function set yet? :)

Implements RouterRule.

Definition at line 67 of file RouterRegexpRule.class.php.

References RouterBaseRule::$defaults, $values, getMappedValues(), and RouterBaseRule::processPath().

Here is the call graph for this function:

RouterRegexpRule::setMap ( array $  map  ) 
Returns:
RouterRegexpRule

Definition at line 38 of file RouterRegexpRule.class.php.

RouterRegexpRule::setReverse ( reverse  ) 
Returns:
RouterRegexpRule

Definition at line 53 of file RouterRegexpRule.class.php.

References $reverse, and Assert::isString().

Here is the call graph for this function:


Member Data Documentation

RouterRegexpRule::$map = array() [protected]

Definition at line 18 of file RouterRegexpRule.class.php.

RouterRegexpRule::$regexp = null [protected]

Definition at line 14 of file RouterRegexpRule.class.php.

RouterRegexpRule::$reverse = null [protected]

Definition at line 15 of file RouterRegexpRule.class.php.

Referenced by setReverse().

RouterRegexpRule::$route = null [protected]

Definition at line 16 of file RouterRegexpRule.class.php.

Referenced by __construct(), and create().

RouterRegexpRule::$values = array() [protected]

Definition at line 19 of file RouterRegexpRule.class.php.

Referenced by getMappedValues(), and match().


The documentation for this class was generated from the following file: