<commit_before><?php

/*
 * This file is a part of FakeDataGenerator
 * Brought to you by Concept&Proof 
 */

namespace Concept\FakeDataGenerator;

class FakeObjectFactory
{
    
}
<commit_msg>fakeobjectfactory<commit_after><?php

/*
 * This file is a part of FakeDataGenerator
 * Brought to you by Concept&Proof 
 */

namespace Concept\FakeDataGenerator;

class FakeObjectFactory
{
    protected $_fakeObject = null; 
    protected $_amount = null;
    
    public static function create ()
    {        
        return new static;
    }    
    
    public function setFakeObject (FakeEntityInterface $fakeObject)
    {
        $this->_fakeObject = $fakeObject;
    }
    
    public function setAmount ($amount)
    {
        $amount = (int)$amount;
        
        if (0 >= $amount)
        {
            throw new \InvalidArgumentException ();
        }
        
        $this->_amount = $amount;
    }
    
    public function produce ()
    {        
        if (is_null ($this->_amount) || is_null ($this->_fakeObject))
        {
            throw new \BadMethodCallException ();
        }
        
        for ( $i = 0; $i < $this->_amount; $i++ )
        {
            $fakeObject = clone $this->_fakeObject;
            $fakeObject->fillInData ();
            yield ($fakeObject); // new php 5.5 feature in action!
        }
    }
}

{'fraction_non_alphanumeric': 0.10557620817843866, 'fraction_numerical': 0.002973977695167286, 'mean_word_length': 1.8822269807280514, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, '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': '2007932', 'n_tokens_mistral': 391, 'n_tokens_neox': 381, 'n_words': 97}