Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Controller_Router_Route_Regex Class Reference

Extends the Zend version to grant access to reverse and map. More...

List of all members.

Public Member Functions

 assemble ($data=array(), $reset=false, $encode=false, $partial=false)
 Extend parent to add any unknown data values to the query params part of the url.

Static Public Member Functions

static getInstance (Zend_Config $config)
 Extend parent to instantiate our class; they utilized 'self' so no late static binding was occuring.
static toArray (Zend_Controller_Router_Route_Regex $route)
 Will turn the passed route into a hash with the properties: string|null route string|null reverse array defaults array map.

Detailed Description

Extends the Zend version to grant access to reverse and map.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

P4Cms_Controller_Router_Route_Regex::assemble ( data = array(),
reset = false,
encode = false,
partial = false 
)

Extend parent to add any unknown data values to the query params part of the url.

Parameters:
array$dataAn array of name (or index) and value pairs used as parameters
bool$resetShould values be reset
bool$encodeShould data be encoded
bool$partialShould this be treated as a partial
Returns:
string Route path with user submitted parameters
    {
        $url = parent::assemble($data, $reset, $encode, $partial);

        // pull out any data variables which are not covered by the mapping
        $queryParams = array_diff_key(
            $data,
            array_merge(
                $this->getDefaults(),
                array_flip($this->getVariables())
            )
        );

        // tack on any query params.
        if (count($queryParams)) {
            $url .= "?" . http_build_query($queryParams);
        }

        return $url;
    }
static P4Cms_Controller_Router_Route_Regex::getInstance ( Zend_Config $  config) [static]

Extend parent to instantiate our class; they utilized 'self' so no late static binding was occuring.

Parameters:
Zend_Config$configConfiguration object
Returns:
Zend_Controller_Router_Route_Abstract The configured instance
    {
        $defs = ($config->defaults instanceof Zend_Config) ? $config->defaults->toArray() : array();
        $map = ($config->map instanceof Zend_Config) ? $config->map->toArray() : array();
        $reverse = (isset($config->reverse)) ? $config->reverse : null;
        return new static($config->route, $defs, $map, $reverse);
    }
static P4Cms_Controller_Router_Route_Regex::toArray ( Zend_Controller_Router_Route_Regex $  route) [static]

Will turn the passed route into a hash with the properties: string|null route string|null reverse array defaults array map.

Parameters:
Zend_Controller_Router_Route_Regex$routeThe route to array-ize
    {
        $properties = array();

        $properties['route']    = $route->_regex;
        $properties['reverse']  = $route->_reverse;
        $properties['defaults'] = $route->_defaults;
        $properties['map']      = $route->_map;

        return $properties;
    }

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