Neos\Flow\Security\Authorization\InterceptorResolver::resolveInterceptorClass PHP Method

resolveInterceptorClass() public method

Resolves the class name of a security interceptor. If a valid interceptor class name is given, it is just returned.
public resolveInterceptorClass ( string $name ) : string
$name string The (short) name of the interceptor
return string The class name of the security interceptor, NULL if no class was found.
    public function resolveInterceptorClass($name)
    {
        $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName($name);
        if ($resolvedObjectName !== false) {
            return $resolvedObjectName;
        }
        $resolvedObjectName = $this->objectManager->getCaseSensitiveObjectName('Neos\\Flow\\Security\\Authorization\\Interceptor\\' . $name);
        if ($resolvedObjectName !== false) {
            return $resolvedObjectName;
        }
        throw new NoInterceptorFoundException('A security interceptor with the name: "' . $name . '" could not be resolved.', 1217154134);
    }

Usage Example

コード例 #1
0
 /**
  * @test
  */
 public function resolveInterceptorReturnsTheCorrectInterceptorForACompleteClassName()
 {
     $mockObjectManager = $this->getMockBuilder(ObjectManager::class)->disableOriginalConstructor()->getMock();
     $mockObjectManager->expects($this->any())->method('getCaseSensitiveObjectName')->with('ExistingInterceptorClass')->will($this->returnValue('ExistingInterceptorClass'));
     $interceptorResolver = new Security\Authorization\InterceptorResolver($mockObjectManager);
     $interceptorClass = $interceptorResolver->resolveInterceptorClass('ExistingInterceptorClass');
     $this->assertEquals('ExistingInterceptorClass', $interceptorClass, 'The wrong classname has been resolved');
 }
All Usage Examples Of Neos\Flow\Security\Authorization\InterceptorResolver::resolveInterceptorClass