original_string: protected function dispatchVariableRoute($httpMethod, $uri)
      {
          foreach ($this->variableRouteData as $data) {
              if (!preg_match($data['regex'], $uri, $matches)) {
                  continue;
              }
  
              $count = count($matches);
  
              while (!isset($data['routeMap'][$count++])) {
                  ;
              }
  
              $routes = $data['routeMap'][$count - 1];
  
              if (!isset($routes[$httpMethod])) {
                  $httpMethod = $this->checkFallbacks($routes, $httpMethod);
              }
  
              foreach (array_values($routes[$httpMethod][2]) as $i => $varName) {
                  if (!isset($matches[$i + 1]) || $matches[$i + 1] === '') {
                      unset($routes[$httpMethod][2][$varName]);
                  } else {
                      $routes[$httpMethod][2][$varName] = $matches[$i + 1];
                  }
              }
  
              return $routes[$httpMethod];
          }
  
          throw new HttpRouteNotFoundException('Route ' . $uri . ' does not exist');
      }
code: protected function dispatchVariableRoute($httpMethod, $uri)
      {
          foreach ($this->variableRouteData as $data) {
              if (!preg_match($data['regex'], $uri, $matches)) {
                  continue;
              }
  
              $count = count($matches);
  
              while (!isset($data['routeMap'][$count++])) {
                  ;
              }
  
              $routes = $data['routeMap'][$count - 1];
  
              if (!isset($routes[$httpMethod])) {
                  $httpMethod = $this->checkFallbacks($routes, $httpMethod);
              }
  
              foreach (array_values($routes[$httpMethod][2]) as $i => $varName) {
                  if (!isset($matches[$i + 1]) || $matches[$i + 1] === '') {
                      unset($routes[$httpMethod][2][$varName]);
                  } else {
                      $routes[$httpMethod][2][$varName] = $matches[$i + 1];
                  }
              }
  
              return $routes[$httpMethod];
          }
  
          throw new HttpRouteNotFoundException('Route ' . $uri . ' does not exist');
      }
code_tokens: protected function dispatchVariableRoute ( $ httpMethod , $ uri ) { foreach ( $ this -> variableRouteData as $ data ) { if ( ! preg_match ( $ data [ 'regex' ] , $ uri , $ matches ) ) { continue ; } $ count = count ( $ matches ) ; while ( ! isset ( $ data [ 'routeMap' ] [ $ count ++ ] ) ) { ; } $ routes = $ data [ 'routeMap' ] [ $ count - 1 ] ; if ( ! isset ( $ routes [ $ httpMethod ] ) ) { $ httpMethod = $ this -> checkFallbacks ( $ routes , $ httpMethod ) ; } foreach ( array_values ( $ routes [ $ httpMethod ] [ 2 ] ) as $ i => $ varName ) { if ( ! isset ( $ matches [ $ i + 1 ] ) || $ matches [ $ i + 1 ] === '' ) { unset ( $ routes [ $ httpMethod ] [ 2 ] [ $ varName ] ) ; } else { $ routes [ $ httpMethod ] [ 2 ] [ $ varName ] = $ matches [ $ i + 1 ] ; } } return $ routes [ $ httpMethod ] ; } throw new HttpRouteNotFoundException ( 'Route ' . $ uri . ' does not exist' ) ; }
docstring: Handle the dispatching of variable routes.
  
  @param $httpMethod
  @param $uri
  @throws HttpMethodNotAllowedException
  @throws HttpRouteNotFoundException
docstring_tokens: Handle the dispatching of variable routes .