/** * Returns TRUE, if this privilege covers the given subject (join point) * * @param PrivilegeSubjectInterface $subject * @return boolean * @throws InvalidPrivilegeTypeException */ public function matchesSubject(PrivilegeSubjectInterface $subject) { if ($subject instanceof MethodPrivilegeSubject === false) { throw new InvalidPrivilegeTypeException(sprintf('Privileges of type "%s" only support subjects of type "%s", but we got a subject of type: "%s".', MethodPrivilegeInterface::class, MethodPrivilegeSubject::class, get_class($subject)), 1416241148); } $this->initialize(); $joinPoint = $subject->getJoinPoint(); $methodIdentifier = strtolower($joinPoint->getClassName() . '->' . $joinPoint->getMethodName()); if (isset(static::$methodPermissions[$methodIdentifier][$this->getCacheEntryIdentifier()])) { if (static::$methodPermissions[$methodIdentifier][$this->getCacheEntryIdentifier()]['hasRuntimeEvaluations']) { if ($this->runtimeExpressionEvaluator->evaluate($this->getCacheEntryIdentifier(), $joinPoint) === false) { return false; } } return true; } return false; }