public function offsetSet($offset, $value): void
    {
        if ($this->isValidEntity($value)) {
            if (is_null($offset) || mb_strlen($offset) == 0) {
                $this->list[] = $value;
            } else {
                $this->list[$offset] = $value;
            }
        } else {
            throw new \InvalidArgumentException(sprintf('This collection does\'t accept this entity "%s"', gettype($value)));
        }
    }
public function offsetSet($offset, $value): void
    {
        if ($this->isValidEntity($value)) {
            if (is_null($offset) || mb_strlen($offset) == 0) {
                $this->list[] = $value;
            } else {
                $this->list[$offset] = $value;
            }
        } else {
            throw new \InvalidArgumentException(sprintf('This collection does\'t accept this entity "%s"', gettype($value)));
        }
    }
public function offsetSet ( $ offset , $ value ) : void { if ( $ this -> isValidEntity ( $ value ) ) { if ( is_null ( $ offset ) || mb_strlen ( $ offset ) == 0 ) { $ this -> list [ ] = $ value ; } else { $ this -> list [ $ offset ] = $ value ; } } else { throw new \ InvalidArgumentException ( sprintf ( 'This collection does\'t accept this entity "%s"' , gettype ( $ value ) ) ) ; } }
Assign a value to the specified offset.

@param mixed $offset The offset to assign the value to
@param mixed $value  The value to set

@see \ArrayAccess
@throws \InvalidArgumentException if entity isn't accepted
Assign a value to the specified offset .