diff options
Diffstat (limited to 'src/Router.php')
| -rw-r--r-- | src/Router.php | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/src/Router.php b/src/Router.php index b219651..d6b255a 100644 --- a/src/Router.php +++ b/src/Router.php @@ -12,6 +12,9 @@ use Psr\Http\Message\ResponseInterface; class Router { + use Concerns\CreatesRoutes; + use Concerns\CreatesGroups; + private PathSegment $root; private Strategy $strategy; @@ -24,6 +27,16 @@ class Router $this->strategy = new BasicStrategy(); } + private function getRouter(): self + { + return $this; + } + + private function getGroup(): null + { + return null; + } + public function getStrategy(): Strategy { return $this->strategy; @@ -136,36 +149,6 @@ class Router return new RouteDefinition($this, $route); } - public function get(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Get, $path, $handler); - } - - public function post(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Post, $path, $handler); - } - - public function put(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Put, $path, $handler); - } - - public function patch(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Patch, $path, $handler); - } - - public function delete(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Delete, $path, $handler); - } - - public function any(string $path, callable $handler): RouteDefinition - { - return $this->make(HttpMethod::Any, $path, $handler); - } - public function addNamedRoute(string $name, Route $route): void { $this->namedRoutes[$name] = $route; |
