TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 = array()
 
 $taggedClasses = array()
 
 $classTagsValues = array()
 
 $methodTagsValues = array()
 
 $methodParameters = array()
 
 $classPropertyNames = array()
 
 $propertyTagsValues = array()
 
 $ignoredTags = array('package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const')
 
 $dataCacheNeedsUpdate = false
 
 $classSchemata = array()
 
 $configurationManager
 
 $cacheIdentifier
 
 $methodReflections = array()
 

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
Exception\UnknownClassException
Returns
ClassSchema The class schema

Definition at line 479 of file ReflectionService.php.

References elseif, 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 519 of file ReflectionService.php.

References elseif, 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 254 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 268 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 219 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 237 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 328 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 564 of file ReflectionService.php.

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

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 306 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 347 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 366 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 285 of file ReflectionService.php.

initialize ( )

Initializes this service

Exceptions
Exception
Returns
void

Definition at line 179 of file ReflectionService.php.

References ReflectionService\loadFromCache().

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

Definition at line 155 of file ReflectionService.php.

References ReflectionService\$configurationManager.

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

Definition at line 147 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 384 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 396 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 195 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 418 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 578 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 438 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 594 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 168 of file ReflectionService.php.

References ReflectionService\$dataCache.

shutdown ( )

Shuts the Reflection Service down.

Returns
void

Definition at line 205 of file ReflectionService.php.

References ReflectionService\saveToCache().

Member Data Documentation

$cacheIdentifier
protected

Definition at line 137 of file ReflectionService.php.

$classPropertyNames = array()
protected

Definition at line 94 of file ReflectionService.php.

$classSchemata = array()
protected

Definition at line 127 of file ReflectionService.php.

$classTagsValues = array()
protected

Definition at line 72 of file ReflectionService.php.

$configurationManager
protected

Definition at line 132 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 120 of file ReflectionService.php.

$detectClassChanges = false
protected

Definition at line 50 of file ReflectionService.php.

$ignoredTags = array('package', 'subpackage', 'license', 'copyright', 'author', 'version', 'const')
protected

Definition at line 108 of file ReflectionService.php.

$initialized = false
protected

Definition at line 38 of file ReflectionService.php.

Referenced by ReflectionService\isInitialized().

$methodParameters = array()
protected

Definition at line 87 of file ReflectionService.php.

$methodReflections = array()
protected

Definition at line 142 of file ReflectionService.php.

$methodTagsValues = array()
protected

Definition at line 79 of file ReflectionService.php.

$objectManager
protected

Definition at line 31 of file ReflectionService.php.

Referenced by ReflectionService\injectObjectManager().

$propertyTagsValues = array()
protected

Definition at line 101 of file ReflectionService.php.

$reflectedClassNames = array()
protected

Definition at line 58 of file ReflectionService.php.

$taggedClasses = array()
protected

Definition at line 65 of file ReflectionService.php.