Skip to content

Commit

Permalink
docs: fix $routes->match() HTTP verbs
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 10, 2023
1 parent 6969a53 commit 7f0ae5c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion system/Router/RouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ public function presenter(string $name, ?array $options = null): RouteCollection
* Specifies a single route to match for multiple HTTP Verbs.
*
* Example:
* $route->match( ['get', 'post'], 'users/(:num)', 'users/$1);
* $route->match( ['GET', 'POST'], 'users/(:num)', 'users/$1);
*
* @param array|Closure|string $to
*/
Expand All @@ -1012,6 +1012,7 @@ public function match(array $verbs = [], string $from = '', $to = '', ?array $op
}

foreach ($verbs as $verb) {
// @TODO We should use correct uppercase verb.
$verb = strtolower($verb);

$this->{$verb}($from, $to, $options);
Expand Down
2 changes: 1 addition & 1 deletion user_guide_src/source/incoming/routing/004.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$routes->match(['get', 'put'], 'products', 'Product::feature');
$routes->match(['GET', 'PUT'], 'products', 'Product::feature');
2 changes: 1 addition & 1 deletion user_guide_src/source/incoming/routing/033.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$routes->options('from', 'to', $options);
$routes->delete('from', 'to', $options);
$routes->patch('from', 'to', $options);
$routes->match(['get', 'put'], 'from', 'to', $options);
$routes->match(['GET', 'PUT'], 'from', 'to', $options);
$routes->resource('photos', $options);
$routes->map($array, $options);
$routes->group('name', $options, static function () {});

0 comments on commit 7f0ae5c

Please sign in to comment.