Evaluate processors on given value.

@param mixed $valueToProcess
@param array $configurationWithEventualProcessors
@param string $fusionPath
@param AbstractFusionObject $contextObject
@return mixed
2307
protected function evaluateProcessors($valueToProcess, $configurationWithEventualProcessors, $fusionPath, AbstractFusionObject $contextObject = null)
    {
        if (isset($configurationWithEventualProcessors['__meta']['process'])) {
            $processorConfiguration = $configurationWithEventualProcessors['__meta']['process'];
            $positionalArraySorter = new PositionalArraySorter($processorConfiguration, '__meta.position');
            foreach ($positionalArraySorter->getSortedKeys() as $key) {
                $processorPath = $fusionPath . '/__meta/process/' . $key;
                if ($this->evaluateIfCondition($processorConfiguration[$key], $processorPath, $contextObject) === false) {
                    continue;
                }
                if (isset($processorConfiguration[$key]['expression'])) {
                    $processorPath .= '/expression';
                }

                $this->pushContext('value', $valueToProcess);
                $result = $this->evaluateInternal($processorPath, self::BEHAVIOR_EXCEPTION, $contextObject);
                if ($this->getLastEvaluationStatus() !== static::EVALUATION_SKIPPED) {
                    $valueToProcess = $result;
                }
                $this->popContext();
            }
        }

        return $valueToProcess;
    }
694050
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		final Class<T> ourType = getType();
		if( !(value.getClass().equals(ourType)) ) {
			throw new SuperCsvCellProcessorException(ourType, value, context, this);
		}
		final TemporalAccessor timeType = ourType.cast(value);
		try {
			if( formatter != null ) {
				return formatter.format(timeType);
			} else {
				return timeType.toString();
			}
		}
		catch(DateTimeException | IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException(
				String.format("Failed to format value as a %s", ourType.getSimpleName()), context, this, e);
		}
	}
1100708
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        // Scope exclusive to the evaluated expression
        // We make use of the underscore prefix (`_`) here to limit the possible conflicts with the variables injected
        // in the scope.
        $_scope = $scope;
        try {
            $_scope['current'] = $fixture->getValueForCurrent();

            if ($_scope['current'] instanceof FixtureInterface) {
                $_scope['current'] = $fixtureSet->getObjects()->get($_scope['current'])->getInstance();
            }
        } catch (NoValueForCurrentException $exception) {
            // Continue
        }

        $expression = $this->replacePlaceholders($value->getValue());
        // Closure in which the expression is evaluated; This is done in a closure to avoid the expression to have
        // access to this method variables (which should remain unknown) and we injected only the variables of the
        // closure.
        $evaluateExpression = function ($_expression) use ($_scope) {
            foreach ($_scope as $_scopeVariableName => $_scopeVariableValue) {
                $$_scopeVariableName = $_scopeVariableValue;
            }

            return eval("return $_expression;");
        };

        try {
            $evaluatedExpression = $evaluateExpression($expression);
        } catch (Throwable $throwable) {
            throw UnresolvableValueExceptionFactory::createForCouldNotEvaluateExpression($value, 0, $throwable);
        }

        return new ResolvedValueWithFixtureSet($evaluatedExpression, $fixtureSet);
    }
443278
public static function createPrototype($path, $prototype, ConfigurationInterface $configuration)
    {
        $prototypeDeep = ArrayHelper::buildDeepArrayWithBody($path, ['new' => $prototype]);

        //create full config - incl. validation
        $tree = $configuration->getConfigTreeBuilder()->buildTree();
        $config = array($tree->getName() => (new Processor())->processConfiguration($configuration, $prototypeDeep));

        $accessor = PropertyAccess::createPropertyAccessor();
        $prototypeExtended = $accessor->getValue($config, ArrayHelper::buildDeepKey($path));

        return current($prototypeExtended);
    }
486722
protected function canRenderWithConfiguration(array $fusionConfiguration)
    {
        if ($this->hasExpressionOrValue($fusionConfiguration)) {
            return true;
        }

        if (isset($fusionConfiguration['__meta']['class']) && isset($fusionConfiguration['__objectType'])) {
            return true;
        }

        return false;
    }
253775
public function processValue(CompilationContext $compilationContext)
    {
        if ('constant' == $this->value['type']) {
            $constant = new Constants();
            $compiledExpression = $constant->compile($this->value, $compilationContext);

            $this->value = [
                'type' => $compiledExpression->getType(),
                'value' => $compiledExpression->getCode(),
            ];

            return;
        }

        if ('static-constant-access' == $this->value['type']) {
            $staticConstantAccess = new StaticConstantAccess();
            $compiledExpression = $staticConstantAccess->compile($this->value, $compilationContext);

            $this->value = [
                'type' => $compiledExpression->getType(),
                'value' => $compiledExpression->getCode(),
            ];

            return;
        }
    }
1074413
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		if (!(value instanceof String)) {
			throw new SuperCsvCellProcessorException(String.class, value,
					context, this);
		}

		final String string = (String) value;
		final T result;
		try {
			if (formatter != null) {
				result = parse(string, formatter);
			} else {
				result = parse(string);
			}
		} catch (IllegalArgumentException e) {
			throw new SuperCsvCellProcessorException("Failed to parse value",
					context, this, e);
		}

		return next.execute(result, context);
	}
518084
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		if( !(value instanceof Boolean) ) {
			throw new SuperCsvCellProcessorException(Boolean.class, value, context, this);
		}
		
		final String result = ((Boolean) value).booleanValue() ? trueValue : falseValue;
		return next.execute(result, context);
	}
1016802
protected function processValue($value, $isRoot = false)
    {
        if (\is_array($value)) {
            foreach ($value as $k => $v) {
                if ($isRoot) {
                    $this->currentId = $k;
                }
                if ($v !== $processedValue = $this->processValue($v, $isRoot)) {
                    $value[$k] = $processedValue;
                }
            }
        } elseif ($value instanceof ArgumentInterface) {
            $value->setValues($this->processValue($value->getValues()));
        } elseif ($value instanceof Expression && $this->processExpressions) {
            $this->getExpressionLanguage()->compile((string) $value, ['this' => 'container']);
        } elseif ($value instanceof Definition) {
            $value->setArguments($this->processValue($value->getArguments()));
            $value->setProperties($this->processValue($value->getProperties()));
            $value->setMethodCalls($this->processValue($value->getMethodCalls()));

            $changes = $value->getChanges();
            if (isset($changes['factory'])) {
                $value->setFactory($this->processValue($value->getFactory()));
            }
            if (isset($changes['configurator'])) {
                $value->setConfigurator($this->processValue($value->getConfigurator()));
            }
        }

        return $value;
    }
869699
private function serializeValue($configurationValue, $configurationType)
    {
        switch ($configurationType) {

            case ElcodiConfigurationTypes::TYPE_ARRAY:
                $configurationValue = json_encode($configurationValue);
                break;
        }

        return $configurationValue;
    }
236010
public function evaluate()
    {
        $collection = $this->getItems();

        $result = [];
        if ($collection === null) {
            return $result;
        }
        $this->numberOfRenderedNodes = 0;
        $itemName = $this->getItemName();
        if ($itemName === null) {
            throw new FusionException('The Collection needs an itemName to be set.', 1344325771);
        }
        $itemKey = $this->getItemKey();
        $iterationName = $this->getIterationName();
        $collectionTotalCount = count($collection);

        $itemRenderPath = $this->path . '/itemRenderer';
        $fallbackRenderPath =  $this->path . '/content';
        if ($this->runtime->canRender($itemRenderPath) === false && $this->runtime->canRender($fallbackRenderPath)) {
            $itemRenderPath = $fallbackRenderPath;
        }

        foreach ($collection as $collectionKey => $collectionElement) {
            $context = $this->runtime->getCurrentContext();
            $context[$itemName] = $collectionElement;
            if ($itemKey !== null) {
                $context[$itemKey] = $collectionKey;
            }
            if ($iterationName !== null) {
                $context[$iterationName] = $this->prepareIterationInformation($collectionTotalCount);
            }

            $this->runtime->pushContextArray($context);
            $result[$collectionKey] =  $this->runtime->render($itemRenderPath);
            $this->runtime->popContext();
            $this->numberOfRenderedNodes++;
        }

        return $result;
    }
650475
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        $functionName = $value->getName();
        if (false === function_exists($functionName)
            || array_key_exists($functionName, $this->functionBlacklist)
        ) {
            return $this->resolver->resolve($value, $fixture, $fixtureSet, $scope, $context);
        }

        $arguments = $value->getArguments();

        return new ResolvedValueWithFixtureSet(
            $functionName(...$arguments),
            $fixtureSet
        );
    }
547378
public function evaluate()
    {
        $actionRequest =  $this->runtime->getControllerContext()->getRequest();
        if (!$actionRequest instanceof ActionRequest) {
            $actionRequest = null;
        }
        $fluidTemplate = new Helpers\FluidView($this, $actionRequest);

        $templatePath = $this->getTemplatePath();
        if ($templatePath === null) {
            throw new \Exception(sprintf("
                No template path set.
                Most likely you didn't configure `templatePath` in your Fusion object correctly.
                For example you could add and adapt the following line to your Fusion:
                `prototype(%s) < prototype(Neos.Fusion:Template) {
                  templatePath = 'resource://Vendor.Package/Private/Templates/MyObject.html'
                }`
                ", $this->fusionObjectName));
        }
        $fluidTemplate->setTemplatePathAndFilename($templatePath);

        $partialRootPath = $this->getPartialRootPath();
        if ($partialRootPath !== null) {
            $fluidTemplate->setPartialRootPath($partialRootPath);
        }

        $layoutRootPath = $this->getLayoutRootPath();
        if ($layoutRootPath !== null) {
            $fluidTemplate->setLayoutRootPath($layoutRootPath);
        }

        // Template resources need to be evaluated from the templates package not the requests package.
        if (strpos($templatePath, 'resource://') === 0) {
            $templateResourcePathParts = parse_url($templatePath);
            foreach ($fluidTemplate->getRenderingContext()->buildParserConfiguration()->getInterceptors(InterceptorInterface::INTERCEPT_TEXT) as $interceptor) {
                if ($interceptor instanceof ResourceInterceptor) {
                    $interceptor->setDefaultPackageKey($templateResourcePathParts['host']);
                }
            }
        }

        foreach ($this->properties as $key => $value) {
            if (in_array($key, $this->ignoreProperties)) {
                continue;
            }
            if (!is_array($value)) {
                // if a value is a SIMPLE TYPE, e.g. neither an Eel expression nor a Fusion object,
                // we can just evaluate it (to handle processors) and then assign it to the template.
                $evaluatedValue = $this->fusionValue($key);
                $fluidTemplate->assign($key, $evaluatedValue);
            } else {
                // It is an array; so we need to create a "proxy" for lazy evaluation, as it could be a
                // nested Fusion object, Eel expression or simple value.
                $fluidTemplate->assign($key, new Helpers\FusionPathProxy($this, $this->path . '/' . $key, $value));
            }
        }

        $this->initializeView($fluidTemplate);

        $sectionName = $this->getSectionName();
        if ($sectionName !== null) {
            return $fluidTemplate->renderSection($sectionName);
        } else {
            return $fluidTemplate->render();
        }
    }
1340152
public static function DistinctValuesWithCollation( $context, $iter, $collation )
	{
		if ( ! is_null( $collation ) && $collation != XmlReservedNs::collationCodepoint )
		{
			if ( ! setlocale( LC_COLLATE, $collation ) )
			{
				throw XPath2Exception::withErrorCodeAndParam( "FOCH0002", Resources::FOCH0002, $collation );
			}
		}

		return new NodeIterator( function() use( $iter, $collation ) { return ExtFuncs::DistinctIterator( $iter, $collation ); } );
	}
637146
public Object execute(final Object value, final CsvContext context) {
		validateInputNotNull(value, context);
		
		if( !(value instanceof String) ) {
			throw new SuperCsvCellProcessorException(String.class, value, context, this);
		}
		
		final String stringValue = (String) value;
		final Boolean result;
		if( contains(trueValues, stringValue, ignoreCase) ) {
			result = Boolean.TRUE;
		} else if( contains(falseValues, stringValue, ignoreCase) ) {
			result = Boolean.FALSE;
		} else {
			throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Boolean", value),
				context, this);
		}
		
		return next.execute(result, context);
	}
694767
protected function finalizePathEvaluation($cacheContext, $needToPopContext = false, $needToPopApplyValues = false)
    {
        if ($needToPopContext) {
            $this->popContext();
        }

        if ($needToPopApplyValues) {
            $this->popApplyValues();
        }

        $this->runtimeContentCache->leave($cacheContext);
    }
415996
public function handleRenderingException($fusionPath, \Exception $exception)
    {
        if ($exception instanceof RuntimeException) {
            throw $exception;
        } else {
            throw new RuntimeException('Fusion Rendering Exception, see fusionPath and nested Exception for details.', 1401803055, $exception, $fusionPath);
        }
    }