<commit_before><?php

namespace Gentry;

use Reflector;
use ReflectionMethod;
use ReflectionFunction;
use ReflectionException;
use zpt\anno\Annotations;
use Closure;
use Exception;
use ErrorException;
use Generator;

/**
 * The main test class. Normally gets constructed internally, you don't have
 * to make your tests extend anything.
 */
class Test
{
    private $test;
    private $target;
    private $params;
    private $annotations;
    private $description;
    private $feature;
    private $testtype = 'method';
    private $testedFeatures = [];
    private $features = [];

    /**
     * Constructor.
     *
     * @param mixed $target The test class this scenario is targeting.
     * @param Reflector $function Reflected function representing this
     *  particular scenario.
     */
    public function __construct($target, Reflector $function)
    {
        $this->test = $function;
        $this->target = $target;
        $this->params = $this->test->getParameters();
        $this->annotations = new Annotations($this->test);
        $description = cleanDocComment($this->test);
        $description = preg_replace("@\s{1,}@m", ' ', $description);
        if (preg_match_all(
            '@(^|[!\?,;\.]).*?{(\d+)}(::\$?\w+)?.*?(?=$|[!\?,;\.])@ms',
            $description,
            $sentences,
            PREG_SET_ORDER
        )) {
            $matches = [];
            foreach ($sentences as $sentence) {
                $work = $sentence[0];
                $cnt = preg_match_all(
                    '@(.*?){(\d+)}(::\$?\w+.*?)@ms',
                    $work,
                    $in_sentence,
                    PREG_SET_ORDER
                );
                if ($cnt == 1) {
                    $matches[] = $sentence;
                } else {
                    foreach ($in_sentence as $sub) {
                        $matches[] = $sub;
                        $work = str_replace($sub[0], '', $work);
                    }
                    if (strlen($work)) {
                        $matches[count($matches) - 1][0] .= $work;
                    }
                }
            }
            $arguments = $this->getArguments();
            foreach ($matches as $match) {
                $match[0] = preg_replace('@{(\d+)}::\$?\w+@m', '{\\1}', $match[0]);
                if (isset($match[3])) {
                    $prop = substr($match[3], 2);
                    if ($prop{0} == '$') {
                        $this->features[] = new Test\Property(
                            $match[0],
                            $match[2],
                            substr($prop, 1),
                            $this->params[$match[2]]->getClass()->name
                        );<commit_msg>that part can go now, and method/property argument is optional<commit_after><?php

namespace Gentry;

use Reflector;
use ReflectionMethod;
use ReflectionFunction;
use ReflectionException;
use zpt\anno\Annotations;
use Closure;
use Exception;
use ErrorException;
use Generator;

/**
 * The main test class. Normally gets constructed internally, you don't have
 * to make your tests extend anything.
 */
class Test
{
    private $test;
    private $target;
    private $params;
    private $annotations;
    private $description;
    private $feature;
    private $testtype = 'method';
    private $testedFeatures = [];
    private $features = [];

    /**
     * Constructor.
     *
     * @param mixed $target The test class this scenario is targeting.
     * @param Reflector $function Reflected function representing this
     *  particular scenario.
     */
    public function __construct($target, Reflector $function)
    {
        $this->test = $function;
        $this->target = $target;
        $this->params = $this->test->getParameters();
        $this->annotations = new Annotations($this->test);
        $description = cleanDocComment($this->test);
        $description = preg_replace("@\s{1,}@m", ' ', $description);
        if (preg_match_all(
            '@(^|[!\?,;\.]).*?{(\d+)}(::\$?\w+)?.*?(?=$|[!\?,;\.])@ms',
            $description,
            $sentences,
            PREG_SET_ORDER
        )) {
            $matches = [];
            foreach ($sentences as $sentence) {
                $work = $sentence[0];
                $cnt = preg_match_all(
                    '@(.*?){(\d+)}(::\$?\w+)?@ms',
                    $work,
                    $in_sentence,
                    PREG_SET_ORDER
                );
                if ($cnt == 1) {
                    $matches[] = $sentence;
                } else {
                    foreach ($in_sentence as $sub) {
                        $matches[] = $sub;
                        $work = str_replace($sub[0], '', $work);
                    }
                    if (strlen($work)) {
                        $matches[count($matches) - 1][0] .= $work;
                    }
                }
            }
            $arguments = $this->getArguments();
            foreach ($matches as $match) {
                $match[0] = preg_replace('@{(\d+)}::\$?\w+@m', '{\\1}', $match[0]);
                if (isset($match[3])) {
                    $prop = substr($match[3], 2);
                    if ($prop{0} == '$') {
                        $this->features[] = new Test\Property(
                            $match[0],
                            $match[2],
                            substr($prop, 1),
                            $this->params[$match[2]]->getClass()->name
                        );
{'fraction_non_alphanumeric': 0.1561648810604685, 'fraction_numerical': 0.006173960414018522, 'mean_word_length': 1.4743935309973046, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '707763', 'n_tokens_mistral': 1552, 'n_tokens_neox': 1479, 'n_words': 333}