Neos\Fusion\Core\Runtime::evaluateInternal PHP Method

evaluateInternal() protected method

Internal evaluation method of absolute $typoScriptPath
protected evaluateInternal ( string $typoScriptPath, string $behaviorIfPathNotFound, mixed $contextObject = null ) : mixed
$typoScriptPath string
$behaviorIfPathNotFound string one of BEHAVIOR_EXCEPTION or BEHAVIOR_RETURNNULL
$contextObject mixed the object which will be "this" in Eel expressions, if any
return mixed
    protected function evaluateInternal($typoScriptPath, $behaviorIfPathNotFound, $contextObject = null)
    {
        $needToPopContext = false;
        $this->lastEvaluationStatus = self::EVALUATION_EXECUTED;
        $typoScriptConfiguration = $this->getConfigurationForPath($typoScriptPath);
        $cacheContext = $this->runtimeContentCache->enter(isset($typoScriptConfiguration['__meta']['cache']) ? $typoScriptConfiguration['__meta']['cache'] : [], $typoScriptPath);
        if (!$this->canRenderWithConfiguration($typoScriptConfiguration)) {
            $this->finalizePathEvaluation($cacheContext);
            $this->throwExceptionForUnrenderablePathIfNeeded($typoScriptPath, $typoScriptConfiguration, $behaviorIfPathNotFound);
            $this->lastEvaluationStatus = self::EVALUATION_SKIPPED;
            return null;
        }
        try {
            if ($this->hasExpressionOrValue($typoScriptConfiguration)) {
                return $this->evaluteExpressionOrValueInternal($typoScriptPath, $typoScriptConfiguration, $cacheContext, $contextObject);
            }
            $typoScriptObject = $this->instantiateTypoScriptObject($typoScriptPath, $typoScriptConfiguration);
            $needToPopContext = $this->prepareContextForTypoScriptObject($typoScriptObject, $typoScriptPath, $typoScriptConfiguration, $cacheContext);
            $output = $this->evaluateObjectOrRetrieveFromCache($typoScriptObject, $typoScriptPath, $typoScriptConfiguration, $cacheContext);
        } catch (StopActionException $stopActionException) {
            $this->finalizePathEvaluation($cacheContext, $needToPopContext);
            throw $stopActionException;
        } catch (SecurityException $securityException) {
            $this->finalizePathEvaluation($cacheContext, $needToPopContext);
            throw $securityException;
        } catch (RuntimeException $runtimeException) {
            $this->finalizePathEvaluation($cacheContext, $needToPopContext);
            throw $runtimeException;
        } catch (\Exception $exception) {
            $this->finalizePathEvaluation($cacheContext, $needToPopContext);
            return $this->handleRenderingException($typoScriptPath, $exception, true);
        }
        $this->finalizePathEvaluation($cacheContext, $needToPopContext);
        return $output;
    }