<commit_before><?php

namespace Liip\RMT\Version\Persister;

use Liip\RMT\VCS\VCSInterface;
use Liip\RMT\Context;

class VcsTagPersister implements PersisterInterface
{
    protected $versionRegex;
    protected $vcs;
    protected $prefix;

    public function __construct($options = array())
    {
        $this->vcs = Context::get('vcs');
        $this->versionRegex = Context::get('version-generator')->getValidationRegex();
        $this->prefix = $this->generatePrefix(isset($options['tag-prefix']) ? $options['tag-prefix'] : '');
    }

    public function getCurrentVersion()
    {
        $tags = $this->getValidVersionTags($this->versionRegex);
        if (count($tags)===0){<commit_msg>Add a new option tag-pattern for a tag persister<commit_after><?php

namespace Liip\RMT\Version\Persister;

use Liip\RMT\VCS\VCSInterface;
use Liip\RMT\Context;

class VcsTagPersister implements PersisterInterface
{
    protected $versionRegex;
    protected $vcs;
    protected $prefix;

    public function __construct($options = array())
    {
        $this->vcs = Context::get('vcs');
        $this->versionRegex = Context::get('version-generator')->getValidationRegex();
        if (isset($options['tag-pattern'])) {
            $this->versionRegex = $options['tag-pattern'];
        }
        $this->prefix = $this->generatePrefix(isset($options['tag-prefix']) ? $options['tag-prefix'] : '');
    }

    public function getCurrentVersion()
    {
        $tags = $this->getValidVersionTags($this->versionRegex);
        if (count($tags)===0){
{'fraction_non_alphanumeric': 0.1567357512953368, 'fraction_numerical': 0.0012953367875647669, 'mean_word_length': 3.6818181818181817, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '3012513', 'n_tokens_mistral': 461, 'n_tokens_neox': 458, 'n_words': 81}