<commit_before><?php
/**
 * Copyright: IMPER.INFO <NAME>
 * Date: 25.07.17
 * Time: 14:08
 */

namespace Imper86\AllegroApi\Rest\Model\AfterSalesServiceConditions;


use Imper86\AllegroApi\Rest\Exception\IncorrectCurlResponseException;

class AfterSalesServiceConditionCollection implements \ArrayAccess
{
    /**
     * @var AfterSalesServiceCondition[]
     */
    private $conditions = [];

    public function __construct(AbstractAfterSalesServiceConditionsResponse $response)
    {
        foreach ($response->getConditionsArray() as $data) {
            if (!$data instanceof \stdClass) {
                throw new IncorrectCurlResponseException($response);
            }
            $this->conditions[] = new AfterSalesServiceCondition($data);
        }
    }

    public function offsetExists($offset)
    {
        return isset($this->conditions[$offset]);
    }

    public function offsetGet($offset)
    {
        return $this->conditions[$offset];
    }

    public function offsetSet($offset, $value)
    {
        if (!$value instanceof AfterSalesServiceCondition) {
            throw new \InvalidArgumentException("Only AfterSalesServiceConditon object can be set to this object");
        }

        $this->conditions[$offset] = $value;
    }

    public function offsetUnset($offset)
    {
        unset($this->conditions[$offset]);
    }

}<commit_msg>bugfix: implemented IteratorAggregate<commit_after><?php
/**
 * Copyright: IMPER.INFO <NAME>
 * Date: 25.07.17
 * Time: 14:08
 */

namespace Imper86\AllegroApi\Rest\Model\AfterSalesServiceConditions;


use Imper86\AllegroApi\Rest\Exception\IncorrectCurlResponseException;
use Traversable;

class AfterSalesServiceConditionCollection implements \ArrayAccess, \IteratorAggregate
{
    /**
     * @var AfterSalesServiceCondition[]
     */
    private $conditions = [];

    public function __construct(AbstractAfterSalesServiceConditionsResponse $response)
    {
        foreach ($response->getConditionsArray() as $data) {
            if (!$data instanceof \stdClass) {
                throw new IncorrectCurlResponseException($response);
            }
            $this->conditions[] = new AfterSalesServiceCondition($data);
        }
    }

    public function offsetExists($offset)
    {
        return isset($this->conditions[$offset]);
    }

    public function offsetGet($offset)
    {
        return $this->conditions[$offset];
    }

    public function offsetSet($offset, $value)
    {
        if (!$value instanceof AfterSalesServiceCondition) {
            throw new \InvalidArgumentException("Only AfterSalesServiceConditon object can be set to this object");
        }

        $this->conditions[$offset] = $value;
    }

    public function offsetUnset($offset)
    {
        unset($this->conditions[$offset]);
    }

    public function getIterator()
    {
        return new \ArrayIterator($this->conditions);
    }

}
{'fraction_non_alphanumeric': 0.11053719008264463, 'fraction_numerical': 0.009641873278236915, 'mean_word_length': 2.9685792349726774, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7156151', 'n_tokens_mistral': 803, 'n_tokens_neox': 766, 'n_words': 157}