/** * Test setting a default value if not alreay assigned * * @covers \Hubzero\Base\Object::def * @return void **/ public function testDef() { $obj = new Object(); $obj->def('bar', 'ipsum'); $this->assertEquals($obj->get('bar'), 'ipsum'); $obj->set('foo', 'bar'); $obj->def('foo', 'lorem'); $this->assertEquals($obj->get('foo'), 'bar'); }
/** * Returns a property of the object or the default value if the property is not set. * * @param string $property The name of the property * @param mixed $default The default value * @return mixed The value of the property */ public function get($property, $default = null) { if ($property == 'scope') { return $this->_scope; } if ($property == 'scope_id') { return $this->_scope_id; } return parent::get($property, $default); }