public function delete(Metric $object) { if ($object instanceof \Instrument\Metric\Event) { /* All events have the same name, compare objects instead. */ $this->events = array_filter($this->events, function ($event) use($object) { return $event !== $object; }); } else { /* This is probably faster anyway. */ unset($this->measurements[$object->name()]); } return $this; }