Development

- Better php7 support.
- Added easier way to debug router.
- Improvements and bugfixes.
- Updated documentation.
This commit is contained in:
Simon Sessingø
2018-03-26 23:43:27 +02:00
parent f23d569757
commit 085f98cf08
28 changed files with 847 additions and 233 deletions
@@ -3,6 +3,7 @@
namespace Pecee\SimpleRouter\Route;
use Pecee\Http\Request;
use Pecee\SimpleRouter\Router;
interface ILoadableRoute extends IRoute
{
@@ -18,22 +19,32 @@ interface ILoadableRoute extends IRoute
public function findUrl($method = null, $parameters = null, $name = null): string;
/**
* Loads and renders middlewares-classes
* Loads and renders middleware-classes
*
* @param Request $request
* @param Router $router
*/
public function loadMiddleware(Request $request);
public function loadMiddleware(Request $request, Router $router): void;
public function getUrl();
/**
* Get url
* @return string
*/
public function getUrl(): string;
public function setUrl($url);
/**
* Set url
* @param string $url
* @return static
*/
public function setUrl(string $url): self;
/**
* Returns the provided name for the router.
*
* @return string|null
*/
public function getName(): string;
public function getName(): ?string;
/**
* Check if route has given name.
@@ -41,7 +52,7 @@ interface ILoadableRoute extends IRoute
* @param string $name
* @return bool
*/
public function hasName($name): bool;
public function hasName(string $name): bool;
/**
* Sets the router name, which makes it easier to obtain the url or router at a later point.
@@ -49,14 +60,14 @@ interface ILoadableRoute extends IRoute
* @param string $name
* @return static
*/
public function setName($name): self;
public function setName(string $name): self;
/**
* Get regular expression match used for matching route (if defined).
*
* @return string
*/
public function getMatch(): string;
public function getMatch(): ?string;
/**
* Add regular expression match for the entire route.