/** * Sets a default value if not already assigned. * * @param string $key The name of the parameter. * @param mixed $default An optional value for the parameter. * * @return mixed The value set, or the default if the value was not previously set (or null). * * @since 1.0 */ public function def($key, $default = '') { $this->registry->def($key, $default); return $this->registry->get($key); }
/** * Method to test def(). * * @return void * * @covers Windwalker\Registry\Registry::def */ public function testDef() { $this->assertNull($this->instance->get('lily')); $this->instance->def('lily', 'love'); $this->assertEquals($this->instance->get('lily'), 'love'); }