public function hasProperty(ClassReflection $classReflection, string $propertyName) : bool { $traitNames = $this->getTraitNames($classReflection->getNativeReflection()); if (!in_array(\Nette\SmartObject::class, $traitNames, true)) { return false; } $property = \Nette\Utils\ObjectMixin::getMagicProperty($classReflection->getName(), $propertyName); if ($property === null) { return false; } $getterMethod = $this->getMethodByProperty($classReflection, $propertyName); if ($getterMethod === null) { return false; } return $getterMethod->isPublic(); }
/** * @return bool */ public function __isset($name) { $uname = ucfirst($name); return ObjectMixin::getMagicProperty(get_class($this), $name) || $name !== '' && ($methods = ObjectMixin::getMethods(get_class($this))) && (isset($methods['get' . $uname]) || isset($methods['is' . $uname])); }