<commit_before><?php

namespace Collections;

use Collections\Exceptions\ArgumentNotNumericException;
use Collections\Exceptions\ArgumentOutOfRangeException;

class Collection implements SeriesInterface, \Serializable, \JsonSerializable
{
    use EnumerableExtensions;
    
    protected $subject = [];

    /**
     * Collection constructor.
     * @param array $subject
     */
    public function __construct(array $subject = [])
    {
        $counter = 0;

        foreach ($subject as $item) {
            $this->subject[$counter] = $item;
            $counter++;
        }
    }

    /**
     * @param $object
     * @return void
     */
    public function add($object)
    {
        $this->subject[] = $object;
    }

    /**
     * @param EnumerableInterface $enumerable
     * @return void
     */
    public function addRange(EnumerableInterface $enumerable)
    {
        foreach ($enumerable as $object) {
            $this->add($object);
        }
    }

    /**
     * @return ReadOnlyCollection
     */
    public function asReadOnly()
    {
        return new ReadOnlyCollection($this);
    }

    /**
     * @return void
     */
    public function clear()
    {
        $this->subject = [];
    }

    /**<commit_msg>change addRange parameter to \Traversable<commit_after><?php

namespace Collections;

use Collections\Exceptions\ArgumentNotNumericException;
use Collections\Exceptions\ArgumentOutOfRangeException;

class Collection implements SeriesInterface, \Serializable, \JsonSerializable
{
    use EnumerableExtensions;
    
    protected $subject = [];

    /**
     * Collection constructor.
     * @param array $subject
     */
    public function __construct(array $subject = [])
    {
        $counter = 0;

        foreach ($subject as $item) {
            $this->subject[$counter] = $item;
            $counter++;
        }
    }

    /**
     * @param $object
     * @return void
     */
    public function add($object)
    {
        $this->subject[] = $object;
    }

    /**
     * @param \Traversable $traversable
     * @return void
     */
    public function addRange(\Traversable $traversable)
    {
        foreach ($traversable as $object) {
            $this->add($object);
        }
    }

    /**
     * @return ReadOnlyCollection
     */
    public function asReadOnly()
    {
        return new ReadOnlyCollection($this);
    }

    /**
     * @return void
     */
    public function clear()
    {
        $this->subject = [];
    }

    /**
{'fraction_non_alphanumeric': 0.1216378964271377, 'fraction_numerical': 0.0008028904054596548, 'mean_word_length': 2.0242718446601944, 'pattern_counts': {'":': 0, '<': 5, '<?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': '763893', 'n_tokens_mistral': 702, 'n_tokens_neox': 683, 'n_words': 148}