<commit_before><?php
namespace mockster;

class MockFactory {

    /**
     * @var array|Mock[] Instances which should always be used when mocking indexing class
     */
    private $singletons = array();

    /**
     * @var Generator
     */
    private $generator;

    /**
     * @var string
     */
    private $propertyAnnotation;

    public function __construct() {
        $this->generator = new Generator($this);
    }

    /**
     * If set, only properties having the given annotation will be mocked.
     *
     * e.g. 'inject' only mocks properties with an '@inject' annotation
     *
     * @param string|null $annotation
     */
    public function onlyMockAnnotatedProperties($annotation) {
        $this->propertyAnnotation = $annotation;
    }

    /**
     * @param string $classname
     * @param null|Mock $instance
     */
    public function makeSingleton($classname, $instance = null) {
        $classname = $this->generator->normalizeClassname($classname);

        if (!$instance) {
            $instance = $this->createMock($classname);
        }
        $this->singletons[$classname] = $instance;
    }

    /**
     * Convenience method to create a mock of a class to be testeed.
     *
     * @param string $classname
     * @param array $constructorArgs
     * @return Mock
     */
    public function createTestUnit($classname, $constructorArgs = array()) {
        $mock = $this->createMock($classname, $constructorArgs, true);
        $mock->__mock()->dontMockPublicMethods();
        return $mock;
    }
<commit_msg>createTestUnit accpets null constructor args<commit_after><?php
namespace mockster;

class MockFactory {

    /**
     * @var array|Mock[] Instances which should always be used when mocking indexing class
     */
    private $singletons = array();

    /**
     * @var Generator
     */
    private $generator;

    /**
     * @var string
     */
    private $propertyAnnotation;

    public function __construct() {
        $this->generator = new Generator($this);
    }

    /**
     * If set, only properties having the given annotation will be mocked.
     *
     * e.g. 'inject' only mocks properties with an '@inject' annotation
     *
     * @param string|null $annotation
     */
    public function onlyMockAnnotatedProperties($annotation) {
        $this->propertyAnnotation = $annotation;
    }

    /**
     * @param string $classname
     * @param null|Mock $instance
     */
    public function makeSingleton($classname, $instance = null) {
        $classname = $this->generator->normalizeClassname($classname);

        if (!$instance) {
            $instance = $this->createMock($classname);
        }
        $this->singletons[$classname] = $instance;
    }

    /**
     * Convenience method to create a mock of a class to be testeed.
     *
     * @param string $classname
     * @param array|null $constructorArgs If null, parent constructor is not invoked
     * @return Mock
     */
    public function createTestUnit($classname, $constructorArgs = array()) {
        $mock = $this->createMock($classname, $constructorArgs, true);
        $mock->__mock()->dontMockPublicMethods();
        return $mock;
    }

{'fraction_non_alphanumeric': 0.12001256676091737, 'fraction_numerical': 0.0, 'mean_word_length': 2.483588621444201, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '2462045', 'n_tokens_mistral': 889, 'n_tokens_neox': 864, 'n_words': 237}