__set() публичный Метод

Set an object property
public __set ( string $strKey, mixed $varValue )
$strKey string The property name
$varValue mixed The property value
Пример #1
0
 /**
  * Add specific attributes
  *
  * @param string $strKey
  * @param mixed  $varValue
  */
 public function __set($strKey, $varValue)
 {
     switch ($strKey) {
         case 'options':
             $this->arrOptions = \StringUtil::deserialize($varValue);
             break;
         default:
             parent::__set($strKey, $varValue);
             break;
     }
 }
Пример #2
0
 /**
  * Add specific attributes
  *
  * @param string $strKey   The attribute name
  * @param mixed  $varValue The attribute value
  */
 public function __set($strKey, $varValue)
 {
     switch ($strKey) {
         case 'placeholder':
             $this->arrAttributes['placeholder'] = $varValue;
             break;
         case 'required':
         case 'mandatory':
         case 'minlength':
         case 'maxlength':
             // Ignore
             break;
         default:
             parent::__set($strKey, $varValue);
             break;
     }
 }
Пример #3
0
 /**
  * Add specific attributes
  *
  * @param string $strKey   The attribute name
  * @param mixed  $varValue The attribute value
  */
 public function __set($strKey, $varValue)
 {
     switch ($strKey) {
         case 'maxlength':
             if ($varValue > 0) {
                 $this->arrAttributes['maxlength'] = $varValue;
             }
             break;
         case 'mandatory':
             if ($varValue) {
                 $this->arrAttributes['required'] = 'required';
             } else {
                 unset($this->arrAttributes['required']);
             }
             parent::__set($strKey, $varValue);
             break;
         case 'placeholder':
             $this->arrAttributes['placeholder'] = $varValue;
             break;
         default:
             parent::__set($strKey, $varValue);
             break;
     }
 }