TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Extbase\Reflection\ReflectionService Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Reflection\ReflectionService:
TYPO3\CMS\Core\SingletonInterface

Public Member Functions

 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 injectConfigurationManager (\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 
 setDataCache (\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $dataCache)
 
 initialize ()
 
 isInitialized ()
 
 shutdown ()
 
 getClassTagsValues ($className)
 
 getClassTagValues ($className, $tag)
 
 getClassPropertyNames ($className)
 
 getClassSchema ($classNameOrObject)
 
 hasMethod ($className, $methodName)
 
 getMethodTagsValues ($className, $methodName)
 
 getMethodParameters ($className, $methodName)
 
 getPropertyTagsValues ($className, $propertyName)
 
 getPropertyTagValues ($className, $propertyName, $tag)
 
 isClassReflected ($className)
 
 isClassTaggedWith ($className, $tag)
 
 isPropertyTaggedWith ($className, $propertyName, $tag)
 

Protected Member Functions

 reflectClass ($className)
 
 buildClassSchema ($className)
 
 convertParameterReflectionToArray (ParameterReflection $parameter, $parameterPosition, MethodReflection $method=null)
 
 getMethodReflection ($className, $methodName)
 
 loadFromCache ()
 
 saveToCache ()
 

Protected Attributes

 $objectManager
 
 $initialized = false
 
 $dataCache
 
 $detectClassChanges = false
 
 $reflectedClassNames = []
 
 $taggedClasses = []
 
 $classTagsValues = []
 
 $methodTagsValues = []
 
 $methodParameters = []
 
 $classPropertyNames = []
 
 $classMethodNames = []
 
 $propertyTagsValues = []
 
 $ignoredTags = ['package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const']
 
 $dataCacheNeedsUpdate = false
 
 $classSchemata = []
 
 $configurationManager
 
 $cacheIdentifier
 
 $methodReflections = []
 

Detailed Description

A backport of the TYPO3.Flow reflection service for aquiring reflection based information. Most of the code is based on the TYPO3.Flow reflection service.

Definition at line 26 of file ReflectionService.php.

Member Function Documentation

◆ buildClassSchema()

◆ convertParameterReflectionToArray()

TYPO3\CMS\Extbase\Reflection\ReflectionService::convertParameterReflectionToArray ( ParameterReflection  $parameter,
  $parameterPosition,
MethodReflection  $method = null 
)
protected

◆ getClassPropertyNames()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getClassPropertyNames (   $className)

Returns the names of all properties of the specified class

Parameters
string$classNameName of the class to return the property names of
Returns
array An array of property names or an empty array if none exist

Definition at line 263 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\buildClassSchema().

◆ getClassSchema()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getClassSchema (   $classNameOrObject)

Returns the class schema for the given class

Parameters
mixed$classNameOrObjectThe class name or an object
Returns
ClassSchema

Definition at line 277 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\buildClassSchema().

◆ getClassTagsValues()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getClassTagsValues (   $className)

Returns all tags and their values the specified class is tagged with

Parameters
string$classNameName of the class
Returns
array An array of tags and their values or an empty array if no tags were found

Definition at line 228 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

◆ getClassTagValues()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getClassTagValues (   $className,
  $tag 
)

Returns the values of the specified class tag

Parameters
string$classNameName of the class containing the property
string$tagTag to return the values of
Returns
array An array of values or an empty array if the tag was not found

Definition at line 246 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

◆ getMethodParameters()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getMethodParameters (   $className,
  $methodName 
)

Returns an array of parameters of the given method. Each entry contains additional information about the parameter position, type hint etc.

Parameters
string$classNameName of the class containing the method
string$methodNameName of the method to return parameter information of
Returns
array An array of parameter names and additional information or an empty array of no parameters were found

Definition at line 337 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\convertParameterReflectionToArray(), and TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodReflection().

◆ getMethodReflection()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getMethodReflection (   $className,
  $methodName 
)
protected

Returns the Reflection of a method.

Parameters
string$classNameName of the class containing the method
string$methodNameName of the method to return the Reflection for
Returns
MethodReflection the method Reflection object

Definition at line 573 of file ReflectionService.php.

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodParameters(), TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodTagsValues(), and TYPO3\CMS\Extbase\Reflection\ReflectionService\hasMethod().

◆ getMethodTagsValues()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getMethodTagsValues (   $className,
  $methodName 
)

Returns all tags and their values the specified method is tagged with

Parameters
string$classNameName of the class containing the method
string$methodNameName of the method to return the tags and values of
Returns
array An array of tags and their values or an empty array of no tags were found

Definition at line 315 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodReflection().

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\convertParameterReflectionToArray().

◆ getPropertyTagsValues()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getPropertyTagsValues (   $className,
  $propertyName 
)

Returns all tags and their values the specified class property is tagged with

Parameters
string$classNameName of the class containing the property
string$propertyNameName of the property to return the tags and values of
Returns
array An array of tags and their values or an empty array of no tags were found

Definition at line 356 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

◆ getPropertyTagValues()

TYPO3\CMS\Extbase\Reflection\ReflectionService::getPropertyTagValues (   $className,
  $propertyName,
  $tag 
)

Returns the values of the specified class property tag

Parameters
string$classNameName of the class containing the property
string$propertyNameName of the tagged property
string$tagTag to return the values of
Returns
array An array of values or an empty array if the tag was not found

Definition at line 375 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\buildClassSchema().

◆ hasMethod()

TYPO3\CMS\Extbase\Reflection\ReflectionService::hasMethod (   $className,
  $methodName 
)

Wrapper for method_exists() which tells if the given method exists.

Parameters
string$classNameName of the class containing the method
string$methodNameName of the method
Returns
bool

Definition at line 294 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\getMethodReflection().

◆ initialize()

TYPO3\CMS\Extbase\Reflection\ReflectionService::initialize ( )

Initializes this service

Exceptions
Exception
Returns
void

Definition at line 188 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\loadFromCache().

◆ injectConfigurationManager()

TYPO3\CMS\Extbase\Reflection\ReflectionService::injectConfigurationManager ( \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface  $configurationManager)
Parameters
\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface$configurationManager

Definition at line 164 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\$configurationManager.

◆ injectObjectManager()

TYPO3\CMS\Extbase\Reflection\ReflectionService::injectObjectManager ( \TYPO3\CMS\Extbase\Object\ObjectManagerInterface  $objectManager)
Parameters
\TYPO3\CMS\Extbase\Object\ObjectManagerInterface$objectManager

Definition at line 156 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\$objectManager.

◆ isClassReflected()

TYPO3\CMS\Extbase\Reflection\ReflectionService::isClassReflected (   $className)

Tells if the specified class is known to this reflection service and reflection information is available.

Parameters
string$classNameName of the class
Returns
bool If the class is reflected by this service

Definition at line 393 of file ReflectionService.php.

◆ isClassTaggedWith()

TYPO3\CMS\Extbase\Reflection\ReflectionService::isClassTaggedWith (   $className,
  $tag 
)

Tells if the specified class is tagged with the given tag

Parameters
string$classNameName of the class
string$tagTag to check for
Returns
bool TRUE if the class is tagged with $tag, otherwise FALSE

Definition at line 405 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

◆ isInitialized()

TYPO3\CMS\Extbase\Reflection\ReflectionService::isInitialized ( )

Returns whether the Reflection Service is initialized.

Returns
bool true if the Reflection Service is initialized, otherwise false

Definition at line 204 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\$initialized.

◆ isPropertyTaggedWith()

TYPO3\CMS\Extbase\Reflection\ReflectionService::isPropertyTaggedWith (   $className,
  $propertyName,
  $tag 
)

Tells if the specified class property is tagged with the given tag

Parameters
string$classNameName of the class
string$propertyNameName of the property
string$tagTag to check for
Returns
bool TRUE if the class property is tagged with $tag, otherwise FALSE

Definition at line 427 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\reflectClass().

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\buildClassSchema().

◆ loadFromCache()

TYPO3\CMS\Extbase\Reflection\ReflectionService::loadFromCache ( )
protected

Tries to load the reflection data from this service's cache.

Returns
void

Definition at line 587 of file ReflectionService.php.

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\initialize().

◆ reflectClass()

◆ saveToCache()

TYPO3\CMS\Extbase\Reflection\ReflectionService::saveToCache ( )
protected

Exports the internal reflection data into the ReflectionData cache.

Exceptions
Exception
Returns
void

Definition at line 603 of file ReflectionService.php.

Referenced by TYPO3\CMS\Extbase\Reflection\ReflectionService\shutdown().

◆ setDataCache()

TYPO3\CMS\Extbase\Reflection\ReflectionService::setDataCache ( \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend  $dataCache)

Sets the data cache.

The cache must be set before initializing the Reflection Service.

Parameters
\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend$dataCacheCache for the Reflection service
Returns
void

Definition at line 177 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\$dataCache.

◆ shutdown()

TYPO3\CMS\Extbase\Reflection\ReflectionService::shutdown ( )

Shuts the Reflection Service down.

Returns
void

Definition at line 214 of file ReflectionService.php.

References TYPO3\CMS\Extbase\Reflection\ReflectionService\saveToCache().

Member Data Documentation

◆ $cacheIdentifier

TYPO3\CMS\Extbase\Reflection\ReflectionService::$cacheIdentifier
protected

Definition at line 144 of file ReflectionService.php.

◆ $classMethodNames

TYPO3\CMS\Extbase\Reflection\ReflectionService::$classMethodNames = []
protected

Definition at line 101 of file ReflectionService.php.

◆ $classPropertyNames

TYPO3\CMS\Extbase\Reflection\ReflectionService::$classPropertyNames = []
protected

Definition at line 94 of file ReflectionService.php.

◆ $classSchemata

TYPO3\CMS\Extbase\Reflection\ReflectionService::$classSchemata = []
protected

Definition at line 134 of file ReflectionService.php.

◆ $classTagsValues

TYPO3\CMS\Extbase\Reflection\ReflectionService::$classTagsValues = []
protected

Definition at line 72 of file ReflectionService.php.

◆ $configurationManager

TYPO3\CMS\Extbase\Reflection\ReflectionService::$configurationManager
protected

◆ $dataCache

TYPO3\CMS\Extbase\Reflection\ReflectionService::$dataCache
protected

◆ $dataCacheNeedsUpdate

TYPO3\CMS\Extbase\Reflection\ReflectionService::$dataCacheNeedsUpdate = false
protected

Definition at line 127 of file ReflectionService.php.

◆ $detectClassChanges

TYPO3\CMS\Extbase\Reflection\ReflectionService::$detectClassChanges = false
protected

Definition at line 50 of file ReflectionService.php.

◆ $ignoredTags

TYPO3\CMS\Extbase\Reflection\ReflectionService::$ignoredTags = ['package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const']
protected

Definition at line 115 of file ReflectionService.php.

◆ $initialized

TYPO3\CMS\Extbase\Reflection\ReflectionService::$initialized = false
protected

◆ $methodParameters

TYPO3\CMS\Extbase\Reflection\ReflectionService::$methodParameters = []
protected

Definition at line 87 of file ReflectionService.php.

◆ $methodReflections

TYPO3\CMS\Extbase\Reflection\ReflectionService::$methodReflections = []
protected

Definition at line 151 of file ReflectionService.php.

◆ $methodTagsValues

TYPO3\CMS\Extbase\Reflection\ReflectionService::$methodTagsValues = []
protected

Definition at line 79 of file ReflectionService.php.

◆ $objectManager

TYPO3\CMS\Extbase\Reflection\ReflectionService::$objectManager
protected

◆ $propertyTagsValues

TYPO3\CMS\Extbase\Reflection\ReflectionService::$propertyTagsValues = []
protected

Definition at line 108 of file ReflectionService.php.

◆ $reflectedClassNames

TYPO3\CMS\Extbase\Reflection\ReflectionService::$reflectedClassNames = []
protected

Definition at line 58 of file ReflectionService.php.

◆ $taggedClasses

TYPO3\CMS\Extbase\Reflection\ReflectionService::$taggedClasses = []
protected

Definition at line 65 of file ReflectionService.php.