Post-Processor which is called whenever this object is encountered in a Fluid
object access.

Evaluates Fusion objects and eel expressions.

@return FusionPathProxy|mixed
@throws FusionException
422952
public function objectAccess()
    {
        if (!$this->fusionRuntime->canRender($this->path)) {
            return $this;
        }

        try {
            return $this->fusionRuntime->evaluate($this->path, $this->templateImplementation);
        } catch (\Exception $exception) {
            return $this->fusionRuntime->handleRenderingException($this->path, $exception);
        }
    }
254092
public function getRev()
    {
        if ($this->_receive) {
            return $this;
        }
        $postStr = !empty($this->postxml) ? $this->postxml : file_get_contents("php://input");
        if (!empty($postStr)) {
            $disableEntities = libxml_disable_entity_loader(true);
            $this->_receive = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
            libxml_disable_entity_loader($disableEntities);
        }
        return $this;
    }
238671
protected function getContextNode()
    {
        $baseNode = null;
        $view = $this->viewHelperVariableContainer->getView();
        if ($view instanceof FusionAwareViewInterface) {
            $fusionObject = $view->getFusionObject();
            $currentContext = $fusionObject->getRuntime()->getCurrentContext();
            if (isset($currentContext['node'])) {
                $baseNode = $currentContext['node'];
            }
        }

        return $baseNode;
    }
1103986
protected function handlePropTypeException($fusionPath, PropTypeException $exception, $referenceCode)
    {
        $messageBody = sprintf('<p class="neos-message-content">%s</p>', htmlspecialchars($exception->getMessage()));

        if ($this->renderTechnicalDetails) {
            $result = $exception->getResult();
            if ($result && $result->hasErrors()) {
                $errors = $result->getFlattenedErrors();
                $renderedErrors = [];
                foreach ($errors as $path => $pathErrors) {
                    foreach ($pathErrors as $error) {
                        $renderedErrors[] = sprintf('%s: %s', $path, $error->render());
                    }
                }
                $messageBody .= sprintf('<p class="neos-message-stacktrace">The following errors were detected:<br/><code style="white-space: pre-wrap"> - %s</code></p>', implode(chr(10) . ' - ', $renderedErrors));
                $messageBody .= sprintf('<p class="neos-message-stacktrace"><code>FusionPath: %s</code></p>', htmlspecialchars($fusionPath));

            }
        }

        if ($referenceCode) {
            $messageBody .= sprintf('<p class="neos-reference-code">%s</p>', $this->formatErrorCodeMessage($referenceCode));
        }

        $message = sprintf(
            '<div class="neos-message-header"><div class="neos-message-icon"><i class="icon-warning-sign"></i></div><h1>An exception was thrown while Neos tried to render your page</h1></div>' .
            '<div class="neos-message-wrapper">%s</div>',
            $messageBody
        );

        $this->systemLogger->logException($exception);
        return $message;
    }
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;
    }
1143071
public function asEndpoint()
    {
        $graphVersionPrefix = '';
        if ($this->graphVersion) {
            $graphVersionPrefix = '/'.$this->graphVersion;
        }

        return $graphVersionPrefix.$this->graphNode->asUrl($this->appSecret);
    }
741094
public function process() {
        $this->promise = new Promise(function($r, $c, $n) {
            $this->resolve = $r;
            $this->createRejectFunction($c);
            $this->notify = $n;
            $this->executionCallback(null, true);
        });

        return $this->promise;
    }
85652
protected function mergePrototypesWithConfigurationForPathSegment($configuration, &$currentPrototypeDefinitions)
    {
        $currentPathSegmentType = $configuration['__objectType'];

        if (isset($currentPrototypeDefinitions[$currentPathSegmentType])) {
            $prototypeMergingOrder = [$currentPathSegmentType];
            if (isset($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'])) {
                $prototypeMergingOrder = array_merge($currentPrototypeDefinitions[$currentPathSegmentType]['__prototypeChain'], $prototypeMergingOrder);
            }

            $currentPrototypeWithInheritanceTakenIntoAccount = [];

            foreach ($prototypeMergingOrder as $prototypeName) {
                if (!array_key_exists($prototypeName, $currentPrototypeDefinitions)) {
                    throw new Exception(sprintf(
                        'The Fusion object `%s` which you tried to inherit from does not exist.
									Maybe you have a typo on the right hand side of your inheritance statement for `%s`.',
                        $prototypeName, $currentPathSegmentType), 1427134340);
                }

                $currentPrototypeWithInheritanceTakenIntoAccount = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $currentPrototypeDefinitions[$prototypeName], $this->simpleTypeToArrayClosure);
            }

            // We merge the already flattened prototype with the current configuration (in that order),
            // to make sure that the current configuration (not being defined in the prototype) wins.
            $configuration = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeWithInheritanceTakenIntoAccount, $configuration, $this->simpleTypeToArrayClosure);

            // If context-dependent prototypes are set (such as prototype("foo").prototype("baz")),
            // we update the current prototype definitions.
            if (isset($currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'])) {
                $currentPrototypeDefinitions = Arrays::arrayMergeRecursiveOverruleWithCallback($currentPrototypeDefinitions, $currentPrototypeWithInheritanceTakenIntoAccount['__prototypes'], $this->simpleTypeToArrayClosure);
            }
        }


        return $configuration;
    }
1294330
public function process()
    {
        $operands = $this->getOperands();

        if ($operands->containsNull()) {
            return null;
        }

        if ($operands->exclusivelyMultipleOrOrdered() === false) {
            $msg = "The Contains Expression only accept operands with multiple or ordered cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->sameCardinality() === false) {
            $msg = "The Contains Expression only accept operands with the same cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->sameBaseType() === false) {
            $msg = "The Contains Expression only accept operands with the same baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $operand1 = $operands[0];
        $operand2 = $operands[1];

        if ($operand1->getCardinality() === Cardinality::MULTIPLE) {
            foreach ($operand2 as $value) {
                if ($operand1->contains($value) === false || $operand1->occurences($value) !== $operand2->occurences($value)) {
                    return new QtiBoolean(false);
                }
            }

            return new QtiBoolean(true);
        } else {
            // $operand1->getCardinality() === Cardinality::ORDERED
            $op1Index = 0;
            $op2Index = 0;
            $lastFoundIndex = -1;
            $foundCount = 0;

            while ($op1Index < count($operand1)) {
                $op1Val = $operand1[$op1Index];
                $op2Val = $operand2[$op2Index];

                if ($op2Val === $op1Val || ($op2Val instanceof Comparable && $op2Val->equals($op1Val))) {
                    $op2Index++;

                    if ($lastFoundIndex >= 0 && ($op1Index - $lastFoundIndex) > 1) {
                        // Sequence not respected.
                        return new QtiBoolean(false);
                    } else {
                        $lastFoundIndex = $op1Index;
                        $foundCount++;
                    }
                }

                $op1Index++;
            }

            if ($foundCount > 0 && $foundCount === count($operand2)) {
                return new QtiBoolean(true);
            } else {
                return new QtiBoolean(false);
            }
        }
    }
1190966
public function process()
    {
        $operands = $this->getOperands();
        $expression = $this->getExpression();

        if ($operands->containsNull() === true) {
            return null;
        }

        if ($operands->sameCardinality() === false) {
            $msg = "The Match Expression only accepts operands with the same cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        if ($operands->sameBaseType() === false) {
            $msg = "The Match Expression only accepts operands with the same baseType.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
        }

        $firstOperand = $operands[0];
        $secondOperand = $operands[1];

        if ($operands[0] instanceof Comparable) {
            // 2 containers to compare.
            return new QtiBoolean($operands[0]->equals($operands[1]));
        } else {
            return new QtiBoolean($operands[0] === $operands[1]);
        }
    }
837842
protected function handleDataPreProcessor($source, $targetType, $currentPropertyPath)
    {
        if ($this->serviceFactory->has(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR)) {
            /** @var DataPreProcessorService $dataProcessorService */
            $dataProcessorService = $this->serviceFactory->get(ServiceInterface::SERVICE_DATA_PRE_PROCESSOR);

            $processor = $dataProcessorService->getDataPreProcessor($source, $targetType);
            $source = $processor->getData();
            $processorResult = $processor->getResult();

            if ($processorResult->hasErrors()) {
                $this->messages->forProperty(implode('.', $currentPropertyPath))->merge($processorResult);
            }
        }

        return $source;
    }
525322
public static function popsProxy()
    {
        $originalClass = static::$popsStaticOriginalClass;
        if (null === $originalClass) {
            throw new LogicException(
                'This class should not be called directly.'
            );
        }

        $proxyClassClass = get_called_class();

        if (
            !isset(self::$popsStaticProxies[$proxyClassClass][$originalClass])
        ) {
            self::$popsStaticProxies[$proxyClassClass][$originalClass] =
                new $proxyClassClass($originalClass);
        }

        return self::$popsStaticProxies[$proxyClassClass][$originalClass];
    }
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();
        }
    }
710201
public function render($fusionPath)
    {
        try {
            $output = $this->evaluateInternal($fusionPath, self::BEHAVIOR_EXCEPTION);
            if ($this->debugMode) {
                $output = sprintf('%1$s<!-- Beginning to render TS path "%2$s" (Context: %3$s) -->%4$s%1$s<!-- End to render TS path "%2$s" (Context: %3$s) -->',
                    chr(10),
                    $fusionPath,
                    implode(', ', array_keys($this->getCurrentContext())),
                    $output
                );
            }
        } catch (SecurityException $securityException) {
            throw $securityException;
        } catch (\Exception $exception) {
            $output = $this->handleRenderingException($fusionPath, $exception);
        }

        return $output;
    }
1085610
protected function evaluteExpressionOrValueInternal($fusionPath, $fusionConfiguration, $cacheContext, $contextObject)
    {
        if ($this->evaluateIfCondition($fusionConfiguration, $fusionPath, $contextObject) === false) {
            $this->finalizePathEvaluation($cacheContext);
            $this->lastEvaluationStatus = self::EVALUATION_SKIPPED;

            return null;
        }

        $evaluatedExpression = $this->evaluateEelExpressionOrSimpleValueWithProcessor($fusionPath, $fusionConfiguration, $contextObject);
        $this->finalizePathEvaluation($cacheContext);

        return $evaluatedExpression;
    }
619660
public function process()
    {
        $operands = $this->getOperands();

        if (count($operands) === 0) {
            return null;
        }

        if ($operands->exclusivelySingleOrMultiple() === false) {
            $msg = "The Multiple operator only accepts operands with single or omultiple cardinality.";
            throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_CARDINALITY);
        }

        $refType = null;
        $returnValue = null;

        foreach ($operands as $operand) {

            if (is_null($operand) || ($operand instanceof MultipleContainer && $operand->isNull())) {
                // As per specs, ignore.
                continue;
            } else {
                if ($refType !== null) {
                    // A reference type as already been identified.
                    if (CommonUtils::inferBaseType($operand) === $refType) {
                        // $operand can be added to $returnValue.
                        static::appendValue($returnValue, $operand);
                    } else {
                        // baseType mismatch.
                        $msg = "The Multiple operator only accepts values with a similar baseType.";
                        throw new OperatorProcessingException($msg, $this, OperatorProcessingException::WRONG_BASETYPE);
                    }
                } elseif (($discoveryType = CommonUtils::inferBaseType($operand)) !== false) {
                    // First value being identified as non-null.
                    $refType = $discoveryType;
                    $returnValue = new MultipleContainer($refType);
                    static::appendValue($returnValue, $operand);
                }
            }
        }

        return $returnValue;
    }
551505
public function process()
    {
        parent::process();
        try {
            $this->profile = Teleport::loadProfile($this->profile);

            $this->getMODX($this->profile);

            $this->tpl = $this->loadTpl($this->tpl);

            $this->package = $this->createPackage($this->getName(), $this->getVersion(), $this->getSequence());

            if (isset($this->tpl['attributes'])) {
                foreach ($this->tpl['attributes'] as $attribute => $attributeValue) {
                    if (is_array($attributeValue) && isset($attributeValue['sourceType']) && isset($attributeValue['source'])) {
                        switch ($attributeValue['sourceType']) {
                            case 'fileContent':
                                $attributeValue = file_get_contents($attributeValue['source']);
                                break;
                        }
                    }
                    $this->package->setAttribute($attribute, $attributeValue);
                }
            }

            foreach ($this->tpl['vehicles'] as $vehicle) {
                $this->createVehicles($vehicle);
            }

            if (!$this->package->pack()) {
                throw new ActionException($this, "Error packing {$this->package->signature}.transport.zip");
            }
            $this->request->log("Successfully extracted {$this->package->signature}.transport.zip from instance {$this->profile->code}");
            if ($this->target && $this->push) {
                if (!$this->push($this->package->path . $this->package->signature . '.transport.zip', $this->target . $this->package->signature . '.transport.zip')) {
                    throw new ActionException($this, "Error pushing {$this->package->signature}.transport.zip to {$this->target}");
                }

                if (!$this->preserveWorkspace && $this->modx->getCacheManager()) {
                    $this->modx->cacheManager->deleteTree($this->package->path . $this->package->signature);
                    @unlink($this->package->path . $this->package->signature . '.transport.zip');
                }

                $this->request->log("Successfully pushed {$this->package->signature}.transport.zip to {$this->target}");
                $this->request->log("{$this->target}{$this->package->signature}.transport.zip", false);
            } else {
                $this->request->log("{$this->package->path}{$this->package->signature}.transport.zip", false);
            }
        } catch (\Exception $e) {
            throw new ActionException($this, "Error Extracting snapshot: " . $e->getMessage(), $e);
        }
    }