yii\base\Component::hasProperty PHP Метод

hasProperty() публичный Метод

A property is defined if: - the class has a getter or setter method associated with the specified name (in this case, property name is case-insensitive); - the class has a member variable with the specified name (when $checkVars is true); - an attached behavior has a property of the given name (when $checkBehaviors is true).
См. также: canGetProperty()
См. также: canSetProperty()
public hasProperty ( string $name, boolean $checkVars = true, boolean $checkBehaviors = true ) : boolean
$name string the property name
$checkVars boolean whether to treat member variables as properties
$checkBehaviors boolean whether to treat behaviors' properties as properties of this component
Результат boolean whether the property is defined
    public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
    {
        return $this->canGetProperty($name, $checkVars, $checkBehaviors) || $this->canSetProperty($name, false, $checkBehaviors);
    }

Usage Example

Пример #1
0
 /**
  * @inheritdoc
  */
 public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
 {
     if (property_exists($this->obj, $name)) {
         return true;
     }
     return parent::hasProperty($name, $checkVars, $checkBehaviors);
 }