From 186b9e7683037bf63b188c9f591b7513ce0308d2 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Thu, 4 Jun 2020 21:00:34 +0000 Subject: [PATCH] [ROUTES] Add static wrapper around Symfony's router --- src/Core/Router/Router.php | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Core/Router/Router.php diff --git a/src/Core/Router/Router.php b/src/Core/Router/Router.php new file mode 100644 index 0000000000..424e634eff --- /dev/null +++ b/src/Core/Router/Router.php @@ -0,0 +1,48 @@ +. +// }}} + +/** + * Static wrapper for Symfony's router + * + * @package GNUsocial + * @category URL + * + * @author Hugo Sales + * @copyright 2020 Free Software Foundation, Inc http://www.fsf.org + * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later + */ + +namespace App\Core\Router; + +use Symfony\Component\Routing\Router as SRouter; + +abstract class Router +{ + public static ?SRouter $router = null; + + public static function setRouter($rtr): void + { + self::$router = $rtr; + } + + public static function __callStatic(string $name, array $args) + { + return self::$router->{$name}(...$args); + } +}