<commit_before><?php

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

namespace Symfony\Component\Validator;

/**
 * Base class for constraint validators
 *
 * @author <NAME> <<EMAIL>>
 *
 * @api
 */
abstract class ConstraintValidator implements ConstraintValidatorInterface
{
    /**
     * @var ExecutionContextInterface
     */
    protected $context;

    /**
     * {@inheritdoc}
     */
    public function initialize(ExecutionContextInterface $context)
    {
        $this->context = $context;
    }

    /**
     * Returns a string representation of the type of the value.
     *
     * @param  mixed $value
     *
     * @return string
     */
    protected function valueToType($value)
    {
        return is_object($value) ? get_class($value) : gettype($value);
    }

    /**
     * Returns a string representation of the value.
     *
     * @param mixed   $value
     * @param Boolean $formatDates
     *
     * @return string
     */
    protected function valueToString($value, $formatDates = false)
    {
        if ($formatDates && $value instanceof \DateTime) {
            if (class_exists('IntlDateFormatter')) {
                $locale = \Locale::getDefault();
                $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT);

                return $formatter->format($value);
            }

            return $value->format('Y-m-d H:i:s');
        }

        if (is_object($value)) {
            return 'Object('.get_class($value).')';
        }

        if (is_array($value)) {
            return 'Array';
        }

        if (is_string($value)) {
            return '"'.$value.'"';
        }

        if (is_resource($value)) {
            return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
        }

        if (null === $value) {
            return 'null';
        }

        if (false === $value) {
            return 'false';
        }

        if (true === $value) {
            return 'true';
        }

        return (string) $value;
    }

    /**
     * Returns a string representation of a list of values.
     *
     * @param array   $values
     * @param Boolean $formatDates
     *
     * @return string
     */
    protected function valuesToString(array $values, $formatDates = false)
    {
        foreach ($values as $key => $value) {
            $values[$key] = $this->valueToString($value, $formatDates);
        }

        return implode(', ', $values);
    }
}<commit_msg>[Validator] Fixed CS<commit_after><?php

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

namespace Symfony\Component\Validator;

/**
 * Base class for constraint validators
 *
 * @author <NAME> <<EMAIL>>
 *
 * @api
 */
abstract class ConstraintValidator implements ConstraintValidatorInterface
{
    /**
     * @var ExecutionContextInterface
     */
    protected $context;

    /**
     * {@inheritdoc}
     */
    public function initialize(ExecutionContextInterface $context)
    {
        $this->context = $context;
    }

    /**
     * Returns a string representation of the type of the value.
     *
     * @param  mixed $value
     *
     * @return string
     */
    protected function valueToType($value)
    {
        return is_object($value) ? get_class($value) : gettype($value);
    }

    /**
     * Returns a string representation of the value.
     *
     * @param mixed $value
     * @param bool  $formatDates
     *
     * @return string
     */
    protected function valueToString($value, $formatDates = false)
    {
        if ($formatDates && $value instanceof \DateTime) {
            if (class_exists('IntlDateFormatter')) {
                $locale = \Locale::getDefault();
                $formatter = new \IntlDateFormatter($locale, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::SHORT);

                return $formatter->format($value);
            }

            return $value->format('Y-m-d H:i:s');
        }

        if (is_object($value)) {
            return 'Object('.get_class($value).')';
        }

        if (is_array($value)) {
            return 'Array';
        }

        if (is_string($value)) {
            return '"'.$value.'"';
        }

        if (is_resource($value)) {
            return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
        }

        if (null === $value) {
            return 'null';
        }

        if (false === $value) {
            return 'false';
        }

        if (true === $value) {
            return 'true';
        }

        return (string) $value;
    }

    /**
     * Returns a string representation of a list of values.
     *
     * @param array $values
     * @param bool  $formatDates
     *
     * @return string
     */
    protected function valuesToString(array $values, $formatDates = false)
    {
        foreach ($values as $key => $value) {
            $values[$key] = $this->valueToString($value, $formatDates);
        }

        return implode(', ', $values);
    }
}
{'fraction_non_alphanumeric': 0.13396048918156162, 'fraction_numerical': 0.0, 'mean_word_length': 1.9648633575013943, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '4475787', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1482, 'n_words': 380}