mirror of
https://github.com/dannyvankooten/AltoRouter.git
synced 2025-08-04 15:37:45 +02:00
ADD: AltoRouter::__construct
Can create in one call from config
This commit is contained in:
@@ -6,6 +6,19 @@ class AltoRouter {
|
|||||||
protected $namedRoutes = array();
|
protected $namedRoutes = array();
|
||||||
protected $basePath = '';
|
protected $basePath = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create router in one call from config.
|
||||||
|
*
|
||||||
|
* @param array $arRoute
|
||||||
|
* @param string $basePath
|
||||||
|
*/
|
||||||
|
public function __construct( $arRoute = array(), $basePath = '' ) {
|
||||||
|
$this->basePath = $basePath;
|
||||||
|
foreach( $arRoute as $route ) {
|
||||||
|
call_user_func_array(array($this,'map'),$route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the base path.
|
* Set the base path.
|
||||||
* Useful if you are running your application from a subdirectory.
|
* Useful if you are running your application from a subdirectory.
|
||||||
|
Reference in New Issue
Block a user