src/Entities/FieldCollection.php
protected function validateSet($key, $value)
    {
        $maxItems = $this->getMaxItems();
        if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
            throw new ItemCountException('The maximum number of items has been reached on this field.');
        }

        if (is_null($key) && is_null($value)) {
            throw new NullValueException('You cannot add a null value');
        }
    }
protected function validateSet($key, $value)
    {
        $maxItems = $this->getMaxItems();
        if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
            throw new ItemCountException('The maximum number of items has been reached on this field.');
        }

        if (is_null($key) && is_null($value)) {
            throw new NullValueException('You cannot add a null value');
        }
    }
protected function validateSet ( $ key , $ value ) { $ maxItems = $ this -> getMaxItems ( ) ; if ( ( is_null ( $ key ) || ! array_key_exists ( $ key , $ this -> items ) ) && $ maxItems != 0 && $ this -> count ( ) >= $ maxItems ) { throw new ItemCountException ( 'The maximum number of items has been reached on this field.' ) ; } if ( is_null ( $ key ) && is_null ( $ value ) ) { throw new NullValueException ( 'You cannot add a null value' ) ; } }
Validate input of OffsetSet

@param $key
@param $value
@throws ItemCountException
@throws NullValueException
Validate input of OffsetSet