original_string: public static function getFilePath($cwd, array $index)
      {
          $path = self::getRequestPath();
  
          if ($path === false) {
              return false;
          }
  
          $file = $cwd.$path;
  
          if (is_file($file)) {
              return $file;
          }
  
          if (empty($index)) {
              return false;
          }
  
          foreach ($index as $ext) {
              $f = rtrim($file, '/').'/index.'.$ext;
  
              if (is_file($f)) {
                  return $f;
              }
          }
  
          return false;
      }
code: public static function getFilePath($cwd, array $index)
      {
          $path = self::getRequestPath();
  
          if ($path === false) {
              return false;
          }
  
          $file = $cwd.$path;
  
          if (is_file($file)) {
              return $file;
          }
  
          if (empty($index)) {
              return false;
          }
  
          foreach ($index as $ext) {
              $f = rtrim($file, '/').'/index.'.$ext;
  
              if (is_file($f)) {
                  return $f;
              }
          }
  
          return false;
      }
code_tokens: public static function getFilePath ( $ cwd , array $ index ) { $ path = self :: getRequestPath ( ) ; if ( $ path === false ) { return false ; } $ file = $ cwd . $ path ; if ( is_file ( $ file ) ) { return $ file ; } if ( empty ( $ index ) ) { return false ; } foreach ( $ index as $ ext ) { $ f = rtrim ( $ file , '/' ) . '/index.' . $ ext ; if ( is_file ( $ f ) ) { return $ f ; } } return false ; }
docstring: Check whether the requested path exists
  
  @param string $cwd
  @param array $index
  
  @return string|false
docstring_tokens: Check whether the requested path exists