mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
Development
- Removed yet another depricated method. - Fixed $_GET parameters being merged on default when calling getUrl. - Fixed double / that could appear on urls sometimes.
This commit is contained in:
@@ -103,7 +103,7 @@ abstract class LoadableRoute extends Route implements ILoadableRoute
|
||||
}
|
||||
}
|
||||
|
||||
$url .= '/' . join('/', $unknownParams);
|
||||
$url .= join('/', $unknownParams);
|
||||
|
||||
return rtrim($url, '/') . '/';
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ class Router
|
||||
* @param array|null $getParams
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl($name = null, $parameters = null, array $getParams = null)
|
||||
public function getUrl($name = null, $parameters = null, $getParams = [])
|
||||
{
|
||||
if ($getParams !== null && is_array($getParams) === false) {
|
||||
throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null');
|
||||
|
||||
@@ -306,37 +306,12 @@ class SimpleRouter
|
||||
* You can also use the same syntax when searching for a specific controller-class "MyController@home".
|
||||
* If no arguments is specified, it will return the url for the current loaded route.
|
||||
*
|
||||
* This method is an alias for SimpleRouter::getUrl().
|
||||
*
|
||||
* @see SimpleRouter::getUrl()
|
||||
* @param string|null $name
|
||||
* @param string|array|null $parameters
|
||||
* @param array|null $getParams
|
||||
* @return string
|
||||
*/
|
||||
public static function getRoute($name = null, $parameters = null, array $getParams = null)
|
||||
{
|
||||
return static::getUrl($name, $parameters, $getParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url for a route by using either name/alias, class or method name.
|
||||
*
|
||||
* The name parameter supports the following values:
|
||||
* - Route name
|
||||
* - Controller/resource name (with or without method)
|
||||
* - Controller class name
|
||||
*
|
||||
* When searching for controller/resource by name, you can use this syntax "route.name@method".
|
||||
* You can also use the same syntax when searching for a specific controller-class "MyController@home".
|
||||
* If no arguments is specified, it will return the url for the current loaded route.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @param string|array|null $parameters
|
||||
* @param array|null $getParams
|
||||
* @return string
|
||||
*/
|
||||
public static function getUrl($name = null, $parameters = null, array $getParams = null)
|
||||
public static function getUrl($name = null, $parameters = null, $getParams = [])
|
||||
{
|
||||
return static::router()->getUrl($name, $parameters, $getParams);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user