/** * Returns array of persistent components. * This default implementation detects components by class-level annotation @persistent(cmp1, cmp2). * @return array */ public static function getPersistentComponents() { return (array) ComponentReflection::parseAnnotation(new \ReflectionClass(get_called_class()), 'persistent'); }
/** * Returns an annotation value. * @param string * @return string|NULL */ public function getAnnotation($name) { $res = ComponentReflection::parseAnnotation($this, $name); return $res ? end($res) : NULL; }
/** * Returns array of classes persistent parameters. They have public visibility and are non-static. * This default implementation detects persistent parameters by annotation @persistent. * @return array */ public static function getPersistentParams() { $rc = new \ReflectionClass(get_called_class()); $params = []; foreach ($rc->getProperties(\ReflectionProperty::IS_PUBLIC) as $rp) { if (!$rp->isStatic() && ComponentReflection::parseAnnotation($rp, 'persistent')) { $params[] = $rp->getName(); } } return $params; }