public function offsetSet($offset, $value) { if ($value instanceof Tag) { $this->{$offset} = $value; } elseif ($this->{$offset} instanceof Tag) { $this->{$offset}->setValue($value); } }