original_string: private static function getLeadingDir(string $pattern): string
    {
      $dir = $pattern;
  
      $pos = strpos($dir, '*');
      if ($pos!==false) $dir = substr($dir, 0, $pos);
  
      $pos = strpos($dir, '?');
      if ($pos!==false) $dir = substr($dir, 0, $pos);
  
      $pos = strrpos($dir, '/');
      if ($pos!==false)
      {
        $dir = substr($dir, 0, $pos);
      }
      else
      {
        $dir = '.';
      }
  
      return $dir;
    }
code: private static function getLeadingDir(string $pattern): string
    {
      $dir = $pattern;
  
      $pos = strpos($dir, '*');
      if ($pos!==false) $dir = substr($dir, 0, $pos);
  
      $pos = strpos($dir, '?');
      if ($pos!==false) $dir = substr($dir, 0, $pos);
  
      $pos = strrpos($dir, '/');
      if ($pos!==false)
      {
        $dir = substr($dir, 0, $pos);
      }
      else
      {
        $dir = '.';
      }
  
      return $dir;
    }
code_tokens: private static function getLeadingDir ( string $ pattern ) : string { $ dir = $ pattern ; $ pos = strpos ( $ dir , '*' ) ; if ( $ pos !== false ) $ dir = substr ( $ dir , 0 , $ pos ) ; $ pos = strpos ( $ dir , '?' ) ; if ( $ pos !== false ) $ dir = substr ( $ dir , 0 , $ pos ) ; $ pos = strrpos ( $ dir , '/' ) ; if ( $ pos !== false ) { $ dir = substr ( $ dir , 0 , $ pos ) ; } else { $ dir = '.' ; } return $ dir ; }
docstring: Returns the leading directory without wild cards of a pattern.
  
  @param string $pattern The pattern.
  
  @return string
docstring_tokens: Returns the leading directory without wild cards of a pattern .