This method will check in the following order and act accordingly:
- a property defined by a setter: return whether the property is set
- a property of a behavior: return whether the property is set
- return false for non existing properties
Do not call this method directly as it is a PHP magic method that
will be implicitly called when executing isset($component->property).
/** * @inheritdoc */ public function __isset($name) { if (property_exists($this->obj, $name)) { return $this->obj->{$name} !== null; } return parent::__isset($name); }
public function __isset($name) { if ($name == 'jsVar') { return isset($this->_jsVar); } return parent::__isset($name); }
/** * Checks if a property value is null. * This method overrides the parent implementation by checking if the named component is loaded. * @param string $name the property name or the event name * @return boolean whether the property value is null */ public function __isset($name) { if ($this->has($name, true)) { return true; } else { return parent::__isset($name); } }
public function __isset($name) { if (isset($this->_api->{$name})) { return true; } else { return parent::__isset($name); } }
/** * Checks if a property value is null. * This method overrides the parent implementation by checking if the named component is loaded. * @param string $name the property name or the event name * @return boolean whether the property value is null */ public function __isset($name) { // 可以看到,如果用isset去判断是否含有某个component,只能判断已经实例化过的component if ($this->has($name, true)) { return true; } else { return parent::__isset($name); } }
/** * @param string $name * @return bool|mixed * @throws \yii\base\UnknownPropertyException */ public function __isset($name) { if (isset($this->objects[$name])) { return true; } return parent::__isset($name); }
/** * Checks if a property value is null. * This method overrides the parent implementation by checking * if the named component is loaded. * @param string $name the property name or the event name * @return boolean whether the property value is null */ public function __isset($name) { if ($this->hasComponent($name)) { return $this->getComponent($name) !== null; } else { return parent::__isset($name); } }
/** * Checks if a property value is null. * Do not call this method. This is a PHP magic method that we override * to allow using isset() to detect if a component property is set or not. * @param string $name the property name * @return boolean */ public function __isset($name) { $getter = 'get' . $name; if (property_exists($this->getClient(), $name)) { return true; } elseif (method_exists($this->getClient(), $getter)) { return true; } return parent::__isset($name); }