/** * @param \NajiDev\XbmcApi\Model\Item\Base $entity * @throws \InvalidArgumentException */ public function add(Base $entity) { if (null === ($id = $entity->getId())) { throw new \InvalidArgumentException('Entity has to have an id'); } $class = get_class($entity); if (!array_key_exists($class, $this->map)) { $this->map[$class] = array(); } $this->map[$class][$id] = $entity; }