__set() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $object->property = $value;.
See also: __get()
public __set ( string $name, mixed $value )
$name string the property name or the event name
$value mixed the property value
示例#1
0
 /**
  * @param string $name
  * @param mixed $value
  */
 public function __set($name, $value)
 {
     try {
         parent::__set($name, $value);
     } catch (UnknownPropertyException $e) {
     }
 }
示例#2
0
 /**
  * Sets value of a property.
  *
  * @param string $name the property name or the event name
  * @param mixed $value the property value
  * @throws UnknownPropertyException if the property is not defined
  * @throws InvalidCallException if the property is read-only
  * @see __get()
  */
 public function __set($name, $value)
 {
     if (isset($this->_data[$name])) {
         $this->_data[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }
示例#3
0
文件: ApiObject.php 项目: vetoni/toko
 /**
  * @param string $name
  * @param mixed $value
  * @throws \yii\base\UnknownPropertyException
  */
 public function __set($name, $value)
 {
     if ($this->canSetProperty($name)) {
         parent::__set($name, $value);
     } else {
         $this->model->{$name} = $value;
     }
 }
示例#4
0
 public function __set($name, $value)
 {
     if (strncmp($name, 'on ', 3) === 0) {
         $this->events[trim(substr($name, 3))] = $value;
         return;
     } else {
         parent::__set($name, $value);
     }
 }
 /**
  * @inheritdoc
  * @throws \yii\base\InvalidParamException
  */
 public function __set($name, $value)
 {
     if (array_key_exists($name, $this->_color)) {
         if ($value >= 0 && $value <= 255) {
             return $this->_color[$name] = $value;
         } else {
             throw new InvalidParamException('Wrong RGB value');
         }
     }
     parent::__set($name, $value);
 }
 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     // setters go first
     $setter = 'set' . $name;
     if (method_exists($this, $setter)) {
         $this->{$setter}($value);
     } elseif (array_key_exists($name, $this->options)) {
         $this->options[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }