ClassLoader
class ClassLoader (View source)
Class Loader implementation as fallback to the compoer loader and for test classes.
Constants
MAPPING_TYPE_PSR0 |
|
MAPPING_TYPE_PSR4 |
|
MAPPING_TYPE_CLASSMAP |
|
MAPPING_TYPE_FILES |
|
Properties
protected array | $packageNamespaces | A list of namespaces this class loader is definitely responsible for. |
|
protected bool | $considerTestsNamespace | ||
protected array | $ignoredClassNames | ||
protected array | $fallbackClassPaths | ||
protected array | $nonExistentClasses | Cache classNames that were not found in this class loader in order to save time in resolving those non existent classes. |
Methods
No description
Loads php files containing classes or interfaces found in the classes directory of a package and specifically registered classes.
Tries to load a class from a list of possible paths. This is needed because packages are not prefix-free; i.e.
Sets the available packages
Add a namespace to class path mapping to the class loader for resolving classes.
Adds an entry to the fallback path map. MappingType for this kind of paths is always PSR4 as no package namespace is used then.
Tries to remove a possibly existing namespace to class path map entry.
Try to build a path to a class according to PSR-0 rules.
Try to build a path to a class according to PSR-4 rules.
Sets the flag which enables or disables autoloading support for functional test files.
Is the given mapping type predictable in terms of path to class name
Details
__construct(array $defaultPackageEntries = [])
No description
bool
loadClass(string $className)
Loads php files containing classes or interfaces found in the classes directory of a package and specifically registered classes.
protected bool
loadClassFromPossiblePaths(array $possiblePaths, array $namespaceParts, int $packageNamespacePartCount)
Tries to load a class from a list of possible paths. This is needed because packages are not prefix-free; i.e.
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.
void
setPackages(array $activePackages)
Sets the available packages
protected void
createNamespaceMapEntry(string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0)
Add a namespace to class path mapping to the class loader for resolving classes.
void
createFallbackPathEntry(string $path)
Adds an entry to the fallback path map. MappingType for this kind of paths is always PSR4 as no package namespace is used then.
protected void
removeNamespaceMapEntry(string $namespace, string $classPath, string $mappingType = self::MAPPING_TYPE_PSR0)
Tries to remove a possibly existing namespace to class path map entry.
protected string
buildClassPathWithPsr0(array $classNameParts, string $classPath)
Try to build a path to a class according to PSR-0 rules.
protected string
buildClassPathWithPsr4(array $classNameParts, string $classPath, int $packageNamespacePartCount)
Try to build a path to a class according to PSR-4 rules.
void
setConsiderTestsNamespace(bool $flag)
Sets the flag which enables or disables autoloading support for functional test files.
static bool
isAutoloadTypeWithPredictableClassPath(string $mappingType)
Is the given mapping type predictable in terms of path to class name