# css-javascript-toolbox/8.3/framework/ServicesFW/HTTPRequestRouter.class.php

CSS &amp; JavaScript Toolbox, version 8.3. 59 lines.

- Page: https://pluginprobe.com/plugins/css-javascript-toolbox/8.3/code/framework/ServicesFW/HTTPRequestRouter.class.php
- Raw: https://pluginprobe.com/plugins/css-javascript-toolbox/8.3/raw/framework/ServicesFW/HTTPRequestRouter.class.php
- Modified: 2015-12-07T10:53:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/css-javascript-toolbox/8.3/code/framework/ServicesFW/HTTPRequestRouter.class.php#L10-L20`.

```php
<?php
/**
* 
*/

/**
* 
*/
class CJTServicesHTTPRequestRouter {
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	private $map;
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	private $methodData;

	/**
	* put your comment there...
	* 
	* @param mixed $defaults
	* @param mixed $method
	* @return CJTServicesRequestRouter
	*/
	public function __construct($map, $method = 'request')  {
		# Initiaize
		$this->map = $map;
		$this->methodData =& $GLOBALS[ '_' . strtoupper( $method ) ];
	}

	/**
	* put your comment there...
	* 
	* @param mixed $route
	* @return CJTServicesRequestRouter
	*/
	public function getRoute(& $route) {
		# Initialize
		$newRoute = array();
		# Overwrite defauls values if submitted
		foreach ( $this->map as $name => $paramName ) {
			$newRoute[ $name ] = isset( $this->methodData[ $paramName ] ) ?
													 $this->methodData[ $paramName ] :
													 ( isset( $route[ $name ] ) ? $route[ $name ] : null );
		}
		# Set new route
		$route = array_merge( $route, $newRoute );
		# Chain
		return $this;
	}
}

```
