yii\base\Object::__isset PHP Method

__isset() public method

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing isset($object->property). Note that if the property is not defined, false will be returned.
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 (not null).
    public function __isset($name)
    {
        $getter = 'get' . $name;
        if (method_exists($this, $getter)) {
            return $this->{$getter}() !== null;
        } else {
            return false;
        }
    }

Usage Example

示例#1
0
 /**
  * Checks if a property is set, i.e. defined and not null.
  *
  * Do not call this method directly as it is a PHP magic method that
  * will be implicitly called when executing `isset($component->property)` or `empty($component->property)`.
  * @param string $name the property name or the event name
  * @return boolean whether the named property is set
  * @see http://php.net/manual/en/function.isset.php
  */
 public function __isset($name)
 {
     if (isset($this->_data[$name])) {
         return true;
     } else {
         return parent::__isset($name);
     }
 }
All Usage Examples Of yii\base\Object::__isset