Skip to content

Commit 98f9a6f

Browse files
Adding in support for multiple routes definitions through an array
Thanks @nickl- for supplying the code so quickly
1 parent 7a73525 commit 98f9a6f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

library/Respect/Rest/Router.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ public function __call($method, $args)
145145

146146
list ($path, $routeTarget) = $args;
147147

148+
// Support multiple route definitions as array of paths
149+
if (is_array($path)) {
150+
$lastPath = array_pop($path);
151+
foreach ($path as $p)
152+
$this->$method($p, $routeTarget);
153+
return $this->$method($lastPath, $routeTarget);
154+
}
155+
148156
//closures, func names, callbacks
149157
if (is_callable($routeTarget)) {
150158

0 commit comments

Comments
 (0)