src/main/php/routing/Routes.php
public function match(CalledUri $calledUri): MatchingRoutes
    {
        $allowedMethods = [];
        $matching       = [];
        foreach ($this->routes as $route) {
            /* @var $route \stubbles\webapp\routing\Route */
            if ($route->matches($calledUri)) {
                return new MatchingRoutes(
                        ['exact' => $route],
                        $route->allowedRequestMethods()
                );
            } elseif ($route->matchesPath($calledUri)) {
                $matching[] = $route;
                $allowedMethods = array_merge(
                        $allowedMethods,
                        $route->allowedRequestMethods()
                );
            }
        }

        return new MatchingRoutes($matching, array_unique($allowedMethods));
    }
public function match(CalledUri $calledUri): MatchingRoutes
    {
        $allowedMethods = [];
        $matching       = [];
        foreach ($this->routes as $route) {
            /* @var $route \stubbles\webapp\routing\Route */
            if ($route->matches($calledUri)) {
                return new MatchingRoutes(
                        ['exact' => $route],
                        $route->allowedRequestMethods()
                );
            } elseif ($route->matchesPath($calledUri)) {
                $matching[] = $route;
                $allowedMethods = array_merge(
                        $allowedMethods,
                        $route->allowedRequestMethods()
                );
            }
        }

        return new MatchingRoutes($matching, array_unique($allowedMethods));
    }
public function match ( CalledUri $ calledUri ) : MatchingRoutes { $ allowedMethods = [ ] ; $ matching = [ ] ; foreach ( $ this -> routes as $ route ) { /* @var $route \stubbles\webapp\routing\Route */ if ( $ route -> matches ( $ calledUri ) ) { return new MatchingRoutes ( [ 'exact' => $ route ] , $ route -> allowedRequestMethods ( ) ) ; } elseif ( $ route -> matchesPath ( $ calledUri ) ) { $ matching [ ] = $ route ; $ allowedMethods = array_merge ( $ allowedMethods , $ route -> allowedRequestMethods ( ) ) ; } } return new MatchingRoutes ( $ matching , array_unique ( $ allowedMethods ) ) ; }
finds route based on called uri

@param   \stubbles\webapp\routing\CalledUri  $calledUri
@return  \stubbles\webapp\routing\MatchingRoutes
finds route based on called uri