Skip to content

Commit

Permalink
new feature for full-match(???)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjiec committed Apr 29, 2017
1 parent 35599b9 commit 7fc5d4c
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 193 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# php-router
simple php router
php-router
----------

**Waiting**
63 changes: 63 additions & 0 deletions src/Abstracts/ErrorNode.php
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;
}
52 changes: 52 additions & 0 deletions src/Abstracts/HookNode.php
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);
}
70 changes: 70 additions & 0 deletions src/Abstracts/RouteNode.php
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;
}
Loading

0 comments on commit 7fc5d4c

Please sign in to comment.