Yosymfony\Spress\Core\Support\ArrayWrapper::add PHP Method

add() public method

You can to escape a dot in a key surrendering with brackets: "[.]".
public add ( $key, $value ) : array
$key
$value
return array
    public function add($key, $value)
    {
        if ($this->has($key) === false) {
            $this->set($key, $value);
        }
        return $this->array;
    }

Usage Example

Example #1
0
 public function testSet()
 {
     $a = new ArrayWrapper();
     $a->set('site.name', 'Yo! Symfony');
     $a->add('site.pages.index[.]html', 'The content');
     $this->assertEquals('Yo! Symfony', $a->get('site.name'));
     $this->assertEquals('The content', $a->get('site.pages.index[.]html'));
 }