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


PHP Component::__get方法代碼示例

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


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

示例1: __get

 /**
  * Check whether we have a plugin installed with that name previous firing up the call
  * @param string $name
  * @return mixed|void
  */
 public function __get($name)
 {
     if (ArrayHelper::keyExists($name, $this->getInstalledPlugins())) {
         return $this->getPlugin($name);
     }
     return parent::__get($name);
 }
開發者ID:sjaakp,項目名稱:yii2-leaflet-extension,代碼行數:12,代碼來源:PluginManager.php

示例2: __get

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

示例3: getValue

 protected function getValue($name)
 {
     if (isset(static::$_modules[$name])) {
         return Yii::createObject(static::$_modules[$name]);
     }
     return parent::__get($name);
 }
開發者ID:kousuutetu,項目名稱:yii2-wechat,代碼行數:7,代碼來源:Wechat.php

示例4: __get

 /**
  * Getter magic method.
  * This method is overridden to support accessing components like reading properties.
  * @param string $name component or property name
  * @return mixed the named property value
  */
 public function __get($name)
 {
     if ($this->has($name)) {
         return $this->get($name);
     } else {
         return parent::__get($name);
     }
 }
開發者ID:sanggabee,項目名稱:hellomedia-yii-basic,代碼行數:14,代碼來源:ServiceLocator.php

示例5: __get

 /**
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     try {
         parent::__get($name);
     } catch (\yii\base\UnknownPropertyException $e) {
         return $this->mailChimp->{$name};
     }
 }
開發者ID:bdart,項目名稱:yii2-mailchimp,代碼行數:12,代碼來源:Mailchimp.php

示例6: __get

 public function __get($name)
 {
     if (property_exists($this->_api, $name)) {
         return $this->_api->{$name};
     } else {
         return parent::__get($name);
     }
 }
開發者ID:heartshare,項目名稱:yii2-uploadcare,代碼行數:8,代碼來源:Api.php

示例7: __get

 /**
  * 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
  * @return mixed
  * @throws \Exception
  */
 public function __get($name)
 {
     try {
         return parent::__get($name);
     } catch (\Exception $e) {
         if (property_exists($this->_service, $name)) {
             return $this->_service->{$name};
         } else {
             throw $e;
         }
     }
 }
開發者ID:strong2much,項目名稱:yii2-sms,代碼行數:19,代碼來源:SmsManager.php

示例8:

 /**
  * @param $name
  * @return \Google_Service|mixed
  */
 function __get($name)
 {
     if (!isset($this->services[$name])) {
         return parent::__get($name);
     }
     if (null === $this->serviceInstances[$name]) {
         /** @var \Google_Service $serviceClass */
         $serviceClass = $this->services[$name]["class"];
         $this->serviceInstances[$name] = new $serviceClass($this->getClient());
     }
     return $this->serviceInstances[$name];
 }
開發者ID:gillbeits,項目名稱:yii2-google-api,代碼行數:16,代碼來源:GoogleApi.php

示例9: __get

 public function __get($name)
 {
     $property = '_' . $name;
     if (property_exists($this, $property) && $this->{$property} === null) {
         $className = '\\' . ucfirst($name);
         $this->{$property} = new $className($this->_module->account, $this->_module->password);
         return $this->{$property};
     }
     return parent::__get($name);
 }
開發者ID:INOVADADOS,項目名稱:yii2-talma-zenvia,代碼行數:10,代碼來源:ApiComponent.php

示例10: __get

 /**
  * @param string $name
  * @return mixed
  * @throws \yii\base\UnknownPropertyException
  */
 public function __get($name)
 {
     if (isset($this->objects[$name])) {
         return $this->objects[$name];
     }
     return parent::__get($name);
 }
開發者ID:larryli,項目名稱:ipv4-yii2,代碼行數:12,代碼來源:IPv4.php

示例11: __get

 public function __get($name)
 {
     return $this->canGetProperty($name) ? parent::__get($name) : $this->getWorker($name);
 }
開發者ID:voodoo-mobile,項目名稱:yii2-bg-tasks,代碼行數:4,代碼來源:BackgroundTasks.php

示例12: __get

 public function __get($name)
 {
     if ($name != 'Mp' && substr($name, 0, 2) == 'Mp') {
         $className = 'ashdark\\wechat\\mp\\' . $name;
         if (class_exists($className)) {
             if (empty($this->_mp_arr[$name])) {
                 $this->_mp_arr[$name] = new $className(['mp' => $this->getMp()]);
             }
             return $this->_mp_arr[$name];
         }
     }
     return parent::__get($name);
 }
開發者ID:ashdark,項目名稱:yii2-wechat-sdk,代碼行數:13,代碼來源:MpWechat.php

示例13: __get

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

示例14: __get

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

示例15: __get

 /**
  * Get the value of format pattern of current locale of application.
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     $pattern = $this->getPattern();
     if (isset($pattern[$name])) {
         return $pattern[$name];
     }
     return parent::__get($name);
 }
開發者ID:bupy7,項目名稱:yii2-datetime-converter,代碼行數:13,代碼來源:Converter.php


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