mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-10 01:52:12 +00:00
a9c03f9271
- Updated `helpers.php` and helpers example in documentation. - MalformedUrlException is now handled properly by Router to avoid phpStorm syntax highlights in routes. - Added `getUrlCopy` to `Request` class, used to clone the current route (to keep domain etc.) - `setUrl` in `Request` are now strict and requires `Url` object and no longer accepts strings. - Renamed `hasRewrite` property to `hasPendingRewrite` in `Request` class. - Renamed `hasRewrite` and `setHasRewrite` methods to `hasPendingRewrite` and `setHasPendingRewrite` in `Request` class. - Added better usage of `Url` class. When calling `url` you can now use the methods on the `Url` class to filter params, get relative/absolute url etc. See documentation for more info. - Renamed `get` method to `getValue` in `InputHandler` class. - Renamed `getObject` to `get` and removed `$defaultValue` argument in `InputHandler` class. - Optimized `InputHandler` class. - Fixed issue with `$token` not being proper string in `BaseCsrfVerifier` when token is not found. - Added php.ini configuration settings to `setcookie` in `CookieTokenProvider` for improved security. - Added `$router` parameter to `boot` method in `IRouterBootManager` which allows for further manipulation of the router within the bootmanager. - Renamed `$processingRoute` property to `$isProcessingRoute` in `Router` class. - Fixed `reset` method not resetting CSRF-verifier in `Router` class. - Moved `arrayToParams` helper-method from `Router` to `Url` class. - Began to add Event-functionality to router. - Added `addEventHandler` method to `SimpleRouter` class. - Moved `Pecee\SimpleRouter\Handler\CallbackExceptionHandler` to `Pecee\SimpleRouter\Handlers\CallbackExceptionHandler`. - Moved `Pecee\SimpleRouter\Handler\IExceptionHandler` to `Pecee\SimpleRouter\Handlers\IExceptionHandler`. - Added Events section to documentation. - Added more information on url-handling in documentation. - Optimisations.
80 lines
1.7 KiB
PHP
80 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Pecee\SimpleRouter\Route;
|
|
|
|
use Pecee\Http\Request;
|
|
use Pecee\SimpleRouter\Router;
|
|
|
|
interface ILoadableRoute extends IRoute
|
|
{
|
|
/**
|
|
* Find url that matches method, parameters or name.
|
|
* Used when calling the url() helper.
|
|
*
|
|
* @param string|null $method
|
|
* @param array|string|null $parameters
|
|
* @param string|null $name
|
|
* @return string
|
|
*/
|
|
public function findUrl(?string $method = null, $parameters = null, ?string $name = null): string;
|
|
|
|
/**
|
|
* Loads and renders middleware-classes
|
|
*
|
|
* @param Request $request
|
|
* @param Router $router
|
|
*/
|
|
public function loadMiddleware(Request $request, Router $router): void;
|
|
|
|
/**
|
|
* Get url
|
|
* @return string
|
|
*/
|
|
public function getUrl(): string;
|
|
|
|
/**
|
|
* 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;
|
|
|
|
/**
|
|
* Check if route has given name.
|
|
*
|
|
* @param string $name
|
|
* @return 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.
|
|
*
|
|
* @param string $name
|
|
* @return static
|
|
*/
|
|
public function setName(string $name): self;
|
|
|
|
/**
|
|
* Get regular expression match used for matching route (if defined).
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getMatch(): ?string;
|
|
|
|
/**
|
|
* Add regular expression match for the entire route.
|
|
*
|
|
* @param string $regex
|
|
* @return static
|
|
*/
|
|
public function setMatch($regex): self;
|
|
|
|
} |