Xpressengine\Register\Container::set PHP Method

set() public method

주어진 key에 value를 지정한다. 이미 지정된 value가 있다면 덮어씌운다.
public set ( array | string $key, mixed $value = null ) : void
$key array | string key
$value mixed value for setting
return void
    public function set($key, $value = null)
    {
        $class = $this->arrClass;
        if (is_array($key)) {
            foreach ($key as $innerKey => $innerValue) {
                $class::set($this->items, $innerKey, $innerValue);
            }
        } else {
            $class::set($this->items, $key, $value);
        }
    }

Usage Example

 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);
 }
All Usage Examples Of Xpressengine\Register\Container::set