public function offsetSet($offset, $value) { if (is_null($offset)) { $this->collection[] = $value; } else { $this->collection[$offset] = $value; } }