Composer.Autoload.ClassLoader - JoomlaPubDB/PubDB GitHub Wiki

Class: \Composer\Autoload\ClassLoader

Namespace: \Composer\Autoload


Summary:

ClassLoader implements a PSR-0, PSR-4 and classmap class loader.

Description:

$loader = new \Composer\Autoload\ClassLoader();

// register classes with namespaces
$loader->add('Symfony\Component', __DIR__.'/component');
$loader->add('Symfony',           __DIR__.'/framework');

// activate the autoloader
$loader->register();

// to enable searching the include path (eg. for PEAR packages)
$loader->setUseIncludePath(true);

In this example, if you try to use a class in the Symfony\Component namespace or one of its children (Symfony\Component\Console for instance), the autoloader will first look for the class under the component/ directory, and it will then fallback to the framework/ directory if not found before giving up.

This class is loosely based on the Symfony UniversalClassLoader.


Constants

  • No constants found

Properties


Methods


Details


Tags

Tag Version Description
author Fabien Potencier [email protected]
author Jordi Boggiano [email protected]

Properties

private $prefixLengthsPsr4 :


Type:

Details:

private $prefixDirsPsr4 :


Type:

Details:

private $fallbackDirsPsr4 :


Type:

Details:

private $prefixesPsr0 :


Type:

Details:

private $fallbackDirsPsr0 :


Type:

Details:

private $useIncludePath :


Type:

Details:

private $classMap :


Type:

Details:

private $classMapAuthoritative :


Type:

Details:

private $missingClasses :


Type:

Details:

private $apcuPrefix :


Type:

Details:


Methods

public getPrefixes()

public getPrefixes() 

Details:

public getPrefixesPsr4()

public getPrefixesPsr4() 

Details:

public getFallbackDirs()

public getFallbackDirs() 

Details:

public getFallbackDirsPsr4()

public getFallbackDirsPsr4() 

Details:

public getClassMap()

public getClassMap() 

Details:

public addClassMap()

public addClassMap(array  $classMap) 

Details:

Parameters:
Type Name Description
array $classMap Class to filename map

public add()

public add(string  $prefix, array|string  $paths, boolean  $prepend = false) 

Summary

Registers a set of PSR-0 directories for a given prefix, either appending or prepending to the ones previously set for this prefix.

Details:

Parameters:
Type Name Description
string $prefix The prefix
array|string $paths The PSR-0 root directories
boolean $prepend Whether to prepend the directories

public addPsr4()

public addPsr4(string  $prefix, array|string  $paths, boolean  $prepend = false) 

Summary

Registers a set of PSR-4 directories for a given namespace, either appending or prepending to the ones previously set for this namespace.

Details:

Parameters:
Type Name Description
string $prefix The prefix/namespace, with trailing '\'
array|string $paths The PSR-4 base directories
boolean $prepend Whether to prepend the directories
Throws:
Type Description
\InvalidArgumentException

public set()

public set(string  $prefix, array|string  $paths) 

Summary

Registers a set of PSR-0 directories for a given prefix, replacing any others previously set for this prefix.

Details:

Parameters:
Type Name Description
string $prefix The prefix
array|string $paths The PSR-0 base directories

public setPsr4()

public setPsr4(string  $prefix, array|string  $paths) 

Summary

Registers a set of PSR-4 directories for a given namespace, replacing any others previously set for this namespace.

Details:

Parameters:
Type Name Description
string $prefix The prefix/namespace, with trailing '\'
array|string $paths The PSR-4 base directories
Throws:
Type Description
\InvalidArgumentException

public setUseIncludePath()

public setUseIncludePath(boolean  $useIncludePath) 

Summary

Turns on searching the include path for class files.

Details:

Parameters:
Type Name Description
boolean $useIncludePath

public getUseIncludePath() : boolean

public getUseIncludePath() : boolean

Summary

Can be used to check if the autoloader uses the include path to check for classes.

Details:

Returns: boolean

public setClassMapAuthoritative()

public setClassMapAuthoritative(boolean  $classMapAuthoritative) 

Summary

Turns off searching the prefix and fallback directories for classes that have not been registered with the class map.

Details:

Parameters:
Type Name Description
boolean $classMapAuthoritative

public isClassMapAuthoritative() : boolean

public isClassMapAuthoritative() : boolean

Summary

Should class lookup fail if not found in the current class map?

Details:

Returns: boolean

public setApcuPrefix()

public setApcuPrefix(string|null  $apcuPrefix) 

Summary

APCu prefix to use to cache found/not-found classes, if the extension is enabled.

Details:

Parameters:
Type Name Description
string|null $apcuPrefix

public getApcuPrefix() : string|null

public getApcuPrefix() : string|null

Summary

The APCu prefix in use, or null if APCu caching is not enabled.

Details:

Returns: string|null

public register()

public register(boolean  $prepend = false) 

Summary

Registers this instance as an autoloader.

Details:

Parameters:
Type Name Description
boolean $prepend Whether to prepend the autoloader or not

public unregister()

public unregister() 

Summary

Unregisters this instance as an autoloader.

Details:

public loadClass() : boolean|null

public loadClass(string  $class) : boolean|null

Summary

Loads the given class or interface.

Details:

Parameters:
Type Name Description
string $class The name of the class

Returns: boolean|null - True if loaded, null otherwise

public findFile() : string|false

public findFile(string  $class) : string|false

Summary

Finds the path to the file where the class is defined.

Details:

Parameters:
Type Name Description
string $class The name of the class

Returns: string|false - The path if found, false otherwise

private findFileWithExtension()

private findFileWithExtension(  $class,   $ext) 

Details:

Parameters:
Type Name Description
$class
$ext

Top Namespaces


Reports


This document was automatically generated from source code comments on 2020-07-13 using phpDocumentor and fr3nch13/phpdoc-markdown

⚠️ **GitHub.com Fallback** ⚠️