public function testSet() { $container = new Container('\\Illuminate\\Support\\Arr'); $container->set('a/b', 'B'); $items = $this->getRepoProperty($container); $this->assertEquals(['a/b' => 'B'], $items); $container->set('a/b', 'C'); $items = $this->getRepoProperty($container); $this->assertEquals(['a/b' => 'C'], $items); }
/** * type, target + type 두가지 모두 등록 * * @param array $parts parts of id * @param ComponentInterface $component component class name * * @return void */ protected function addByType(array $parts, $component) { $key = $parts['type']; switch ($key) { case 'module': case 'skin': case 'settingsSkin': case 'theme': case 'settingsTheme': case 'widget': case 'uiobject': case 'FieldType': case 'FieldSkin': default: if ($parts['target'] != '') { $key = $target = $parts['target'] . self::KEY_DELIMITER . $parts['type']; } $this->register->set($key . '.' . $component::getId(), $component); } }
/** * create instance * * @param Container $register container * @param VirtualConnectionInterface $conn database connection */ public function __construct(Container $register, VirtualConnectionInterface $conn) { $this->register = $register; $this->conn = $conn; $this->register->set(self::REGISTER_KEY, []); }
/** * singleton * * @param Container $container register's container */ private function __construct(Container $container) { $this->container = $container; $this->container->set(self::REGISTER_KEY, []); }