$type) { static::$container->set($category, $type); } } /** * @param string $category * @param RegistrableItem $item * @throws RegistryException */ public static function add($category, RegistrableItem $item) { if (!static::$container->contains($category)) { throw new RegistryException(strtr('Registry does not contain category "{category}"', [ '{category}' => $category ])); } static::$container->get($category)->add($item); } /** * @param string $category * @return ItemsContainer * @throws RegistryException */ public static function get($category) { if (!static::$container->contains($category)) { throw new RegistryException(strtr('Registry does not contain category "{category}"', [ '{category}' => $category ])); } return static::$container->get($category); } }