TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ReflectionService Class Reference
Inheritance diagram for ReflectionService:
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 (   $className)
protected

Builds class schemata from classes annotated as entities or value objects

Parameters
string$className
Exceptions
ExceptionUnknownClassException
Returns
ClassSchema The class schema

Definition at line 488 of file ReflectionService.php.

References ReflectionService\getClassPropertyNames(), ReflectionService\getPropertyTagValues(), ReflectionService\isPropertyTaggedWith(), ClassSchema\MODELTYPE_ENTITY, ClassSchema\MODELTYPE_VALUEOBJECT, and ClassNamingUtility\translateModelNameToRepositoryName().

Referenced by ReflectionService\getClassSchema().

convertParameterReflectionToArray ( ParameterReflection  $parameter,
  $parameterPosition,
MethodReflection  $method = null 
)
protected

Converts the given parameter reflection into an information array

Parameters
ParameterReflection$parameterThe parameter to reflect
int$parameterPosition
MethodReflection | NULL$method
Returns
array Parameter information array

Definition at line 528 of file ReflectionService.php.

References ParameterReflection\getClass(), ReflectionService\getMethodTagsValues(), TypeHandlingUtility\isSimpleType(), and TypeHandlingUtility\parseType().

Referenced by ReflectionService\getMethodParameters(), and ReflectionService\reflectClass().

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 ReflectionService\reflectClass().

Referenced by ReflectionService\buildClassSchema().

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 ReflectionService\buildClassSchema().

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 ReflectionService\reflectClass().

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 ReflectionService\reflectClass().

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 ReflectionService\convertParameterReflectionToArray(), and ReflectionService\getMethodReflection().

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 ReflectionService\getMethodParameters(), ReflectionService\getMethodTagsValues(), and ReflectionService\hasMethod().

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 ReflectionService\getMethodReflection().

Referenced by ReflectionService\convertParameterReflectionToArray().

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 ReflectionService\reflectClass().

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 ReflectionService\reflectClass().

Referenced by ReflectionService\buildClassSchema().

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 ReflectionService\getMethodReflection().

initialize ( )

Initializes this service

Exceptions
Exception
Returns
void

Definition at line 188 of file ReflectionService.php.

References ReflectionService\loadFromCache().

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

Definition at line 164 of file ReflectionService.php.

References ReflectionService\$configurationManager.

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

Definition at line 156 of file ReflectionService.php.

References ReflectionService\$objectManager.

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 (   $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 ReflectionService\reflectClass().

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 ReflectionService\$initialized.

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 ReflectionService\reflectClass().

Referenced by ReflectionService\buildClassSchema().

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 ReflectionService\initialize().

reflectClass (   $className)
protected

Reflects the given class and stores the results in this service's properties.

Parameters
string$classNameFull qualified name of the class to reflect
Returns
void

Definition at line 447 of file ReflectionService.php.

References ReflectionService\convertParameterReflectionToArray().

Referenced by ReflectionService\getClassPropertyNames(), ReflectionService\getClassTagsValues(), ReflectionService\getClassTagValues(), ReflectionService\getPropertyTagsValues(), ReflectionService\getPropertyTagValues(), ReflectionService\isClassTaggedWith(), and ReflectionService\isPropertyTaggedWith().

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 ReflectionService\shutdown().

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 ReflectionService\$dataCache.

shutdown ( )

Shuts the Reflection Service down.

Returns
void

Definition at line 214 of file ReflectionService.php.

References ReflectionService\saveToCache().

Member Data Documentation

$cacheIdentifier
protected

Definition at line 144 of file ReflectionService.php.

$classMethodNames = []
protected

Definition at line 101 of file ReflectionService.php.

$classPropertyNames = []
protected

Definition at line 94 of file ReflectionService.php.

$classSchemata = []
protected

Definition at line 134 of file ReflectionService.php.

$classTagsValues = []
protected

Definition at line 72 of file ReflectionService.php.

$configurationManager
protected

Definition at line 139 of file ReflectionService.php.

Referenced by ReflectionService\injectConfigurationManager().

$dataCache
protected

Definition at line 43 of file ReflectionService.php.

Referenced by ReflectionService\setDataCache().

$dataCacheNeedsUpdate = false
protected

Definition at line 127 of file ReflectionService.php.

$detectClassChanges = false
protected

Definition at line 50 of file ReflectionService.php.

$ignoredTags = ['package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const']
protected

Definition at line 115 of file ReflectionService.php.

$initialized = false
protected

Definition at line 38 of file ReflectionService.php.

Referenced by ReflectionService\isInitialized().

$methodParameters = []
protected

Definition at line 87 of file ReflectionService.php.

$methodReflections = []
protected

Definition at line 151 of file ReflectionService.php.

$methodTagsValues = []
protected

Definition at line 79 of file ReflectionService.php.

$objectManager
protected

Definition at line 31 of file ReflectionService.php.

Referenced by ReflectionService\injectObjectManager().

$propertyTagsValues = []
protected

Definition at line 108 of file ReflectionService.php.

$reflectedClassNames = []
protected

Definition at line 58 of file ReflectionService.php.

$taggedClasses = []
protected

Definition at line 65 of file ReflectionService.php.