__isset() public method

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).
See also: http://php.net/manual/en/function.isset.php
public __isset ( string $name ) : boolean
$name string the property name or the event name
return boolean whether the named property is set
Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function __isset($name)
 {
     if (property_exists($this->obj, $name)) {
         return $this->obj->{$name} !== null;
     }
     return parent::__isset($name);
 }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 4
0
 public function __isset($name)
 {
     if (isset($this->_api->{$name})) {
         return true;
     } else {
         return parent::__isset($name);
     }
 }
Ejemplo n.º 5
0
 /**
  * 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);
     }
 }
Ejemplo n.º 6
0
 /**
  * @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);
 }
Ejemplo n.º 7
0
 /**
  * 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);
     }
 }
Ejemplo n.º 8
0
 /**
  * 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);
 }