<commit_before><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * DateHelper.
 *
 * @package    symfony
 * @subpackage helper
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id: DateHelper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */

function format_daterange($start_date, $end_date, $format = 'd', $full_text, $start_text, $end_text, $culture = null, $charset = null)
{
  if ($start_date != '' && $end_date != '')
  {
    return sprintf($full_text, format_date($start_date, $format, $culture, $charset), format_date($end_date, $format, $culture, $charset));
  }
  else if ($start_date != '')
  {
    return sprintf($start_text, format_date($start_date, $format, $culture, $charset));
  }
  else if ($end_date != '')
  {
    return sprintf($end_text, format_date($end_date, $format, $culture, $charset));
  }
}

function format_date($date, $format = 'd', $culture = null, $charset = null)
{
  static $dateFormats = array();

  if (null === $date)
  {
    return null;
  }

  if (!$culture)
  {
    $culture = sfContext::getInstance()->getUser()->getCulture();
  }

  if (!$charset)
  {
    $charset = sfConfig::get('sf_charset');
  }

  if (!isset($dateFormats[$culture]))
  {
    $dateFormats[$culture] = new sfDateFormat($culture);
  }

  return $dateFormats[$culture]->format($date, $format, null, $charset);
}

function format_datetime($date, $format = 'F', $culture = null, $charset = null)
{
  return format_date($date, $format, $culture, $charset);
}

function distance_of_time_in_words($from_time, $to_time = null, $include_seconds = false)
{
  $to_time = $to_time? $to_time: time();

  $distance_in_minutes = floor(abs($to_time - $from_time) / 60);
  $distance_in_seconds = floor(abs($to_time - $from_time));

  $string = '';
  $parameters = array();

  if ($distance_in_minutes <= 1)
  {
    if (!$include_seconds)
    {
      $string = $distance_in_minutes == 0 ? 'less than a minute' : '1 minute';
    }
    else
    {<commit_msg>format date du premier jour "1er"<commit_after><?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * DateHelper.
 *
 * @package    symfony
 * @subpackage helper
 * @author     <NAME> <<EMAIL>>
 * @version    SVN: $Id: DateHelper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */

function format_daterange($start_date, $end_date, $format = 'd', $full_text, $start_text, $end_text, $culture = null, $charset = null)
{
  if ($start_date != '' && $end_date != '')
  {
    return sprintf($full_text, format_date($start_date, $format, $culture, $charset), format_date($end_date, $format, $culture, $charset));
  }
  else if ($start_date != '')
  {
    return sprintf($start_text, format_date($start_date, $format, $culture, $charset));
  }
  else if ($end_date != '')
  {
    return sprintf($end_text, format_date($end_date, $format, $culture, $charset));
  }
}

function format_date($date, $format = 'd', $culture = null, $charset = null)
{
  static $dateFormats = array();

  if (null === $date)
  {
    return null;
  }

  if (!$culture)
  {
    $culture = sfContext::getInstance()->getUser()->getCulture();
  }

  if (!$charset)
  {
    $charset = sfConfig::get('sf_charset');
  }

  if (!isset($dateFormats[$culture]))
  {
    $dateFormats[$culture] = new sfDateFormat($culture);
  }

  return preg_replace("/^1 /", "1er ", $dateFormats[$culture]->format($date, $format, null, $charset));
}

function format_datetime($date, $format = 'F', $culture = null, $charset = null)
{
  return format_date($date, $format, $culture, $charset);
}

function distance_of_time_in_words($from_time, $to_time = null, $include_seconds = false)
{
  $to_time = $to_time? $to_time: time();

  $distance_in_minutes = floor(abs($to_time - $from_time) / 60);
  $distance_in_seconds = floor(abs($to_time - $from_time));

  $string = '';
  $parameters = array();

  if ($distance_in_minutes <= 1)
  {
    if (!$include_seconds)
    {
      $string = $distance_in_minutes == 0 ? 'less than a minute' : '1 minute';
    }
    else
    {
{'fraction_non_alphanumeric': 0.17426521638509604, 'fraction_numerical': 0.015505669983800046, 'mean_word_length': 4.037296037296037, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '250462', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1492, 'n_words': 353}