本文整理汇总了PHP中TYPO3\CMS\Extbase\Reflection\ReflectionService::getPropertyTagValues方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionService::getPropertyTagValues方法的具体用法?PHP ReflectionService::getPropertyTagValues怎么用?PHP ReflectionService::getPropertyTagValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Extbase\Reflection\ReflectionService
的用法示例。
在下文中一共展示了ReflectionService::getPropertyTagValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderStatic
/**
* Default implementation for use in compiled templates
*
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
if (self::$staticReflectionService === NULL) {
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
self::$staticReflectionService = $objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
}
$property = $arguments['property'];
$validatorName = isset($arguments['validatorName']) ? $arguments['validatorName'] : NULL;
$object = isset($arguments['object']) ? $arguments['object'] : NULL;
if (NULL === $object) {
$object = self::getFormObject($renderingContext->getViewHelperVariableContainer());
}
$className = get_class($object);
if (FALSE !== strpos($property, '.')) {
$pathSegments = explode('.', $property);
foreach ($pathSegments as $property) {
if (TRUE === ctype_digit($property)) {
continue;
}
$annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'var');
$possibleClassName = array_pop($annotations);
if (FALSE !== strpos($possibleClassName, '<')) {
$className = array_pop(explode('<', trim($possibleClassName, '>')));
} elseif (TRUE === class_exists($possibleClassName)) {
$className = $possibleClassName;
}
}
}
$annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'validate');
$hasEvaluated = TRUE;
if (0 < count($annotations) && (NULL === $validatorName || TRUE === in_array($validatorName, $annotations))) {
return static::renderStaticThenChild($arguments, $hasEvaluated);
}
return static::renderStaticElseChild($arguments, $hasEvaluated);
}
示例2: render
/**
* Render
*
* Renders the then-child if the property at $property of the
* object at $object (or the associated form object if $object
* is not specified) uses a certain @validate validator.
*
* @param string $property The property name, dotted path supported, to determine required
* @param string $validatorName The class name of the Validator that indicates the property is required
* @param DomainObjectInterface $object Optional object - if not specified, grabs the associated form object
* @return string
*/
public function render($property, $validatorName = NULL, DomainObjectInterface $object = NULL)
{
if (NULL === $object) {
$object = $this->getFormObject();
}
$className = get_class($object);
if (FALSE !== strpos($property, '.')) {
$pathSegments = explode('.', $property);
foreach ($pathSegments as $property) {
if (TRUE === ctype_digit($property)) {
continue;
}
$annotations = $this->ownReflectionService->getPropertyTagValues($className, $property, 'var');
$possibleClassName = array_pop($annotations);
if (FALSE !== strpos($possibleClassName, '<')) {
$className = array_pop(explode('<', trim($possibleClassName, '>')));
} elseif (TRUE === class_exists($possibleClassName)) {
$className = $possibleClassName;
}
}
}
$annotations = $this->ownReflectionService->getPropertyTagValues($className, $property, 'validate');
if (0 < count($annotations) && (NULL === $validatorName || TRUE === in_array($validatorName, $annotations))) {
return $this->renderThenChild();
}
return $this->renderElseChild();
}
示例3: evaluateCondition
/**
* @param array $arguments
* @return boolean
*/
protected static function evaluateCondition($arguments = null)
{
if (self::$staticReflectionService === null) {
$objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
self::$staticReflectionService = $objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
}
$property = $arguments['property'];
$validatorName = isset($arguments['validatorName']) ? $arguments['validatorName'] : null;
$object = isset($arguments['object']) ? $arguments['object'] : null;
if (null === $object) {
$object = static::getFormObject($renderingContext->getViewHelperVariableContainer());
}
$className = get_class($object);
if (false !== strpos($property, '.')) {
$pathSegments = explode('.', $property);
foreach ($pathSegments as $property) {
if (true === ctype_digit($property)) {
continue;
}
$annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'var');
$possibleClassName = array_pop($annotations);
if (false !== strpos($possibleClassName, '<')) {
$className = array_pop(explode('<', trim($possibleClassName, '>')));
} elseif (true === class_exists($possibleClassName)) {
$className = $possibleClassName;
}
}
}
$annotations = self::$staticReflectionService->getPropertyTagValues($className, $property, 'validate');
return count($annotations) && (!$validatorName || in_array($validatorName, $annotations));
}