<commit_before><?php

namespace Happyr\Doctrine\Specification\Spec;

class Like extends Comparison
{
    const CONTAINS = "%%%s%%";
    const ENDS_WITH = "%%%s";
    const STARTS_WITH = "%s%%";

    public function __construct($field, $value, $format, $dqlAlias = null)
    {
        $formattedValue = $this->formatValue($format, $value);
        parent::__construct(self::LIKE, $field, $formattedValue, $dqlAlias);
    }

    private function formatValue($format, $value)
    {
        return sprintf($format, $value);
    }
}<commit_msg>Adds default matching format for like<commit_after><?php

namespace Happyr\Doctrine\Specification\Spec;

class Like extends Comparison
{
    const CONTAINS = "%%%s%%";
    const ENDS_WITH = "%%%s";
    const STARTS_WITH = "%s%%";

    public function __construct($field, $value, $format = self::CONTAINS, $dqlAlias = null)
    {
        $formattedValue = $this->formatValue($format, $value);
        parent::__construct(self::LIKE, $field, $formattedValue, $dqlAlias);
    }

    private function formatValue($format, $value)
    {
        return sprintf($format, $value);
    }
}
{'fraction_non_alphanumeric': 0.15102770330652368, 'fraction_numerical': 0.0, 'mean_word_length': 3.7058823529411766, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6639171', 'n_tokens_mistral': 363, 'n_tokens_neox': 355, 'n_words': 80}