<commit_before><?php

namespace JimmyOak\DataType;

abstract class Enum extends SimpleValueObject
{
    /**
     * @param mixed $value
     */
    public function __construct($value)
    {
        $this->guardAgainstValueNotInValidConstants($value);
        parent::__construct($value);
    }

    /**
     * @return array
     */
    public static function getConstList()
    {
        static $constants = [];

        if (!isset($constants[static::class])) {
            $constants[static::class] = (new \ReflectionClass(static::class))->getConstants();
        }

        return $constants[static::class];
    }

    /**
     * @param $type
     */
    private function guardAgainstValueNotInValidConstants($type)
    {
        if (!in_array($type, self::getConstList(), true)) {
            throw new \InvalidArgumentException(
                sprintf('Provided value for %s is not valid', get_class($this))
            );
        }
    }
}
<commit_msg>Added the value to the InvalidArgumentException message.<commit_after><?php

namespace JimmyOak\DataType;

abstract class Enum extends SimpleValueObject
{
    /**
     * @param mixed $value
     */
    public function __construct($value)
    {
        $this->guardAgainstValueNotInValidConstants($value);
        parent::__construct($value);
    }

    /**
     * @return array
     */
    public static function getConstList()
    {
        static $constants = [];

        if (!isset($constants[static::class])) {
            $constants[static::class] = (new \ReflectionClass(static::class))->getConstants();
        }

        return $constants[static::class];
    }

    /**
     * @param $type
     */
    private function guardAgainstValueNotInValidConstants($type)
    {
        if (!in_array($type, self::getConstList(), true)) {
            throw new \InvalidArgumentException(
                sprintf('Provided value for %s is not valid: %s', get_class($this), $type)
            );
        }
    }
}

{'fraction_non_alphanumeric': 0.13160569105691056, 'fraction_numerical': 0.0, 'mean_word_length': 2.3715753424657535, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7111225', 'n_tokens_mistral': 545, 'n_tokens_neox': 541, 'n_words': 110}