private function walkArray(array $urlParts, ServerRequestInterface  $request, array $parameters, $closestWildcardRoute = null)
    {
        $httpMethod = $request->getMethod();

        if (isset($this->wildcardCallbacks[$httpMethod])) {
            $closestWildcardRoute = $this->wildcardCallbacks[$httpMethod];
            $closestWildcardRoute->setFilledParameters($parameters);
        } elseif (isset($this->wildcardCallbacks[''])) {
            $closestWildcardRoute = $this->wildcardCallbacks[''];
            $closestWildcardRoute->setFilledParameters($parameters);
        }

        if (!empty($urlParts)) {
            $key = array_shift($urlParts);
            if (isset($this->children[$key])) {
                return $this->children[$key]->walkArray($urlParts, $request, $parameters, $closestWildcardRoute);
            }

            foreach ($this->parameterizedChildren as $varName => $splashUrlNode) {
                if (isset($parameters[$varName])) {
                    throw new SplashException("An error occured while looking at the list URL managed in Splash. In a @URL annotation, the parameter '{$parameters[$varName]}' appears twice. That should never happen");
                }
                $newParams = $parameters;
                $newParams[$varName] = $key;
                $result = $this->parameterizedChildren[$varName]->walkArray($urlParts, $request, $newParams, $closestWildcardRoute);
                if ($result !== null) {
                    return $result;
                }
            }

            // If we arrive here, there was no parametrized URL matching our objective
            return $closestWildcardRoute;
        } else {
            if (isset($this->callbacks[$httpMethod])) {
                $route = $this->callbacks[$httpMethod];
                $route->setFilledParameters($parameters);

                return $route;
            } elseif (isset($this->callbacks[''])) {
                $route = $this->callbacks[''];
                $route->setFilledParameters($parameters);

                return $route;
            } else {
                return $closestWildcardRoute;
            }
        }
    }
private function walkArray(array $urlParts, ServerRequestInterface  $request, array $parameters, $closestWildcardRoute = null)
    {
        $httpMethod = $request->getMethod();

        if (isset($this->wildcardCallbacks[$httpMethod])) {
            $closestWildcardRoute = $this->wildcardCallbacks[$httpMethod];
            $closestWildcardRoute->setFilledParameters($parameters);
        } elseif (isset($this->wildcardCallbacks[''])) {
            $closestWildcardRoute = $this->wildcardCallbacks[''];
            $closestWildcardRoute->setFilledParameters($parameters);
        }

        if (!empty($urlParts)) {
            $key = array_shift($urlParts);
            if (isset($this->children[$key])) {
                return $this->children[$key]->walkArray($urlParts, $request, $parameters, $closestWildcardRoute);
            }

            foreach ($this->parameterizedChildren as $varName => $splashUrlNode) {
                if (isset($parameters[$varName])) {
                    throw new SplashException("An error occured while looking at the list URL managed in Splash. In a @URL annotation, the parameter '{$parameters[$varName]}' appears twice. That should never happen");
                }
                $newParams = $parameters;
                $newParams[$varName] = $key;
                $result = $this->parameterizedChildren[$varName]->walkArray($urlParts, $request, $newParams, $closestWildcardRoute);
                if ($result !== null) {
                    return $result;
                }
            }

            // If we arrive here, there was no parametrized URL matching our objective
            return $closestWildcardRoute;
        } else {
            if (isset($this->callbacks[$httpMethod])) {
                $route = $this->callbacks[$httpMethod];
                $route->setFilledParameters($parameters);

                return $route;
            } elseif (isset($this->callbacks[''])) {
                $route = $this->callbacks[''];
                $route->setFilledParameters($parameters);

                return $route;
            } else {
                return $closestWildcardRoute;
            }
        }
    }
private function walkArray ( array $ urlParts , ServerRequestInterface $ request , array $ parameters , $ closestWildcardRoute = null ) { $ httpMethod = $ request -> getMethod ( ) ; if ( isset ( $ this -> wildcardCallbacks [ $ httpMethod ] ) ) { $ closestWildcardRoute = $ this -> wildcardCallbacks [ $ httpMethod ] ; $ closestWildcardRoute -> setFilledParameters ( $ parameters ) ; } elseif ( isset ( $ this -> wildcardCallbacks [ '' ] ) ) { $ closestWildcardRoute = $ this -> wildcardCallbacks [ '' ] ; $ closestWildcardRoute -> setFilledParameters ( $ parameters ) ; } if ( ! empty ( $ urlParts ) ) { $ key = array_shift ( $ urlParts ) ; if ( isset ( $ this -> children [ $ key ] ) ) { return $ this -> children [ $ key ] -> walkArray ( $ urlParts , $ request , $ parameters , $ closestWildcardRoute ) ; } foreach ( $ this -> parameterizedChildren as $ varName => $ splashUrlNode ) { if ( isset ( $ parameters [ $ varName ] ) ) { throw new SplashException ( "An error occured while looking at the list URL managed in Splash. In a @URL annotation, the parameter '{$parameters[$varName]}' appears twice. That should never happen" ) ; } $ newParams = $ parameters ; $ newParams [ $ varName ] = $ key ; $ result = $ this -> parameterizedChildren [ $ varName ] -> walkArray ( $ urlParts , $ request , $ newParams , $ closestWildcardRoute ) ; if ( $ result !== null ) { return $ result ; } } // If we arrive here, there was no parametrized URL matching our objective return $ closestWildcardRoute ; } else { if ( isset ( $ this -> callbacks [ $ httpMethod ] ) ) { $ route = $ this -> callbacks [ $ httpMethod ] ; $ route -> setFilledParameters ( $ parameters ) ; return $ route ; } elseif ( isset ( $ this -> callbacks [ '' ] ) ) { $ route = $ this -> callbacks [ '' ] ; $ route -> setFilledParameters ( $ parameters ) ; return $ route ; } else { return $ closestWildcardRoute ; } } }
Walks through the nodes to find the callback associated to the URL.

@param array                  $urlParts
@param ServerRequestInterface $request
@param array                  $parameters
@param SplashRouteInterface   $closestWildcardRoute The last wildcard (*) route encountered while navigating the tree.

@return SplashRouteInterface

@throws SplashException
Walks through the nodes to find the callback associated to the URL .