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