FluidTYPO3\Vhs\ViewHelpers\Condition\Form\HasValidatorViewHelper::evaluateCondition PHP Method

evaluateCondition() protected static method

protected static evaluateCondition ( array $arguments = null ) : boolean
$arguments array
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));
    }