classes/Route.php
protected static function extractVariablesFromURL($pattern, $URL=null, $cut=false){
      $URL     = $URL ?: Request::URI();
      $pattern = $cut ? str_replace('$#','',$pattern).'#' : $pattern;
      $args    = [];
      if ( !preg_match($pattern,'/'.trim($URL,'/'),$args) ) return false;
      foreach ($args as $key => $value) {
        if (false === is_string($key)) unset($args[$key]);
      }
      return $args;
    }
protected static function extractVariablesFromURL($pattern, $URL=null, $cut=false){
      $URL     = $URL ?: Request::URI();
      $pattern = $cut ? str_replace('$#','',$pattern).'#' : $pattern;
      $args    = [];
      if ( !preg_match($pattern,'/'.trim($URL,'/'),$args) ) return false;
      foreach ($args as $key => $value) {
        if (false === is_string($key)) unset($args[$key]);
      }
      return $args;
    }
protected static function extractVariablesFromURL ( $ pattern , $ URL = null , $ cut = false ) { $ URL = $ URL ? : Request :: URI ( ) ; $ pattern = $ cut ? str_replace ( '$#' , '' , $ pattern ) . '#' : $ pattern ; $ args = [ ] ; if ( ! preg_match ( $ pattern , '/' . trim ( $ URL , '/' ) , $ args ) ) return false ; foreach ( $ args as $ key => $ value ) { if ( false === is_string ( $ key ) ) unset ( $ args [ $ key ] ) ; } return $ args ; }
Extract the URL schema variables from the passed URL.
@param  string  $pattern The URL schema with the named parameters
@param  string  $URL The URL to process, if omitted the current request URI will be used.
@param  boolean $cut If true don't limit the matching to the whole URL (used for group pattern extraction)
@return array The extracted variables
Extract the URL schema variables from the passed URL .