original_string: public function execute()
      {
          // Check if we have a url
          if (!$this->url || trim($this->url) == '') {
              $this->url = '/';
          }
  
          // Make sure the url starts with a slash
          if (substr($this->url, 0, 1) !== '/') {
              $this->url = '/' . $this->url;
          }
  
          // Check if the absolute route exists in our routes array
          // - and if that route has the same type of request as the current request.
          if (isset($this->routes[$this->method][$this->url])) {
              return call_user_func_array($this->routes[$this->method][$this->url], []);
          }
  
          // Check if the absolute route exists in our routes array
          // - and if that route has the "any" type.
          if (isset($this->routes['any'][$this->url])) {
              return call_user_func_array($this->routes['any'][$this->url], []);
          }
  
          // Create an array of methods to check and loop through them
          $methods = [$this->method, 'any'];
          foreach ($methods as $method) {
              // Loop through the routes set for this method
              foreach ($this->routes[$method] as $route => $callable) {
                  // Check if the route matches
                  $regex = '/^' . str_replace('/', '\/', $route) . '/Uim';
                  $matches = [];
                  if (preg_match($regex, $this->url, $matches) === 1 && $matches[0] === $this->url) {
                      // First value in the array is the string that matched
                      array_shift($matches);
  
                      // Execute the callable method
                      return call_user_func_array($callable, $matches);
                  }
              }
          }
  
          // No route found, check if we have an empty route.
          // - We should always have an empty route.
          if (!isset($this->routes['any']['/'])) {
              header('HTTP/1.1 404 Not Found');
              exit;
          }
  
          // Return the empty route's callable
          return call_user_func_array($this->routes['any']['/'], []);
      }
code: public function execute()
      {
          // Check if we have a url
          if (!$this->url || trim($this->url) == '') {
              $this->url = '/';
          }
  
          // Make sure the url starts with a slash
          if (substr($this->url, 0, 1) !== '/') {
              $this->url = '/' . $this->url;
          }
  
          // Check if the absolute route exists in our routes array
          // - and if that route has the same type of request as the current request.
          if (isset($this->routes[$this->method][$this->url])) {
              return call_user_func_array($this->routes[$this->method][$this->url], []);
          }
  
          // Check if the absolute route exists in our routes array
          // - and if that route has the "any" type.
          if (isset($this->routes['any'][$this->url])) {
              return call_user_func_array($this->routes['any'][$this->url], []);
          }
  
          // Create an array of methods to check and loop through them
          $methods = [$this->method, 'any'];
          foreach ($methods as $method) {
              // Loop through the routes set for this method
              foreach ($this->routes[$method] as $route => $callable) {
                  // Check if the route matches
                  $regex = '/^' . str_replace('/', '\/', $route) . '/Uim';
                  $matches = [];
                  if (preg_match($regex, $this->url, $matches) === 1 && $matches[0] === $this->url) {
                      // First value in the array is the string that matched
                      array_shift($matches);
  
                      // Execute the callable method
                      return call_user_func_array($callable, $matches);
                  }
              }
          }
  
          // No route found, check if we have an empty route.
          // - We should always have an empty route.
          if (!isset($this->routes['any']['/'])) {
              header('HTTP/1.1 404 Not Found');
              exit;
          }
  
          // Return the empty route's callable
          return call_user_func_array($this->routes['any']['/'], []);
      }
code_tokens: public function execute ( ) { // Check if we have a url if ( ! $ this -> url || trim ( $ this -> url ) == '' ) { $ this -> url = '/' ; } // Make sure the url starts with a slash if ( substr ( $ this -> url , 0 , 1 ) !== '/' ) { $ this -> url = '/' . $ this -> url ; } // Check if the absolute route exists in our routes array // - and if that route has the same type of request as the current request. if ( isset ( $ this -> routes [ $ this -> method ] [ $ this -> url ] ) ) { return call_user_func_array ( $ this -> routes [ $ this -> method ] [ $ this -> url ] , [ ] ) ; } // Check if the absolute route exists in our routes array // - and if that route has the "any" type. if ( isset ( $ this -> routes [ 'any' ] [ $ this -> url ] ) ) { return call_user_func_array ( $ this -> routes [ 'any' ] [ $ this -> url ] , [ ] ) ; } // Create an array of methods to check and loop through them $ methods = [ $ this -> method , 'any' ] ; foreach ( $ methods as $ method ) { // Loop through the routes set for this method foreach ( $ this -> routes [ $ method ] as $ route => $ callable ) { // Check if the route matches $ regex = '/^' . str_replace ( '/' , '\/' , $ route ) . '/Uim' ; $ matches = [ ] ; if ( preg_match ( $ regex , $ this -> url , $ matches ) === 1 && $ matches [ 0 ] === $ this -> url ) { // First value in the array is the string that matched array_shift ( $ matches ) ; // Execute the callable method return call_user_func_array ( $ callable , $ matches ) ; } } } // No route found, check if we have an empty route. // - We should always have an empty route. if ( ! isset ( $ this -> routes [ 'any' ] [ '/' ] ) ) { header ( 'HTTP/1.1 404 Not Found' ) ; exit ; } // Return the empty route's callable return call_user_func_array ( $ this -> routes [ 'any' ] [ '/' ] , [ ] ) ; }
docstring: Executes the router based on the url.
  
  @throws Exception Throws an exception if no location was set and no default route was found.
  
  @return mixed The result of the callable method.
docstring_tokens: Executes the router based on the url .