/** * Checks if the specified class matches with the class filter pattern * * @param string $className Name of the class to check against * @param string $methodName Name of the method - not used here * @param string $methodDeclaringClassName Name of the class the method was originally declared in - not used here * @param mixed $pointcutQueryIdentifier Some identifier for this query - must at least differ from a previous identifier. Used for circular reference detection. * @return boolean TRUE if the class matches, otherwise FALSE * @author Robert Lemke <*****@*****.**> * @todo Collect information why class was ignored for debugging in a future AOP browser */ public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier) { if ($this->reflectionService->isClassFinal($className) || $this->reflectionService->isMethodFinal($className, '__construct')) { return FALSE; } $matchResult = @preg_match('/^' . $this->classFilterExpression . '$/', $className); if ($matchResult === FALSE) { throw new \F3\FLOW3\AOP\Exception('Error in regular expression "' . $this->classFilterExpression . '" in pointcut class filter', 1168876955); } return $matchResult === 1; }
/** * @test * @author Robert Lemke <*****@*****.**> */ public function isClassFinalTellsIfAClassIsFinal() { $availableClassNames = array('F3\\FLOW3\\Tests\\Reflection\\Fixture\\DummyClass', 'F3\\FLOW3\\Tests\\Reflection\\Fixture\\DummyFinalClass'); $reflectionService = new \F3\FLOW3\Reflection\ReflectionService(); $reflectionService->setStatusCache($this->getMock('F3\\FLOW3\\Cache\\Frontend\\StringFrontend', array(), array(), '', FALSE)); $reflectionService->setDataCache($this->getMock('F3\\FLOW3\\Cache\\Frontend\\VariableFrontend', array(), array(), '', FALSE)); $reflectionService->injectSystemLogger($this->getMock('F3\\FLOW3\\Log\\SystemLoggerInterface')); $reflectionService->initialize($availableClassNames); $this->assertTrue($reflectionService->isClassFinal('F3\\FLOW3\\Tests\\Reflection\\Fixture\\DummyFinalClass')); $this->assertFalse($reflectionService->isClassFinal('F3\\FLOW3\\Tests\\Reflection\\Fixture\\DummyClass')); }