public function testString() { $this->object->set('A string'); $this->assertEquals('A string', $this->object->value()); $this->object->set('Another string'); $this->assertEquals('Another string', $this->object->value()); }
/** * Construct * @param array $default * @param array $options [optional] * @throws \InvalidArgumentException */ public function __construct(array $default, $options = array()) { if (!is_array($default)) { // Typehint in constructor does not fetch this throw new \InvalidArgumentException('Parameter\\Set needs an array as default value.'); } parent::__construct($default, $options); }
/** * Set value * @param mixed $value new value * @throws \InvalidArgumentException */ public function set($value) { if ($this->valueIsAllowed($value)) { parent::set($value); } else { throw new \InvalidArgumentException('Invalid option ("' . $value . '") for select value.'); } }
/** * Value * @return mixed */ public final function value() { return $this->Parameter->value(); }