diff options
| author | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
|---|---|---|
| committer | Sam Light <sam@lightscale.co.uk> | 2026-06-10 19:00:32 +0100 |
| commit | 37a0c044617de4f847acadcb52ac7574927085a8 (patch) | |
| tree | 6d50f541c8d35a8ac2baaad1d929d068f47fbf01 | |
| parent | 3604c8e0b9bb64d54cb639a001161ca0ede044e6 (diff) | |
Renamed router route method to make
| -rw-r--r-- | src/Router.php | 14 | ||||
| -rw-r--r-- | tests/Unit/RouterTest.php | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/Router.php b/src/Router.php index 9aa3b55..34d2695 100644 --- a/src/Router.php +++ b/src/Router.php @@ -117,7 +117,7 @@ class Router return $this->strategy->runRoute($call); } - public function route( + public function make( HttpMethod $method, string $path, callable $handler, @@ -137,32 +137,32 @@ class Router public function get(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Get, $path, $handler); + return $this->make(HttpMethod::Get, $path, $handler); } public function post(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Post, $path, $handler); + return $this->make(HttpMethod::Post, $path, $handler); } public function put(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Put, $path, $handler); + return $this->make(HttpMethod::Put, $path, $handler); } public function patch(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Patch, $path, $handler); + return $this->make(HttpMethod::Patch, $path, $handler); } public function delete(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Delete, $path, $handler); + return $this->make(HttpMethod::Delete, $path, $handler); } public function any(string $path, callable $handler): RouteDefinition { - return $this->route(HttpMethod::Any, $path, $handler); + return $this->make(HttpMethod::Any, $path, $handler); } public function addNamedRoute(string $name, Route $route): void diff --git a/tests/Unit/RouterTest.php b/tests/Unit/RouterTest.php index 41b794d..0e270ca 100644 --- a/tests/Unit/RouterTest.php +++ b/tests/Unit/RouterTest.php @@ -188,7 +188,7 @@ it('calls strategy runRoute with dispatch on match', function () { it('make a route', function () { $router = new Router(); - $router->route(HttpMethod::Get, '/test1/test2/test3', fn () => null); + $router->make(HttpMethod::Get, '/test1/test2/test3', fn () => null); expect($router->findRoute(HttpMethod::Get, '/test1/test2/test3')) ->toBeInstanceOf(RouteMatch::class); @@ -228,7 +228,7 @@ it('makes a :dataset route') it('returns RouteDefinition when making route') ->expect(fn () => (new Router()) - ->route(HttpMethod::Get, '/test', fn () => null) + ->make(HttpMethod::Get, '/test', fn () => null) ) ->toBeInstanceOf(RouteDefinition::class); |
