/** * This method is used to optimize the matching process. * * @param \TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex * @return \TYPO3\Flow\Aop\Builder\ClassNameIndex */ public function reduceTargetClassNames(\TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex) { $classNames = $this->reflectionService->getClassNamesByAnnotation(Flow\ValueObject::class); $annotatedIndex = new \TYPO3\Flow\Aop\Builder\ClassNameIndex(); $annotatedIndex->setClassNames($classNames); return $classNameIndex->intersect($annotatedIndex); }
/** * Returns the JavaScript to declare the Ext Direct provider for all * controller actions that are annotated with "@TYPO3\ExtJS\Annotations\ExtDirect" * * = Examples = * * <code title="Simple"> * {namespace ext=TYPO3\ExtJS\ViewHelpers} * ... * <script type="text/javascript"> * <ext:extdirect.provider /> * </script> * ... * </code> * * TODO Cache ext direct provider config * @param string $namespace The base ExtJS namespace (with dots) for the direct provider methods * @return string JavaScript needed to include Ext Direct provider * @api */ public function render($namespace = NULL) { $providerConfig = array('url' => '?TYPO3_ExtJS_ExtDirectRequest=1&__csrfToken=' . $this->securityContext->getCsrfProtectionToken(), 'type' => 'remoting', 'actions' => array()); if (!empty($namespace)) { $providerConfig['namespace'] = $namespace; } $controllerClassNames = $this->localReflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Flow\\Mvc\\Controller\\ControllerInterface'); foreach ($controllerClassNames as $controllerClassName) { $methodNames = get_class_methods($controllerClassName); foreach ($methodNames as $methodName) { $methodTagsValues = $this->localReflectionService->getMethodTagsValues($controllerClassName, $methodName); if (isset($methodTagsValues['extdirect'])) { $methodParameters = $this->localReflectionService->getMethodParameters($controllerClassName, $methodName); $requiredMethodParametersCount = 0; foreach ($methodParameters as $methodParameter) { if ($methodParameter['optional'] === TRUE) { break; } $requiredMethodParametersCount++; } $extDirectAction = str_replace('\\', '_', $controllerClassName); $providerConfig['actions'][$extDirectAction][] = array('name' => substr($methodName, 0, -6), 'len' => $requiredMethodParametersCount); } } } return 'Ext.Direct.addProvider(' . json_encode($providerConfig) . ');' . chr(10); }
/** * Adds all validators that extend the AssetValidatorInterface. * * @return void */ protected function initializeObject() { $assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Media\\Domain\\Validator\\AssetValidatorInterface'); foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) { $this->addValidator($this->objectManager->get($assetValidatorImplementationClassName)); } }
/** */ public function getOptions() { $classSchema = $this->reflectionService->getClassSchema($this->getRelationClass()); if ($classSchema->getRepositoryClassName() !== NULL) { $repository = $this->objectManager->get($classSchema->getRepositoryClassName()); $query = call_user_func(array($repository, $this->settings['QueryMethod'])); } else { $query = $this->persistenceManager->createQueryForType($this->getRelationClass()); } $options = $query->execute()->toArray(); if ($this->settings['LabelPath'] !== NULL) { $options = array(); foreach ($query->execute() as $option) { $identifier = $this->persistenceManager->getIdentifierByObject($option); $label = ObjectAccess::getPropertyPath($option, $this->settings['LabelPath']); $options[$identifier] = $label; } } if ($this->settings['EmptyOption'] !== NULL) { $newOptions = array('' => $this->settings['EmptyOption']); foreach ($options as $key => $value) { $newOptions[$key] = $value; } $options = $newOptions; } return $options; }
/** * Adds all validators that extend the AssetValidatorInterface. * * @return void */ protected function initializeObject() { $assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class); foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) { $this->addValidator($this->objectManager->get($assetValidatorImplementationClassName)); } }
/** * @param string $className * @return array */ public function findModelProperties($className) { $modelDefinition = array(); foreach ($this->reflectionService->getClassPropertyNames($className) as $propertyName) { if (is_array($this->ignoredProperties) && in_array($propertyName, $this->ignoredProperties)) { continue; } $propertyType = $this->reflectionService->getPropertyTagValues($className, $propertyName, 'var'); $type = \TYPO3\Flow\Utility\TypeHandling::parseType($propertyType[0]); // if (class_exists($type['type']) && !isset($classNames[$type['type']])) { // $this->readClass($type['type'], $classNames); // } // if (class_exists($type['elementType']) && !isset($classNames[$type['elementType']])) { // if ($this->reflectionService->isClassAbstract($type['elementType'])) { // $implementations = $this->reflectionService->getAllSubClassNamesForClass($type['elementType']); // foreach ($implementations as $implementationClassName) { // if (isset($classNames[$implementationClassName])) { // continue; // } // $this->readClass($implementationClassName, $classNames); // } // } else { // $this->readClass($type['elementType'], $classNames); // } // } // TODO: Add lookup for relations and add them to the modelImplementations $modelDefinition[$propertyName] = array('type' => \TYPO3\Flow\Utility\TypeHandling::isCollectionType($type['type']) ? $type['elementType'] : $type['type']); } return $modelDefinition; }
/** * @param Mapping $mapping * @param string $className * @param string $propertyName * * @throws \Flowpack\ElasticSearch\Exception * @return void */ protected function augmentMappingByProperty(Mapping $mapping, $className, $propertyName) { list($propertyType) = $this->reflectionService->getPropertyTagValues($className, $propertyName, 'var'); if (($transformAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, 'Flowpack\\ElasticSearch\\Annotations\\Transform')) !== NULL) { $mappingType = $this->transformerFactory->create($transformAnnotation->type)->getTargetMappingType(); } elseif (\TYPO3\Flow\Utility\TypeHandling::isSimpleType($propertyType)) { $mappingType = $propertyType; } elseif ($propertyType === '\\DateTime') { $mappingType = 'date'; } else { throw new \Flowpack\ElasticSearch\Exception('Mapping is only supported for simple types and DateTime objects; "' . $propertyType . '" given but without a Transform directive.'); } $mapping->setPropertyByPath($propertyName, array('type' => $mappingType)); $annotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, 'Flowpack\\ElasticSearch\\Annotations\\Mapping'); if ($annotation instanceof MappingAnnotation) { $mapping->setPropertyByPath($propertyName, $this->processMappingAnnotation($annotation, $mapping->getPropertyByPath($propertyName))); if ($annotation->getFields()) { foreach ($annotation->getFields() as $multiFieldAnnotation) { $multiFieldIndexName = trim($multiFieldAnnotation->index_name); if ($multiFieldIndexName === '') { throw new \Flowpack\ElasticSearch\Exception('Multi field require an unique index name "' . $className . '::' . $propertyName . '".'); } if (isset($multiFields[$multiFieldIndexName])) { throw new \Flowpack\ElasticSearch\Exception('Duplicate index name in the same multi field is not allowed "' . $className . '::' . $propertyName . '".'); } $multiFieldAnnotation->type = $mappingType; $multiFields[$multiFieldIndexName] = $this->processMappingAnnotation($multiFieldAnnotation); } $mapping->setPropertyByPath(array($propertyName, 'fields'), $multiFields); } } }
/** * Returns cache cache tag parts for the given object if known, otherwise NULL. * * @param $object * @return mixed */ public function identifyCacheTagForObject($object) { $className = get_class($object); if (property_exists($object, 'Persistence_Object_Identifier') || $this->reflectionService->isClassAnnotatedWith($className, Flow\Entity::class) || $this->reflectionService->isClassAnnotatedWith($className, Flow\ValueObject::class) || $this->reflectionService->isClassAnnotatedWith($className, Doctrine\Entity::class)) { $identifier = $this->persistenceManager->getIdentifierByObject($object); return $className . '_' . $identifier; } }
/** * @test */ public function getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType() { $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(FALSE)); $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue(array('thePropertyName' => array('type' => 'TheTypeOfSubObject', 'elementType' => NULL)))); $configuration = new \TYPO3\Flow\Property\PropertyMappingConfiguration(); $configuration->setTypeConverterOptions(\TYPO3\Flow\Property\TypeConverter\ObjectConverter::class, array()); $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration)); }
protected function initializeObject() { /** @var Table $table */ $table = $this->reflectionService->getClassAnnotation($this->projectionClassName, Table::class); if ($table !== NULL) { $this->tableName = $table->name; } }
/** * get indexed arguments for method * * @param string $class * @param string $method * @return array */ protected function getArguments($class, $method) { $arguments = array(); $parameters = $this->reflectionService->getMethodParameters($class, $method); foreach ($parameters as $name => $parameter) { $arguments[$parameter['position']] = $this->request->hasArgument($name) ? $this->request->getArgument($name) : null; } return $arguments; }
public function setUp() { $this->commandController = $this->getAccessibleMock('TYPO3\\Flow\\Cli\\CommandController', array('resolveCommandMethodName', 'callCommandMethod')); $this->mockReflectionService = $this->getMockBuilder('TYPO3\\Flow\\Reflection\\ReflectionService')->disableOriginalConstructor()->getMock(); $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->will($this->returnValue(array())); $this->inject($this->commandController, 'reflectionService', $this->mockReflectionService); $this->mockConsoleOutput = $this->getMockBuilder('TYPO3\\Flow\\Cli\\ConsoleOutput')->disableOriginalConstructor()->getMock(); $this->inject($this->commandController, 'output', $this->mockConsoleOutput); }
/** * @test */ public function getTypeOfChildPropertyShouldRemoveLeadingBackslashesForAnnotationParameters() { $this->mockReflectionService->expects($this->any())->method('getMethodParameters')->with('TheTargetType', '__construct')->will($this->returnValue(array())); $this->mockReflectionService->expects($this->any())->method('hasMethod')->with('TheTargetType', 'setThePropertyName')->will($this->returnValue(false)); $this->mockReflectionService->expects($this->any())->method('getClassPropertyNames')->with('TheTargetType')->will($this->returnValue(array('thePropertyName'))); $this->mockReflectionService->expects($this->any())->method('getPropertyTagValues')->with('TheTargetType', 'thePropertyName')->will($this->returnValue(array('\\TheTypeOfSubObject'))); $configuration = new \TYPO3\Flow\Property\PropertyMappingConfiguration(); $configuration->setTypeConverterOptions(\TYPO3\Flow\Property\TypeConverter\ObjectConverter::class, array()); $this->assertEquals('TheTypeOfSubObject', $this->converter->getTypeOfChildProperty('TheTargetType', 'thePropertyName', $configuration)); }
public function objectToScalar($object, $path = NULL) { $className = $this->reflectionService->getClassNameByObject($object); $methods = $this->getGetterMethodsForClass($className); $result = []; foreach ($methods as $key => $methodName) { $result[$key] = $object->{$methodName}(); } return $result; }
/** * @return void */ protected function callCommandMethod() { parent::callCommandMethod(); if ($this->reflectionService->isMethodAnnotatedWith(__CLASS__, $this->commandMethodName, 'SimplyAdmire\\Facets\\Annotations\\AutoCreateChildnodes')) { $this->verbose = FALSE; $this->autoCreateChildNodesCommand(); $this->verbose = TRUE; $this->outputLine('Automatically created childnodes if missing'); } }
/** * @return array * @throws UnknownObjectException */ protected function getExtractorAdapters() { $extractorAdapterClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(ExtractorInterface::class); $extractorAdapters = []; /** @var ExtractorInterface $className */ foreach ($extractorAdapterClassNames as $className) { $extractorAdapters[$className] = $className::getCompatibleMediaTypes(); } return $extractorAdapters; }
/** * Prepare test objects */ protected function setUp() { $this->nodeFactory = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Factory\\NodeFactory', array('filterNodeByContext')); $this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0); $this->reflectionServiceMock = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService'); $this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn(array('TYPO3\\TYPO3CR\\Domain\\Model\\Node')); $this->objectManagerMock = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface'); $this->objectManagerMock->expects(self::any())->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->willReturn($this->reflectionServiceMock); $this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn('TYPO3\\TYPO3CR\\Domain\\Model\\Node'); $this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock); }
/** * @param JoinPointInterface $joinPoint The current join point * @return mixed * @Flow\Around("methodAnnotatedWith(TYPO3\Jobqueue\Common\Annotations\Defer)") */ public function queueMethodCallAsJob(JoinPointInterface $joinPoint) { if ($this->processingJob) { return $joinPoint->getAdviceChain()->proceed($joinPoint); } $deferAnnotation = $this->reflectionService->getMethodAnnotation($joinPoint->getClassName(), $joinPoint->getMethodName(), 'TYPO3\\Jobqueue\\Common\\Annotations\\Defer'); $queueName = $deferAnnotation->queueName; $job = new StaticMethodCallJob($joinPoint->getClassName(), $joinPoint->getMethodName(), $joinPoint->getMethodArguments()); $this->jobManager->queue($queueName, $job); return NULL; }
/** * Prepare test objects */ protected function setUp() { $this->nodeFactory = $this->getMockBuilder(NodeFactory::class)->setMethods(array('filterNodeByContext'))->getMock(); $this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0); $this->reflectionServiceMock = $this->createMock(ReflectionService::class); $this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with(NodeInterface::class)->willReturn(array(Node::class)); $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class); $this->objectManagerMock->expects(self::any())->method('get')->with(ReflectionService::class)->willReturn($this->reflectionServiceMock); $this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with(NodeInterface::class)->willReturn(Node::class); $this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock); }
/** * @test */ public function getAvailableCommandsReturnsAllAvailableCommands() { $commandManager = new CommandManager(); $commandManager->injectReflectionService($this->mockReflectionService); $mockCommandControllerClassNames = array(\TYPO3\Flow\Tests\Unit\Cli\Fixtures\Command\MockACommandController::class, \TYPO3\Flow\Tests\Unit\Cli\Fixtures\Command\MockBCommandController::class); $this->mockReflectionService->expects($this->once())->method('getAllSubClassNamesForClass')->with(\TYPO3\Flow\Cli\CommandController::class)->will($this->returnValue($mockCommandControllerClassNames)); $commands = $commandManager->getAvailableCommands(); $this->assertEquals(3, count($commands)); $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mocka:foo', $commands[0]->getCommandIdentifier()); $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mocka:bar', $commands[1]->getCommandIdentifier()); $this->assertEquals('typo3.flow.tests.unit.cli.fixtures:mockb:baz', $commands[2]->getCommandIdentifier()); }
/** * Sets up this test case */ public function setUp() { $this->identityRoutePart = $this->getAccessibleMock(\TYPO3\Flow\Mvc\Routing\IdentityRoutePart::class, array('createPathSegmentForObject')); $this->mockPersistenceManager = $this->getMock(\TYPO3\Flow\Persistence\PersistenceManagerInterface::class); $this->identityRoutePart->_set('persistenceManager', $this->mockPersistenceManager); $this->mockReflectionService = $this->getMock(\TYPO3\Flow\Reflection\ReflectionService::class); $this->mockClassSchema = $this->getMock(\TYPO3\Flow\Reflection\ClassSchema::class, array(), array(), '', false); $this->mockReflectionService->expects($this->any())->method('getClassSchema')->will($this->returnValue($this->mockClassSchema)); $this->identityRoutePart->_set('reflectionService', $this->mockReflectionService); $this->mockObjectPathMappingRepository = $this->getMock(\TYPO3\Flow\Mvc\Routing\ObjectPathMappingRepository::class); $this->identityRoutePart->_set('objectPathMappingRepository', $this->mockObjectPathMappingRepository); }
/** * @return Cli\Command[] */ protected function getDomainCommands() { $cliCommands = []; $domainCommandClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(Domain\CommandInterface::class); foreach ($domainCommandClassNames as $domainCommandClassName) { if ($this->reflectionService->isClassAbstract($domainCommandClassName) === TRUE) { continue; } $cliCommands[] = $this->buildDomainCommand($domainCommandClassName); } return $cliCommands; }
/** * Synchronize designs from Flow declarations to CouchDB documents * * @return void * @author Christopher Hlubek <*****@*****.**> */ public function synchronizeCommand() { $designDocumentClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\CouchDB\\DesignDocument'); foreach ($designDocumentClassNames as $objectName) { if ($this->objectManager->getScope($objectName) === \TYPO3\Flow\Object\Configuration\Configuration::SCOPE_SINGLETON) { $designDocument = $this->objectManager->get($objectName); $designDocument->synchronize(); $this->outputLine($objectName . ' synchronized.'); } else { $this->outputLine($objectName . ' skipped.'); } } }
/** * @return array */ protected function parseDescription() { $description = 'This class contains the following signals.' . chr(10) . chr(10); $methodReflections = $this->classReflection->getMethods(); foreach ($methodReflections as $methodReflection) { /** @var \TYPO3\Flow\Reflection\MethodReflection $methodReflection */ if ($this->reflectionService->isMethodAnnotatedWith($this->className, $methodReflection->getName(), \TYPO3\Flow\Annotations\Signal::class)) { $signalName = lcfirst(preg_replace('/^emit/', '', $methodReflection->getName())); $description .= $signalName; $description .= chr(10) . str_repeat('^', strlen($signalName)); $description .= chr(10) . chr(10) . $methodReflection->getDescription() . chr(10) . chr(10); } } return $description; }
/** * @param string $entityClassName * @param string $propertyName * @return array */ protected function getPropertyValidationSettings($entityClassName, $propertyName) { $options = array('required' => FALSE); $validationAnnotations = $this->reflectionService->getPropertyAnnotations($entityClassName, $propertyName, 'TYPO3\\Flow\\Annotations\\Validate'); foreach ($validationAnnotations as $validationAnnotation) { if ($validationAnnotation->type === 'NotEmpty') { $options['required'] = TRUE; } if ($validationAnnotation->type === 'StringLength') { $options['minimum'] = isset($validationAnnotation->options['minimum']) ? intval($validationAnnotation->options['minimum']) : 0; $options['maximum'] = isset($validationAnnotation->options['maximum']) ? intval($validationAnnotation->options['maximum']) : 0; } } return $options; }
/** * Get all class names inside this namespace and return them as array. * * @param string $namespace * @return array Array of all class names inside a given namespace. */ protected function getClassNamesInNamespace($namespace) { $affectedViewHelperClassNames = array(); $allViewHelperClassNames = $this->reflectionService->getAllSubClassNamesForClass('TYPO3\\Fluid\\Core\\ViewHelper\\AbstractViewHelper'); foreach ($allViewHelperClassNames as $viewHelperClassName) { if ($this->reflectionService->isClassAbstract($viewHelperClassName)) { continue; } if (strncmp($namespace, $viewHelperClassName, strlen($namespace)) === 0) { $affectedViewHelperClassNames[] = $viewHelperClassName; } } sort($affectedViewHelperClassNames); return $affectedViewHelperClassNames; }
/** * This method is used to optimize the matching process. * * @param \TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex * @return \TYPO3\Flow\Aop\Builder\ClassNameIndex */ public function reduceTargetClassNames(\TYPO3\Flow\Aop\Builder\ClassNameIndex $classNameIndex) { $classNames = $this->reflectionService->getClassesContainingMethodsAnnotatedWith($this->annotation); $annotatedIndex = new \TYPO3\Flow\Aop\Builder\ClassNameIndex(); $annotatedIndex->setClassNames($classNames); return $classNameIndex->intersect($annotatedIndex); }
/** * Checks if the specified method matches against the method name * expression. * * Returns TRUE if method name, visibility and arguments constraints match and the target * method is not final. * * @param string $className Ignored in this pointcut filter * @param string $methodName Name of the method to match against * @param string $methodDeclaringClassName Name of the class the method was originally declared in * @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 * @throws \TYPO3\Flow\Aop\Exception */ public function matches($className, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier) { $matchResult = preg_match('/^' . $this->methodNameFilterExpression . '$/', $methodName); if ($matchResult === false) { throw new \TYPO3\Flow\Aop\Exception('Error in regular expression', 1168876915); } elseif ($matchResult !== 1) { return false; } switch ($this->methodVisibility) { case 'public': if (!($methodDeclaringClassName !== null && $this->reflectionService->isMethodPublic($methodDeclaringClassName, $methodName))) { return false; } break; case 'protected': if (!($methodDeclaringClassName !== null && $this->reflectionService->isMethodProtected($methodDeclaringClassName, $methodName))) { return false; } break; } if ($methodDeclaringClassName !== null && $this->reflectionService->isMethodFinal($methodDeclaringClassName, $methodName)) { return false; } $methodArguments = $methodDeclaringClassName === null ? array() : $this->reflectionService->getMethodParameters($methodDeclaringClassName, $methodName); foreach (array_keys($this->methodArgumentConstraints) as $argumentName) { $objectAccess = explode('.', $argumentName, 2); $argumentName = $objectAccess[0]; if (!array_key_exists($argumentName, $methodArguments)) { $this->systemLogger->log('The argument "' . $argumentName . '" declared in pointcut does not exist in method ' . $methodDeclaringClassName . '->' . $methodName, LOG_NOTICE); return false; } } return true; }
/** * Traverses all aspect containers, their aspects and their advisors and adds the * methods and their advices to the (usually empty) array of intercepted methods. * * @param array &$interceptedMethods An array (empty or not) which contains the names of the intercepted methods and additional information * @param array $methods An array of class and method names which are matched against the pointcut (class name = name of the class or interface the method was declared) * @param string $targetClassName Name of the class the pointcut should match with * @param array &$aspectContainers All aspects to take into consideration * @return void */ protected function addAdvicedMethodsToInterceptedMethods(array &$interceptedMethods, array $methods, $targetClassName, array &$aspectContainers) { $pointcutQueryIdentifier = 0; foreach ($aspectContainers as $aspectContainer) { if (!$aspectContainer->getCachedTargetClassNameCandidates()->hasClassName($targetClassName)) { continue; } foreach ($aspectContainer->getAdvisors() as $advisor) { $pointcut = $advisor->getPointcut(); foreach ($methods as $method) { list($methodDeclaringClassName, $methodName) = $method; if ($this->reflectionService->isMethodFinal($targetClassName, $methodName)) { continue; } if ($this->reflectionService->isMethodStatic($targetClassName, $methodName)) { continue; } if ($pointcut->matches($targetClassName, $methodName, $methodDeclaringClassName, $pointcutQueryIdentifier)) { $advice = $advisor->getAdvice(); $interceptedMethods[$methodName]['groupedAdvices'][get_class($advice)][] = array('advice' => $advice, 'runtimeEvaluationsClosureCode' => $pointcut->getRuntimeEvaluationsClosureCode()); $interceptedMethods[$methodName]['declaringClassName'] = $methodDeclaringClassName; } $pointcutQueryIdentifier++; } } } }
/** * Returns a proxy class object for the specified original class. * * If no such proxy class has been created yet by this renderer, * this function will create one and register it for later use. * * If the class is not proxable, FALSE will be returned * * @param string $fullClassName Name of the original class * @return \TYPO3\Flow\Object\Proxy\ProxyClass|boolean */ public function getProxyClass($fullClassName) { if (interface_exists($fullClassName) || in_array('TYPO3\\Flow\\Tests\\BaseTestCase', class_parents($fullClassName))) { return FALSE; } if (class_exists($fullClassName) === FALSE) { return FALSE; } $classReflection = new \ReflectionClass($fullClassName); if ($classReflection->isInternal() === TRUE) { return FALSE; } $proxyAnnotation = $this->reflectionService->getClassAnnotation($fullClassName, 'TYPO3\\Flow\\Annotations\\Proxy'); if ($proxyAnnotation !== NULL && $proxyAnnotation->enabled === FALSE) { return FALSE; } if (in_array(substr($fullClassName, 0, 14), $this->blacklistedSubPackages)) { return FALSE; } if (!isset($this->proxyClasses[$fullClassName])) { $this->proxyClasses[$fullClassName] = new ProxyClass($fullClassName); $this->proxyClasses[$fullClassName]->injectReflectionService($this->reflectionService); } return $this->proxyClasses[$fullClassName]; }