diff options
Diffstat (limited to 'src/Router/Route.php')
| -rw-r--r-- | src/Router/Route.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Router/Route.php b/src/Router/Route.php new file mode 100644 index 0000000..ee9637b --- /dev/null +++ b/src/Router/Route.php @@ -0,0 +1,39 @@ +<?php + +namespace ERPHP\Router; + +use Symfony\Component\Routing\Route as SymfonyRoute; + +class Route extends SymfonyRoute +{ + public function __construct( + string $path, + callable $action, + private string $name = "", + array $defaults = [], + array $requirements = [], + array $options = [], + ?string $host = '', + string|array $schemes = [], + string|array $methods = [], + ?string $condition = '', + ) + { + if (empty($name)) { + $this->name = $path; + } + + $defaults = array_merge([ + "_" => [ + "action" => $action, + ], + ], $defaults); + + parent::__construct($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); + } + + public function getName(): string + { + return $this->name; + } +} |
