1
0
mirror of https://github.com/dannyvankooten/AltoRouter.git synced 2025-08-11 02:44:03 +02:00

Use instance methods to set basePath and matchTypes

renamed addMatchType to addMatchTypes
This commit is contained in:
Koen Punt
2014-01-08 14:39:18 +01:00
parent 59c41a4990
commit 7c53090c1e
2 changed files with 6 additions and 6 deletions

View File

@@ -22,8 +22,8 @@ class AltoRouter {
* @param array $matchTypes
*/
public function __construct( $routes = array(), $basePath = '', $matchTypes = array() ) {
$this->basePath = $basePath;
$this->matchTypes = array_merge($this->matchTypes, $matchTypes);
$this->setBasePath($basePath);
$this->addMatchTypes($matchTypes);
foreach( $routes as $route ) {
call_user_func_array(array($this,'map'),$route);
@@ -39,11 +39,11 @@ class AltoRouter {
}
/**
* Add a new named match type. It uses array_merge so keys can be overwritten.
* Add named match types. It uses array_merge so keys can be overwritten.
*
* @param array $matchType The key is the name and the value is the regex.
* @param array $matchTypes The key is the name and the value is the regex.
*/
public function addMatchType($matchTypes) {
public function addMatchTypes($matchTypes) {
$this->matchTypes = array_merge($this->matchTypes, $matchTypes);
}