<commit_before><?php
namespace Avenue\Tests;

abstract class Reflection
{
    /**
     * Protected/private methods accessible helper.
     * Call class method by assigning params.
     *
     * @param object $obj
     * @param mixed $method
     * @param array $params
     */
    public static function callClassMethod($obj, $method, array $params = [])
    {
        $rc = new \ReflectionClass(get_class($obj));
        $cm = $rc->getMethod($method);
        $cm->setAccessible(true);

        return $cm->invokeArgs($obj, $params);
    }

    /**
     * Protected/private property accessible helper.
     * Assign expected value for testing.
     *
     * @param object $obj
     * @param mixed $property
     * @param mixed $value
     * @param string $static
     */
    public static function setPropertyValue($obj, $property, $value, $static = false)
    {
        $ro = new \ReflectionObject($obj);
        $p = $ro->getProperty($property);
        $p->setAccessible(true);

        if ($static) {
            $p->setValue(null, $value);
        } else {
            $p->setValue($obj, $value);
        }
    }
}<commit_msg>added getConstantValue<commit_after><?php
namespace Avenue\Tests;

abstract class Reflection
{
    /**
     * Protected/private methods accessible helper.
     * Call class method by assigning params.
     *
     * @param object $obj
     * @param mixed $method
     * @param array $params
     */
    public static function callClassMethod($obj, $method, array $params = [])
    {
        $rc = new \ReflectionClass(get_class($obj));
        $cm = $rc->getMethod($method);
        $cm->setAccessible(true);

        return $cm->invokeArgs($obj, $params);
    }

    /**
     * Protected/private property accessible helper.
     * Assign expected value for testing.
     *
     * @param object $obj
     * @param mixed $property
     * @param mixed $value
     * @param string $static
     */
    public static function setPropertyValue($obj, $property, $value, $static = false)
    {
        $ro = new \ReflectionObject($obj);
        $p = $ro->getProperty($property);
        $p->setAccessible(true);

        if ($static) {
            $p->setValue(null, $value);
        } else {
            $p->setValue($obj, $value);
        }
    }

    /**
     * Get class constant value.
     *
     * @param object $obj
     * @param mixed $constant
     * @param mixed $value
     */
    public static function getConstantValue($obj, $constant, $value)
    {
        $ro = new \ReflectionClass(get_class($obj));
        return $ro->getConstant($constant);
    }
}
{'fraction_non_alphanumeric': 0.1358548822848321, 'fraction_numerical': 0.0, 'mean_word_length': 2.2158808933002483, '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': '5070686', 'n_tokens_mistral': 750, 'n_tokens_neox': 747, 'n_words': 191}