当前位置: 首页>>代码示例>>PHP>>正文


PHP Reflection\ReflectionService类代码示例

本文整理汇总了PHP中TYPO3\Flow\Reflection\ReflectionService的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionService类的具体用法?PHP ReflectionService怎么用?PHP ReflectionService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ReflectionService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * 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);
 }
开发者ID:neos,项目名称:extjs,代码行数:47,代码来源:ProviderViewHelper.php

示例2: getTypeOfChildPropertyShouldUseReflectionServiceToDetermineType

 /**
  * @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));
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:11,代码来源:ObjectConverterTest.php

示例3: setUp

 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);
 }
开发者ID:sokunthearith,项目名称:Intern-Project-Week-2,代码行数:9,代码来源:CommandControllerTest.php

示例4: getTypeOfChildPropertyShouldRemoveLeadingBackslashesForAnnotationParameters

 /**
  * @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));
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:13,代码来源:ObjectConverterTest.php

示例5: setUp

 /**
  * 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);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:14,代码来源:NodeFactoryTest.php

示例6: setUp

 /**
  * 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);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:14,代码来源:NodeFactoryTest.php

示例7: getAvailableCommandsReturnsAllAvailableCommands

 /**
  * @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());
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:15,代码来源:CommandManagerTest.php

示例8: reduceTargetClassNames

 /**
  * 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);
 }
开发者ID:mkeitsch,项目名称:flow-development-collection,代码行数:13,代码来源:EmbeddedValueObjectPointcutFilter.php

示例9: initializeObject

 /**
  * 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));
     }
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:12,代码来源:AssetValidator.php

示例10: getOptions

 /**
  */
 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;
 }
开发者ID:mia3,项目名称:expose,代码行数:29,代码来源:RelationOptionsProvider.php

示例11: initializeObject

 /**
  * 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));
     }
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:12,代码来源:AssetValidator.php

示例12: findModelProperties

 /**
  * @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;
 }
开发者ID:putheakhem,项目名称:Radmiraal.Emberjs,代码行数:34,代码来源:ModelFinderUtility.php

示例13: augmentMappingByProperty

 /**
  * @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);
         }
     }
 }
开发者ID:johannessteu,项目名称:Flowpack.ElasticSearch,代码行数:40,代码来源:EntityMappingBuilder.php

示例14: identifyCacheTagForObject

 /**
  * 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;
     }
 }
开发者ID:netlogix,项目名称:Netlogix.Cachetags,代码行数:14,代码来源:DomainObjectIdentificationHelper.php

示例15: initializeObject

 protected function initializeObject()
 {
     /** @var Table $table */
     $table = $this->reflectionService->getClassAnnotation($this->projectionClassName, Table::class);
     if ($table !== NULL) {
         $this->tableName = $table->name;
     }
 }
开发者ID:flow2lab,项目名称:eventsourcing,代码行数:8,代码来源:AbstractMysqlProjector.php


注:本文中的TYPO3\Flow\Reflection\ReflectionService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。