<commit_before><?php

namespace ValueObjects\Identity;

use ValueObjects\Exception\InvalidNativeArgumentException;
use ValueObjects\String\String;
use ValueObjects\Util\Util;
use ValueObjects\ValueObjectInterface;
use Rhumsaa\Uuid\Uuid as BaseUuid;

class UUID extends String
{
    /** @var BaseUuid */
    protected $value;

    /**
     * @param string $uuid
     * @return UUID
     * @throws \ValueObjects\Exception\InvalidNativeArgumentException
     */
    public static function fromNative()
    {
        $uuid_str = \func_get_arg(0);
        $uuid     = new static($uuid_str);

        return $uuid;
    }

    public function __construct($value = null)
    {
        $uuid_str = BaseUuid::uuid4();

        if(null != $value) {
            $pattern = '/'.BaseUuid::VALID_PATTERN.'/';

            if(false == \preg_match($pattern, $value)) {
                throw new InvalidNativeArgumentException($value, array('UUID string'));
            }

            $uuid_str = $value;
        }

        $this->value = \strval($uuid_str);
    }

    /**
     * Tells whether two UUID are equal by comparing their values
     *
     * @param  UUID $uuid
     * @return bool
     */
    public function equals(ValueObjectInterface $uuid)
    {
        if (false === Util::classEquals($this, $uuid)) {
            return false;
        }

        return $this->getValue() === $uuid->getValue();
    }
}
<commit_msg>Fix CS<commit_after><?php

namespace ValueObjects\Identity;

use ValueObjects\Exception\InvalidNativeArgumentException;
use ValueObjects\String\String;
use ValueObjects\Util\Util;
use ValueObjects\ValueObjectInterface;
use Rhumsaa\Uuid\Uuid as BaseUuid;

class UUID extends String
{
    /** @var BaseUuid */
    protected $value;

    /**
     * @param  string                                                 $uuid
     * @return UUID
     * @throws \ValueObjects\Exception\InvalidNativeArgumentException
     */
    public static function fromNative()
    {
        $uuid_str = \func_get_arg(0);
        $uuid     = new static($uuid_str);

        return $uuid;
    }

    public function __construct($value = null)
    {
        $uuid_str = BaseUuid::uuid4();

        if (null != $value) {
            $pattern = '/'.BaseUuid::VALID_PATTERN.'/';

            if (false == \preg_match($pattern, $value)) {
                throw new InvalidNativeArgumentException($value, array('UUID string'));
            }

            $uuid_str = $value;
        }

        $this->value = \strval($uuid_str);
    }

    /**
     * Tells whether two UUID are equal by comparing their values
     *
     * @param  UUID $uuid
     * @return bool
     */
    public function equals(ValueObjectInterface $uuid)
    {
        if (false === Util::classEquals($this, $uuid)) {
            return false;
        }

        return $this->getValue() === $uuid->getValue();
    }
}

{'fraction_non_alphanumeric': 0.12325905292479108, 'fraction_numerical': 0.001392757660167131, 'mean_word_length': 2.1606160616061607, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2868489', 'n_tokens_mistral': 839, 'n_tokens_neox': 812, 'n_words': 185}