-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
357 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# php-router | ||
simple php router | ||
php-router | ||
---------- | ||
|
||
**Waiting** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
/** | ||
* PHP Router Module | ||
* | ||
* @package Router | ||
* @author ShadowMan <shadowman@shellboot.com> | ||
* @copyright Copyright (C) 2016-2017 ShadowMan | ||
* @license MIT License | ||
* @link https://github.com/shadow-share/php-router | ||
*/ | ||
|
||
namespace Router\Abstracts; | ||
|
||
|
||
abstract class ErrorNode { | ||
/** | ||
* definition error code | ||
* | ||
* @return int | ||
*/ | ||
abstract public function errno(); | ||
|
||
/** | ||
* definition error message | ||
* | ||
* @return string | ||
*/ | ||
abstract public function error(); | ||
|
||
/** | ||
* definition match callback function | ||
* | ||
*/ | ||
public function __construct() { | ||
} | ||
|
||
/** | ||
* current request url path | ||
* | ||
* @return string | ||
*/ | ||
public static function get_current_url(array $parameters) { | ||
return $parameters['__url__']; | ||
} | ||
|
||
/** | ||
* current request method | ||
* | ||
* @return string | ||
*/ | ||
public function get_current_method(array $parameters) { | ||
return $parameters['__method__']; | ||
} | ||
|
||
abstract function entry_point(array $parameters); | ||
|
||
/** | ||
* store Widget_Route parse parameters | ||
* | ||
* @var array | ||
*/ | ||
protected $_router_parameters = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* PHP Router Module | ||
* | ||
* @package Router | ||
* @author ShadowMan <shadowman@shellboot.com> | ||
* @copyright Copyright (C) 2016-2017 ShadowMan | ||
* @license MIT License | ||
* @link https://github.com/shadow-share/php-router | ||
*/ | ||
|
||
namespace Router\Abstracts; | ||
|
||
|
||
abstract class HookNode { | ||
/** | ||
* definition hook name | ||
* | ||
* @return string | ||
*/ | ||
abstract public function hook_name(); | ||
|
||
/** | ||
* definition match callback function | ||
* | ||
*/ | ||
public function __construct() { | ||
} | ||
|
||
/** | ||
* current request url path | ||
* | ||
* @return string | ||
*/ | ||
public static function get_current_url(array $parameters) { | ||
return $parameters['__url__']; | ||
} | ||
|
||
/** | ||
* current request method | ||
* | ||
* @return string | ||
*/ | ||
public function get_current_method(array $parameters) { | ||
return $parameters['__method__']; | ||
} | ||
|
||
/** | ||
* main entry pointer | ||
*/ | ||
abstract function entry_point(array $parameters); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* PHP Router Module | ||
* | ||
* @package Router | ||
* @author ShadowMan <shadowman@shellboot.com> | ||
* @copyright Copyright (C) 2016-2017 ShadowMan | ||
* @license MIT License | ||
* @link https://github.com/shadow-share/php-router | ||
*/ | ||
|
||
namespace Router\Abstracts; | ||
|
||
|
||
abstract class RouteNode { | ||
/** | ||
* definition match urls | ||
* | ||
* @return array | ||
*/ | ||
abstract public function urls(); | ||
|
||
/** | ||
* definition match methods | ||
* | ||
* @return array | ||
*/ | ||
abstract public function methods(); | ||
|
||
/** | ||
* definition template before hooks | ||
* | ||
* @return array | ||
*/ | ||
abstract public function hooks(); | ||
|
||
/** | ||
* definition match callback function | ||
* | ||
*/ | ||
public function __construct() { | ||
} | ||
|
||
/** | ||
* current request url path | ||
* | ||
* @return string | ||
*/ | ||
public static function get_current_url(array $parameters) { | ||
return $parameters['__url__']; | ||
} | ||
|
||
/** | ||
* current request method | ||
* | ||
* @return string | ||
*/ | ||
public function get_current_method(array $parameters) { | ||
return $parameters['__method__']; | ||
} | ||
|
||
abstract function entry_point(array $parameters); | ||
|
||
/** | ||
* store Widget_Route parse parameters | ||
* | ||
* @var array | ||
*/ | ||
protected $_router_parameters = null; | ||
} |
Oops, something went wrong.