當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Component::__set方法代碼示例

本文整理匯總了PHP中yii\base\Component::__set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Component::__set方法的具體用法?PHP Component::__set怎麽用?PHP Component::__set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\Component的用法示例。


在下文中一共展示了Component::__set方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __set

 public function __set($name, $value)
 {
     if (is_int($name)) {
         $this->{$this->_containerName}[$name] = $value;
     } else {
         parent::__set($name, $value);
     }
 }
開發者ID:communityii,項目名稱:yii2-common,代碼行數:8,代碼來源:ArrayComponent.php

示例2: __set

 /**
  * @inheritdoc
  */
 public function __set($name, $value)
 {
     if (property_exists($this->obj, $name)) {
         $this->obj->{$name} = $value;
         return;
     }
     parent::__set($name, $value);
 }
開發者ID:omgdef,項目名稱:yii2-unisender,代碼行數:11,代碼來源:UniSender.php

示例3: __set

 public function __set($name, $value)
 {
     if (!isset($this->{$name})) {
         $this->{$name} = $value;
         return true;
     } else {
         return parent::__set($name, $value);
     }
 }
開發者ID:macklus,項目名稱:yii2-crawler,代碼行數:9,代碼來源:Crawler.php

示例4: __set

 /**
  * Any requests to set or get attributes or call methods on this class that
  * are not found are redirected to the {@link IService} object.
  * @param string $name the attribute name
  * @param mixed $value the attribute value
  * @return mixed
  * @throws \Exception
  */
 public function __set($name, $value)
 {
     try {
         return parent::__set($name, $value);
     } catch (\Exception $e) {
         if (property_exists($this->_service, $name)) {
             $this->_service->{$name} = $value;
         } else {
             throw $e;
         }
     }
 }
開發者ID:strong2much,項目名稱:yii2-sms,代碼行數:20,代碼來源:SmsManager.php

示例5: __set

 /**
  * Sets value of a component property.
  * Do not call this method. This is a PHP magic method that we override
  * to allow using the following syntax to set a property
  * <pre>
  * $this->propertyName=$value;
  * </pre>
  * @param string $name the property name
  * @param mixed $value the property value
  * @return mixed
  * @throws \yii\base\UnknownPropertyException|\yii\base\InvalidCallException
  *         if the property is not defined or the property is read only.
  * @see __get
  */
 public function __set($name, $value)
 {
     $setter = 'set' . $name;
     if (property_exists($this->getClient(), $name)) {
         return $this->getClient()->{$name} = $value;
     } elseif (method_exists($this->getClient(), $setter)) {
         return $this->getClient()->{$setter}($value);
     }
     return parent::__set($name, $value);
 }
開發者ID:yii2ext,項目名稱:redis,代碼行數:24,代碼來源:Connection.php

示例6: __set

 /**
  * @param string $name
  * @param mixed $value
  * @throws UnknownPropertyException
  */
 public function __set($name, $value)
 {
     $setter = 'set' . $name;
     if (method_exists($this->getZabbixObject(), $setter)) {
         $this->getZabbixObject()->{$setter}($value);
     } elseif (method_exists($this, $setter)) {
         parent::__set($name, $value);
     } elseif (method_exists($this, 'get' . $name)) {
         throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
     } else {
         throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
     }
 }
開發者ID:fiamma06,項目名稱:yii2-zabbix-api,代碼行數:18,代碼來源:ZabbixComponent.php


注:本文中的yii\base\Component::__set方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。