[ROUTER][DOCUMENTATION] Add Router::isAbsolute
, add documentation to Router::url
and `s/setRouter/serServices/
This commit is contained in:
parent
61d95265a9
commit
330143e549
@ -171,7 +171,7 @@ class GNUsocial implements EventSubscriberInterface
|
||||
Form::setFactory($this->form_factory);
|
||||
Queue::setMessageBus($this->message_bus);
|
||||
Security::setHelper($this->security, $this->sanitizer);
|
||||
Router::setRouter($this->router, $this->url_generator);
|
||||
Router::setServices($this->router, $this->url_generator);
|
||||
HTTPClient::setClient($this->client);
|
||||
Formatting::setTwig($this->twig);
|
||||
Cache::setupCache();
|
||||
|
@ -61,12 +61,22 @@ abstract class Router
|
||||
public static ?SRouter $router = null;
|
||||
public static ?UrlGeneratorInterface $url_gen = null;
|
||||
|
||||
public static function setRouter($rtr, $gen): void
|
||||
public static function setServices($rtr, $gen): void
|
||||
{
|
||||
self::$router = $rtr;
|
||||
self::$url_gen = $gen;
|
||||
}
|
||||
|
||||
public static function isAbsolute(string $url)
|
||||
{
|
||||
return isset(parse_url($url)['host']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a URL for route $id with $args replacing the
|
||||
* placeholder route values. Extra params are added as query
|
||||
* string to the URL
|
||||
*/
|
||||
public static function url(string $id, array $args, int $type = self::ABSOLUTE_PATH): string
|
||||
{
|
||||
return self::$url_gen->generate($id, $args, $type);
|
||||
|
Loading…
Reference in New Issue
Block a user