本文整理汇总了PHP中Reader::getPropertyAnnotation方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::getPropertyAnnotation方法的具体用法?PHP Reader::getPropertyAnnotation怎么用?PHP Reader::getPropertyAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader::getPropertyAnnotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAccessProperties
/**
* Get a list of properties and the access that are given to them for given object.
*
* @param array $properties The properties of the object to read.
* @param Reader $annotationReader The annotation reader to use.
*
* @return array The list of properties and their access.
*/
public static function getAccessProperties($properties, $annotationReader)
{
$objectAccessProperties = array();
foreach ($properties as $propertyName => $property) {
if (empty($objectAccessProperties[$propertyName])) {
$objectAccessProperties[$propertyName] = array();
}
// Getters / Setters related annotations
$propertyAccessAnnotation = $annotationReader->getPropertyAnnotation($property, self::$accessAnnotationClass);
$accessProperties = array();
if ($propertyAccessAnnotation !== null) {
$accessProperties = $propertyAccessAnnotation->getAccessProperties();
}
// Collection related annotations
$collectionAnnotation = null;
foreach (self::$collectionAnnotationClasses as $annotationBehavior => $annotationClass) {
$collectionAnnotation = $annotationReader->getPropertyAnnotation($property, $annotationClass);
if ($collectionAnnotation !== null) {
break;
}
}
$collectionMethods = array();
if ($collectionAnnotation !== null) {
$collectionMethods = $collectionAnnotation->getMethods();
}
// Merge and save the two arrays
$objectAccessProperties[$propertyName] = array_merge($accessProperties, $collectionMethods);
}
return $objectAccessProperties;
}
示例2: getPropertyAnnotation
/**
* {@inheritDoc}
*/
public function getPropertyAnnotation(\ReflectionProperty $property, $annotation)
{
return $this->delegate->getPropertyAnnotation($property, $annotation);
}