<commit_before><?php

class sfSympalConfigureTask extends sfSympalBaseTask
{
  protected function configure()
  {
    $this->addArguments(array(
      new sfCommandArgument('configure', sfCommandArgument::IS_ARRAY, 'Set some Sympal configuration options.'),
    ));

    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application', null),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
    ));

    $this->aliases = array();
    $this->namespace = 'sympal';
    $this->name = 'configure';
    $this->briefDescription = 'Set a Sympal configuration setting.';

    $this->detailedDescription = <<<EOF
The [symfony sympal:configure|INFO] task allows you to set Sympal configuration settings.

  [./symfony sympal:configure layout=sympal i18n=false|INFO]
EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    foreach ($arguments['configure'] as $value)
    {
      list($key, $value) = explode('=', $value);
      $e = explode('.', $key);
      $group = isset($e[1]) ? $e[0] : null;
      $key = isset($e[1]) ? $e[1] : $e[0];

      $value = is_numeric($value) ? (int) $value : $value;
      $value = $value == 'false' ? false : $value;
      $value = $value == 'true' ? true : $value;
      $writeToApp = isset($options['application']) && $options['application'] ? true : false;

      if ($group)
      {
        $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s" under the "%s" group.', $key, $value, $group));

        sfSympalConfig::writeSetting($group, $key, $value, $writeToApp);
      } else {
        $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s".', $key, $value, $group));<commit_msg>[1.4][sfSympalPlugin][1.0] Adds support for YAML inline values to sympal:configure task<commit_after><?php

class sfSympalConfigureTask extends sfSympalBaseTask
{
  protected function configure()
  {
    $this->addArguments(array(
      new sfCommandArgument('configure', sfCommandArgument::IS_ARRAY, 'Set some Sympal configuration options.'),
    ));

    $this->addOptions(array(
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'The application', null),
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 'The environment', 'dev'),
    ));

    $this->aliases = array();
    $this->namespace = 'sympal';
    $this->name = 'configure';
    $this->briefDescription = 'Set a Sympal configuration setting.';

    $this->detailedDescription = <<<EOF
The [symfony sympal:configure|INFO] task allows you to set Sympal configuration settings.

  [./symfony sympal:configure layout=sympal i18n=false|INFO]
EOF;
  }

  /**
   * @see sfTask
   */
  protected function execute($arguments = array(), $options = array())
  {
    foreach ($arguments['configure'] as $value)
    {
      list($key, $value) = explode('=', $value);
      $e = explode('.', $key);
      $group = isset($e[1]) ? $e[0] : null;
      $key = isset($e[1]) ? $e[1] : $e[0];

      $value = is_numeric($value) ? (int) $value : $value;
      $value = $value == 'false' ? false : $value;
      $value = $value == 'true' ? true : $value;

      $infoValue = $value;
      if (in_array(substr($value, 0, 1), array('[', '{')))
      {
        $value = sfYamlInline::load($value);
        $infoValue = 'YAML: '.$infoValue;
      }

      $writeToApp = isset($options['application']) && $options['application'] ? true : false;

      if ($group)
      {
        $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s" under the "%s" group.', $key, $infoValue, $group));

        sfSympalConfig::writeSetting($group, $key, $value, $writeToApp);
      } else {
        $this->logSection('sympal', sprintf('Writing setting "%s" with a value of "%s".', $key, $infoValue, $group));
{'fraction_non_alphanumeric': 0.17615793470007593, 'fraction_numerical': 0.005062009617818274, 'mean_word_length': 3.6769230769230767, 'pattern_counts': {'":': 0, '<': 11, '<?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': '513421', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1238, 'n_words': 308}