PHP Class Neos\Flow\Core\ClassLoader

Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$availableProxyClasses array
$classesCache Neos\Cache\Frontend\PhpFrontend
$considerTestsNamespace boolean
$fallbackClassPaths array
$ignoredClassNames array
$nonExistentClasses array Usually these will be annotations that have no class.
$packageNamespaces array A list of namespaces this class loader is definitely responsible for.

Méthodes publiques

Méthode Description
__construct ( ApplicationContext $context = null, array $defaultPackageEntries = [] )
createFallbackPathEntry ( string $path ) : void Adds an entry to the fallback path map. MappingType for this kind of paths is always PSR4 as no package namespace is used then.
initializeAvailableProxyClasses ( ApplicationContext $context = null ) : void Initialize available proxy classes from the cached list.
injectClassesCache ( PhpFrontend $classesCache ) : void Injects the cache for storing the renamed original classes
isAutoloadTypeWithPredictableClassPath ( string $mappingType ) : boolean Is the given mapping type predictable in terms of path to class name
loadClass ( string $className ) : boolean Loads php files containing classes or interfaces found in the classes directory of a package and specifically registered classes.
setConsiderTestsNamespace ( boolean $flag ) : void Sets the flag which enables or disables autoloading support for functional test files.
setPackages ( array $activePackages ) : void Sets the available packages

Méthodes protégées

Méthode Description
buildClassPathWithPsr0 ( array $classNameParts, string $classPath ) : string Try to build a path to a class according to PSR-0 rules.
buildClassPathWithPsr4 ( array $classNameParts, string $classPath, integer $packageNamespacePartCount ) : string Try to build a path to a class according to PSR-4 rules.
createNamespaceMapEntry ( string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0 ) : void Add a namespace to class path mapping to the class loader for resolving classes.
loadClassFromPossiblePaths ( array $possiblePaths, array $namespaceParts, integer $packageNamespacePartCount ) : boolean Tries to load a class from a list of possible paths. This is needed because packages are not prefix-free; i.e.
removeNamespaceMapEntry ( string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0 ) : void Tries to remove a possibly existing namespace to class path map entry.

Method Details

__construct() public méthode

public __construct ( ApplicationContext $context = null, array $defaultPackageEntries = [] )
$context ApplicationContext
$defaultPackageEntries array Adds default entries for packages that should be available for very early loading

buildClassPathWithPsr0() protected méthode

Try to build a path to a class according to PSR-0 rules.
protected buildClassPathWithPsr0 ( array $classNameParts, string $classPath ) : string
$classNameParts array Parts of the FQ classname.
$classPath string Already detected class path to a possible package.
Résultat string

buildClassPathWithPsr4() protected méthode

Try to build a path to a class according to PSR-4 rules.
protected buildClassPathWithPsr4 ( array $classNameParts, string $classPath, integer $packageNamespacePartCount ) : string
$classNameParts array Parts of the FQ classname.
$classPath string Already detected class path to a possible package.
$packageNamespacePartCount integer Amount of parts of the className that is also part of the package namespace.
Résultat string

createFallbackPathEntry() public méthode

Adds an entry to the fallback path map. MappingType for this kind of paths is always PSR4 as no package namespace is used then.
public createFallbackPathEntry ( string $path ) : void
$path string The fallback path to search in.
Résultat void

createNamespaceMapEntry() protected méthode

Add a namespace to class path mapping to the class loader for resolving classes.
protected createNamespaceMapEntry ( string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0 ) : void
$namespace string A namespace to map to a class path.
$classPath string The class path to be mapped.
$mappingType string The mapping type for this mapping entry. Currently one of self::MAPPING_TYPE_PSR0 or self::MAPPING_TYPE_PSR4 will work. Defaults to self::MAPPING_TYPE_PSR0
Résultat void

initializeAvailableProxyClasses() public méthode

Initialize available proxy classes from the cached list.
public initializeAvailableProxyClasses ( ApplicationContext $context = null ) : void
$context ApplicationContext
Résultat void

injectClassesCache() public méthode

Injects the cache for storing the renamed original classes
public injectClassesCache ( PhpFrontend $classesCache ) : void
$classesCache Neos\Cache\Frontend\PhpFrontend
Résultat void

isAutoloadTypeWithPredictableClassPath() public static méthode

Is the given mapping type predictable in terms of path to class name
public static isAutoloadTypeWithPredictableClassPath ( string $mappingType ) : boolean
$mappingType string
Résultat boolean

loadClass() public méthode

Loads php files containing classes or interfaces found in the classes directory of a package and specifically registered classes.
public loadClass ( string $className ) : boolean
$className string Name of the class/interface to load
Résultat boolean

loadClassFromPossiblePaths() protected méthode

there may exist a package "Neos" and a package "Neos.NodeTypes" -- so a class Neos\NodeTypes\Foo must be first loaded (if it exists) from Neos.NodeTypes, falling back to Neos afterwards.
protected loadClassFromPossiblePaths ( array $possiblePaths, array $namespaceParts, integer $packageNamespacePartCount ) : boolean
$possiblePaths array
$namespaceParts array
$packageNamespacePartCount integer
Résultat boolean

removeNamespaceMapEntry() protected méthode

Tries to remove a possibly existing namespace to class path map entry.
protected removeNamespaceMapEntry ( string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0 ) : void
$namespace string A namespace mapped to a class path.
$classPath string The class path to be removed.
$mappingType string The mapping type for this mapping entry. Currently one of self::MAPPING_TYPE_PSR0 or self::MAPPING_TYPE_PSR4 will work. Defaults to self::MAPPING_TYPE_PSR0
Résultat void

setConsiderTestsNamespace() public méthode

Sets the flag which enables or disables autoloading support for functional test files.
public setConsiderTestsNamespace ( boolean $flag ) : void
$flag boolean
Résultat void

setPackages() public méthode

Sets the available packages
public setPackages ( array $activePackages ) : void
$activePackages array An array of \Neos\Flow\Package\Package objects
Résultat void

Property Details

$availableProxyClasses protected_oe property

protected array $availableProxyClasses
Résultat array

$classesCache protected_oe property

protected PhpFrontend,Neos\Cache\Frontend $classesCache
Résultat Neos\Cache\Frontend\PhpFrontend

$considerTestsNamespace protected_oe property

protected bool $considerTestsNamespace
Résultat boolean

$fallbackClassPaths protected_oe property

protected array $fallbackClassPaths
Résultat array

$ignoredClassNames protected_oe property

protected array $ignoredClassNames
Résultat array

$nonExistentClasses protected_oe property

Usually these will be annotations that have no class.
protected array $nonExistentClasses
Résultat array

$packageNamespaces protected_oe property

A list of namespaces this class loader is definitely responsible for.
protected array $packageNamespaces
Résultat array