Evaluate an expression with the given JoinPoint

@param string $privilegeIdentifier MD5 hash that identifies a privilege
@param JoinPointInterface $joinPoint
@return mixed
@throws Exception
506043
public function evaluate(string $privilegeIdentifier, JoinPointInterface $joinPoint)
    {
        $functionName = $this->generateExpressionFunctionName($privilegeIdentifier);
        if (isset($this->runtimeExpressions[$functionName])) {
            return $this->runtimeExpressions[$functionName]->__invoke($joinPoint, $this->objectManager);
        }

        $expression = $this->runtimeExpressionsCache->get($functionName);

        if (!$expression) {
            throw new Exception('Runtime expression "' . $functionName . '" does not exist. Flushing the code caches may help to solve this.', 1428694144);
        }

        $this->runtimeExpressions[$functionName] = eval($expression);
        return $this->runtimeExpressions[$functionName]->__invoke($joinPoint, $this->objectManager);
    }
31070
public function parse(AroundJoinPoint $joinPoint)
    {
        $class = get_parent_class($joinPoint->getTarget());
        $injectArgs = AnnotationManager::getMethodAnnotations($class, $joinPoint->getMethod(), InjectArg::class);
        $args = ClassObject::convertArgsToKV($class, $joinPoint->getMethod(), $joinPoint->getArgs());

        foreach($injectArgs as $injectArg)
        {
            $args[$injectArg->name] = $injectArg->value;
        }

        $args = array_values($args);

        return $joinPoint->proceed($args);
    }
829430
protected function visitSirelNodeJoinSource(Node\JoinSource $joinSource)
    {
        $right = $joinSource->getRight();

        return
            "FROM "
            . $this->visit($joinSource->getLeft())
            . ($right ? ' ' . join(' ', $this->visitEach($right)) : null);
    }
392058
public function preventContentElementWraps(JoinPointInterface $joinPoint)
    {
        $content = $joinPoint->getMethodArgument('content');
        if (substr($content, 0, 5) === '<?xml') {
            return $content;
        }

        return $joinPoint->getAdviceChain()->proceed($joinPoint);
    }
900315
public function validateConstruct(JoinPoint $joinPoint)
    {
        $className = BeanFactory::getObjectClass($joinPoint->getTarget());

        $annotations = AnnotationManager::getClassAnnotations($className);
        $propertyAnnotations = AnnotationManager::getPropertiesAnnotations($className);

        foreach($propertyAnnotations as $propertyName => $tAnnotations)
        {
            foreach($tAnnotations as $annotation)
            {
                $annotation = clone $annotation;
                $annotation->name = $propertyName;
                $annotations[] = $annotation;
            }
        }

        if(isset($annotations[0]))
        {
            $data = [];
            foreach($joinPoint->getTarget() as $name => $value)
            {
                $data[$name] = $value;
            }

            $validator = new Validator($data, $annotations);
            if(!$validator->validate())
            {
                $rule = $validator->getFailRule();
                $exception = $rule->exception;
                throw new $exception(sprintf('%s:__construct() Parameter verification is incorrect: %s', $className, $validator->getMessage()), $rule->exCode);
            }
        }
        else
        {
            $data = null;
        }
    }
1147227
protected function renderDecisionReasonMessage($privilegeReasonMessage)
    {
        if (count($this->securityContext->getRoles()) === 0) {
            $rolesMessage = 'No authenticated roles';
        } else {
            $rolesMessage = 'Authenticated roles: ' . implode(', ', array_keys($this->securityContext->getRoles()));
        }

        return sprintf('Access denied for method' . chr(10) . 'Method: %s::%s()' . chr(10) . chr(10) . '%s' . chr(10) . chr(10) . '%s', $this->joinPoint->getClassName(), $this->joinPoint->getMethodName(), $privilegeReasonMessage, $rolesMessage);
    }
189212
function joinServerLan($host, $password = '', $multicall = false)
    {
        if (!is_string($host)) {
            throw new InvalidArgumentException('host = ' . print_r($host, true));
        }
        if (!is_string($password)) {
            throw new InvalidArgumentException('password = ' . print_r($password, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array(array('Server' => $host, 'ServerPassword' => $password)), $multicall);
    }
212627
public function join($type = null, $table = null, array $joinOn = null): Select
    {
        if (!\is_string($type) || !\preg_match('/left|right|inner|full/i', $type)) {
            throw new InvalidArgumentException('$type has to be left|right|inner|full');
        }
        if (!\is_string($table) && !\is_array($table)) {
            throw new InvalidArgumentException('$table has to be an array or a string');
        }
        if (!\is_array($joinOn)) {
            throw new InvalidArgumentException('$on has to be an array');
        }

        $this->join[] = \sprintf(
            ' %s JOIN %s ON %s',
            \strtoupper($type),
            \implode(', ', $this->namesClass->parse($table, true)),
            (new Condition($this->namesClass->getAliases()))->parse($joinOn)
        );

        return $this;
    }
460095
public function setRequestFormatByAcceptHeader(JoinPointInterface $joinPoint) {

		$joinPoint->getAdviceChain()->proceed($joinPoint);
		/** @var \Neos\Flow\Mvc\ActionRequest $actionRequest */
		$actionRequest = $joinPoint->getProxy();
		if ($actionRequest->getFormat() === NULL) {
			foreach (array('Accept', 'Http-Accept') as $acceptFieldNameOptions) {
				if (strpos($actionRequest->getHttpRequest()->getHeader($acceptFieldNameOptions), 'application/json') !== FALSE) {
					$actionRequest->setFormat('json');
				}
			}
		}

	}
47748
public function logStart(JoinPointInterface $joinPoint)
    {
        $session = $joinPoint->getProxy();
        if ($session->isStarted()) {
            $this->logger->info(sprintf('%s: Started session with id %s.', $this->getClassName($joinPoint), $session->getId()), [
                'packageKey' => 'Neos.Flow',
                'className' => $joinPoint->getClassName(),
                'methodName' => $joinPoint->getMethodName()
            ]);
        }
    }
746045
public static String getCallMethod(JoinPoint joinPoint) {
        if (joinPoint != null && joinPoint.getSignature() != null) {
            Class<?> declaringType = joinPoint.getSignature().getDeclaringType();
            String className = (declaringType != null) ? declaringType.getSimpleName() : PRINT_QUESTION;
            String methodName = joinPoint.getSignature().getName();
            return className + PRINT_SEMICOLON + methodName;
        }
        return PRINT_EMPTY_METHOD;
    }
1145074
@AfterThrowing(pointcut = "execution(* org.apache.cassandra.thrift.CassandraServer.doInsert(..))", throwing = "throwable")
    public void logErrorFromThrownException(final JoinPoint joinPoint, final Throwable throwable) {
        final String className = joinPoint.getTarget().getClass().getName();
        final String methodName = joinPoint.getSignature().getName();

        logger.error("Could not write to cassandra! Method: " + className + "."+ methodName + "()", throwable);
    }
622702
public function addCacheHash(JoinPointInterface $joinPoint)
    {
        $result = $joinPoint->getAdviceChain()->proceed($joinPoint);

        $packageKey = $joinPoint->getMethodArgument('packageKey');
        $relativePathAndFilename = $joinPoint->getMethodArgument('relativePathAndFilename');

        return $this->getModifiedResourceUri($result, $relativePathAndFilename, $packageKey);
    }
1169009
public function replacePlaceholdersIfNecessary(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint) {
		$result = $joinPoint->getAdviceChain()->proceed($joinPoint);

		/* @var $typoScriptView TypoScriptView */
		$typoScriptView = $joinPoint->getProxy();
		$viewVariables = ObjectAccess::getProperty($typoScriptView, 'variables', TRUE);
		if (!isset($viewVariables['value']) || !$viewVariables['value']->getNodeType()->isOfType('Sandstorm.Newsletter:Newsletter')) {
			// No newsletter, so logic does not apply
			return $result;
		}

		/* @var $httpRequest Request */
		$httpRequest = $this->controllerContext->getRequest()->getHttpRequest();

		$arguments = $httpRequest->getUri()->getArguments();

		if (!isset($arguments['hmac'])) {
			if ($this->securityContext->isInitialized() && $this->securityContext->hasRole('TYPO3.Neos:Editor')) {
				// Logged into backend, so we don't need to do anything.
				return $result;
			} else {
				// No HMAC sent -- so we return the email INCLUDING placeholders (as per customer's request)
				return $result;
				//return '<h1>Error: HMAC not included in the link.</h1>';
			}
		}

		$actualHmac = $arguments['hmac'];

		$uriWithoutHmac = str_replace('&hmac=' . $actualHmac, '', (string)$httpRequest->getUri());

		$expectedHmac = hash_hmac('sha1', urldecode($uriWithoutHmac), $this->hmacUrlSecret);

		if ($expectedHmac !== $actualHmac) {
			return '<h1>Error: Wrong link clicked.</h1>Please contact your administrator for help';
		}

		$result = preg_replace_callback(ReplacePlaceholdersInLiveImplementation::PLACEHOLDER_REGEX, function($element) use($arguments) {
			return ObjectAccess::getPropertyPath($arguments, $element[1]);
		}, $result);

		return $result;
	}
1030776
protected function getRelationNameFromJoinParams(AbstractNode $joinNode, ReflectionClass $reflectionNodeClass): ?string
    {
        //todo: refactoring
        $relationArgument = $joinNode->getFirstChildOfType('Arguments');
        $stringRelationArgument = $relationArgument->getFirstChildOfType('Literal');

        if ($stringRelationArgument !== null) {
            $relationArgumentName = trim($stringRelationArgument->getName(), '\'');

            if (!ctype_alpha($relationArgumentName)) {
                return null;
            }

            return $relationArgumentName;
        }

        $constRelationArgument = $relationArgument->getFirstChildOfType('ConstantPostfix');

        if ($constRelationArgument !== null) {
            return $reflectionNodeClass->getConstant($constRelationArgument->getName());
        }

        return null;
    }
941546
public function escapeIdentifier($input, bool $join = true)
    {
        if (is_array($input)) {
            $input = array_map([$this, 'escapeIdentifier'], array_filter($input));
            return $join ? join(', ', $input) : $input;
        } elseif ($input instanceof Sql) {
            return $input->toString();
        } elseif ($input instanceof Identifier) {
            $input = $input->toString();
        }

        if (!is_string($input)) {
            throw new AgentException(sprintf('String, array and Query\Sql,Identifier type identifiers'.
                ' accepted only, %s given!', gettype($input)));
        }

        $input = trim($input);
        if ($input == '' || $input == '*') {
            return $input;
        }

        // functions, parentheses etc are not allowed
        if (strpos($input, '(') !== false) {
            throw new AgentException('Found parentheses in input, complex identifiers not allowed!');
        }

        // trim all non-word characters
        $input = preg_replace('~^[^\w]|[^\w]$~', '', $input);
        if ($input == '') {
            return $input;
        }

        // multiple fields
        if (strpos($input, ',')) {
            return $this->escapeIdentifier(Util::split(',', $input), $join);
        }

        // aliases
        if (strpos($input, ' ')) {
            return preg_replace_callback('~([^\s]+)\s+(AS\s+)?(\w+)~i', function ($match) {
                return $this->escapeIdentifier($match[1]) . (
                    ($as = trim($match[2])) ? ' '. strtoupper($as) .' ' : ' '
                ) . $this->escapeIdentifier($match[3]);
            }, $input);
        }

        // dots
        if (strpos($input, '.')) {
            return implode('.', array_map([$this, 'escapeIdentifier'], explode('.', $input)));
        }

        return $this->quoteField($input);
    }
671337
public function publishEventAdvice(JoinPointInterface $joinPoint)
    {
        $event = array_values($joinPoint->getMethodArguments())[0];
        $this->broker->queueEvent($event);
    }