Beispiel #1
0
 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());
 }
Beispiel #2
0
 /**
  * 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);
 }
Beispiel #3
0
 /**
  * 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.');
     }
 }
Beispiel #4
0
 /**
  * Value
  * @return mixed
  */
 public final function value()
 {
     return $this->Parameter->value();
 }