<commit_before><?php
/**
 * A class of utility methods for handling URLs in sfCombine
 *
 * @package     sfCombine
 * @subpackage  sfCombineUrl
 * @author      <NAME>
 * @author      <NAME> <<EMAIL>>
 */
class sfCombineUrl
{
  /**
   * Get the url for a collection of files
   *
   * @param   array $files
   * @return  string
   */
  static public function getUrlString($files, $timestamp)
  {
    switch(sfConfig::get('app_sfCombinePlugin_url_type', 'key')) {
      case 'files':
        $string = 'files=' . self::getFileString($files);
        break;
      case 'base64':
        $string = 'base64=' . self::getBase64($files);
        break;
      case 'key':
      default:
        $string = 'key=' . self::getKey($files);
        break;

    }

    if (sfConfig::get('app_sfCombinePlugin_asset_version', false)) {
      $string .= '&v='
               . sfConfig::get('app_sfCombinePlugin_asset_version');
    }

    if ($timestamp) {
      $string .= '&t=' . $timestamp;
    }

    return $string;
  }

  /**
   * Return the array of files into a string that can be used in a URL
   *
   * @param  array  $files      Array of file names
   * @param  string $seperator  (Optional) Default ' '
   * @return string
   */
  static public function getFileString(array $files, $separator = ' ')
  {
    return implode($separator, array_map('urlencode', $files));
  }

  /**
   * Take a file string and convert it into an array of files
   *
   * @param  string $fileString
   * @param  string $seperator  (Optional) Default ' '
   * @return array
   */
  static public function getFiles($fileString, $separator = ' ')
  {
    return array_map('urldecode', explode(' ', $fileString));
  }

  /**
   * Return a base64 encoded list of files
   *
   * @see getFileString
   */
  static public function getBase64(array $files, $separator = ' ')
  {
    return base64_encode(self::getFileString($files, $separator));
  }

  /**
   * Take a base64 string and convert it into an array of files
   *
   * @see getFiles
   */
  static public function getFilesByBase64($base64, $separator = ' ')
  {
    $string = false;

    if ($base64) {<commit_msg>Better url handling (might still have bugs)<commit_after><?php
/**
 * A class of utility methods for handling URLs in sfCombine
 *
 * @package     sfCombine
 * @subpackage  sfCombineUrl
 * @author      <NAME>
 * @author      <NAME> <<EMAIL>>
 */
class sfCombineUrl
{
  /**
   * Get the url for a collection of files
   *
   * @param   array $files
   * @return  string
   */
  static public function getUrlString($files, $timestamp)
  {
    switch(sfConfig::get('app_sfCombinePlugin_url_type', 'key')) {
      case 'files':
        $string = 'files=' . self::getFileString($files);
        break;
      case 'base64':
        $string = 'base64=' . self::getBase64($files);
        break;
      case 'key':
      default:
        $string = 'key=' . self::getKey($files);
        break;

    }

    if (sfConfig::get('app_sfCombinePlugin_asset_version', false)) {
      $string .= '&v='
               . sfConfig::get('app_sfCombinePlugin_asset_version');
    }

    if ($timestamp) {
      $string .= '&t=' . $timestamp;
    }

    return $string;
  }

  /**
   * Return the array of files into a string that can be used in a URL
   *
   * @param  array  $files      Array of file names
   * @param  string $seperator  (Optional) Default ' '
   * @return string
   */
  static public function getFileString(array $files, $separator = ' ')
  {
    return urlencode(
      implode($separator, array_map('rawurlencode', $files))
    );
  }

  /**
   * Take a file string and convert it into an array of files
   *
   * @param  string $fileString
   * @param  string $seperator  (Optional) Default ' '
   * @return array
   */
  static public function getFiles($fileString, $separator = ' ')
  {
    return array_map('urldecode', explode($separator, $fileString));
  }

  /**
   * Return a base64 encoded list of files
   *
   * @see getFileString
   */
  static public function getBase64(array $files, $separator = ' ')
  {
    return base64_encode(self::getFileString($files, $separator));
  }

  /**
   * Take a base64 string and convert it into an array of files
   *
   * @see getFiles
   */
  static public function getFilesByBase64($base64, $separator = ' ')
  {
    $string = false;

    if ($base64) {
{'fraction_non_alphanumeric': 0.1331953071083506, 'fraction_numerical': 0.009201748332183115, 'mean_word_length': 2.617304492512479, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6058510', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1367, 'n_words': 377}