/** * Set a value to entity. If property not exists, will not set it in. * * @param string $field Field name. * @param mixed $value Value. * * @return Entity Return self to support chaining. */ public function set($field, $value = null) { if (!property_exists($this, $field)) { return $this; } return parent::set($field, $value); }
/** * Method to test set(). * * @return void * * @covers Windwalker\Data\Data::set */ public function testGetAndSet() { $this->instance->set('wind', 'walker'); $this->assertEquals('walker', $this->instance->get('wind')); $this->assertEquals('talker', $this->instance->get('fire', 'talker')); }