本文整理汇总了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);
}
示例2: __get
/**
* @inheritdoc
*/
public function __get($name)
{
if (property_exists($this->obj, $name)) {
return $this->obj->{$name};
}
return parent::__get($name);
}
示例3: getValue
protected function getValue($name)
{
if (isset(static::$_modules[$name])) {
return Yii::createObject(static::$_modules[$name]);
}
return parent::__get($name);
}
示例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);
}
}
示例5: __get
/**
* @param string $name
* @return mixed
*/
public function __get($name)
{
try {
parent::__get($name);
} catch (\yii\base\UnknownPropertyException $e) {
return $this->mailChimp->{$name};
}
}
示例6: __get
public function __get($name)
{
if (property_exists($this->_api, $name)) {
return $this->_api->{$name};
} else {
return parent::__get($name);
}
}
示例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;
}
}
}
示例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];
}
示例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);
}
示例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);
}
示例11: __get
public function __get($name)
{
return $this->canGetProperty($name) ? parent::__get($name) : $this->getWorker($name);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}