Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe ClassLoader

Fonctions membres publiques

 __construct ($vendorDir=null)
 
 getPrefixes ()
 
 getPrefixesPsr4 ()
 
 getFallbackDirs ()
 
 getFallbackDirsPsr4 ()
 
 getClassMap ()
 
 addClassMap (array $classMap)
 
 add ($prefix, $paths, $prepend=false)
 
 addPsr4 ($prefix, $paths, $prepend=false)
 
 set ($prefix, $paths)
 
 setPsr4 ($prefix, $paths)
 
 setUseIncludePath ($useIncludePath)
 
 getUseIncludePath ()
 
 setClassMapAuthoritative ($classMapAuthoritative)
 
 isClassMapAuthoritative ()
 
 setApcuPrefix ($apcuPrefix)
 
 getApcuPrefix ()
 
 register ($prepend=false)
 
 unregister ()
 
 loadClass ($class)
 
 findFile ($class)
 

Fonctions membres publiques statiques

static getRegisteredLoaders ()
 

Fonctions membres privées

 findFileWithExtension ($class, $ext)
 

Attributs privés

 $vendorDir
 
 $prefixLengthsPsr4 = array()
 
 $prefixDirsPsr4 = array()
 
 $fallbackDirsPsr4 = array()
 
 $prefixesPsr0 = array()
 
 $fallbackDirsPsr0 = array()
 
 $useIncludePath = false
 
 $classMap = array()
 
 $classMapAuthoritative = false
 
 $missingClasses = array()
 
 $apcuPrefix
 

Attributs privés statiques

static $registeredLoaders = array()
 

Description détaillée

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

$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 namespace or one of its children (Symfony 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.

Auteur
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com
Jordi Boggiano j.bog.nosp@m.gian.nosp@m.o@sel.nosp@m.d.be
Voir également
https://www.php-fig.org/psr/psr-0/
https://www.php-fig.org/psr/psr-4/

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $vendorDir = null)
Paramètres
?string$vendorDir

Références ClassLoader\$vendorDir.

Documentation des fonctions membres

◆ add()

add (   $prefix,
  $paths,
  $prepend = false 
)

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

Paramètres
string$prefixThe prefix
string[]|string$paths The PSR-0 root directories
bool$prependWhether to prepend the directories
Renvoie
void

Références $prefix.

◆ addClassMap()

addClassMap ( array  $classMap)
Paramètres
string[]$classMap Class to filename map -param array<string, string> $classMap
Renvoie
void

Références ClassLoader\$classMap.

◆ addPsr4()

addPsr4 (   $prefix,
  $paths,
  $prepend = false 
)

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

Paramètres
string$prefixThe prefix/namespace, with trailing '\'
string[]|string$paths The PSR-4 base directories
bool$prependWhether to prepend the directories
Exceptions

Références $prefix, et elseif.

◆ findFile()

findFile (   $class)

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

Paramètres
string$classThe name of the class
Renvoie
string|false The path if found, false otherwise

Références $class, $file, ClassLoader\findFileWithExtension(), et null.

Référencé par ClassLoader\loadClass().

◆ findFileWithExtension()

findFileWithExtension (   $class,
  $ext 
)
private
Paramètres
string$class
string$ext
Renvoie
string|false

Références $class, $file, $prefix, et DIRECTORY_SEPARATOR.

Référencé par ClassLoader\findFile().

◆ getApcuPrefix()

getApcuPrefix ( )

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

Renvoie
string|null

Références ClassLoader\$apcuPrefix.

◆ getClassMap()

getClassMap ( )
Renvoie
string[] Array of classname => path -return array<string, string>

Références ClassLoader\$classMap.

◆ getFallbackDirs()

getFallbackDirs ( )
Renvoie
array[] -return array<string, string>

Références ClassLoader\$fallbackDirsPsr0.

◆ getFallbackDirsPsr4()

getFallbackDirsPsr4 ( )
Renvoie
array[] -return array<string, string>

Références ClassLoader\$fallbackDirsPsr4.

◆ getPrefixes()

getPrefixes ( )
Renvoie
string[]

◆ getPrefixesPsr4()

getPrefixesPsr4 ( )
Renvoie
array[] -return array<string, array<int, string>>

Références ClassLoader\$prefixDirsPsr4.

◆ getRegisteredLoaders()

static getRegisteredLoaders ( )
static

Returns the currently registered loaders indexed by their corresponding vendor directories.

Renvoie
self[]

◆ getUseIncludePath()

getUseIncludePath ( )

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

Renvoie
bool

Références ClassLoader\$useIncludePath.

◆ isClassMapAuthoritative()

isClassMapAuthoritative ( )

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

Renvoie
bool

Références ClassLoader\$classMapAuthoritative.

◆ loadClass()

loadClass (   $class)

Loads the given class or interface.

Paramètres
string$classThe name of the class
Renvoie
true|null True if loaded, null otherwise

Références $class, $file, ClassLoader\findFile(), Composer\Autoload\includeFile(), et null.

◆ register()

register (   $prepend = false)

Registers this instance as an autoloader.

Paramètres
bool$prependWhether to prepend the autoloader or not
Renvoie
void

Références ClassLoader\$vendorDir, et null.

◆ set()

set (   $prefix,
  $paths 
)

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

Paramètres
string$prefixThe prefix
string[]|string$paths The PSR-0 base directories
Renvoie
void

Références $prefix.

◆ setApcuPrefix()

setApcuPrefix (   $apcuPrefix)

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

Paramètres
string | null$apcuPrefix
Renvoie
void

Références ClassLoader\$apcuPrefix, et null.

◆ setClassMapAuthoritative()

setClassMapAuthoritative (   $classMapAuthoritative)

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

Paramètres
bool$classMapAuthoritative
Renvoie
void

Références ClassLoader\$classMapAuthoritative.

◆ setPsr4()

setPsr4 (   $prefix,
  $paths 
)

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

Paramètres
string$prefixThe prefix/namespace, with trailing '\'
string[]|string$paths The PSR-4 base directories
Exceptions

Références $prefix.

◆ setUseIncludePath()

setUseIncludePath (   $useIncludePath)

Turns on searching the include path for class files.

Paramètres
bool$useIncludePath
Renvoie
void

Références ClassLoader\$useIncludePath.

◆ unregister()

unregister ( )

Unregisters this instance as an autoloader.

Renvoie
void

Références null.

Documentation des champs

◆ $apcuPrefix

$apcuPrefix
private

◆ $classMap

$classMap = array()
private

◆ $classMapAuthoritative

$classMapAuthoritative = false
private

◆ $fallbackDirsPsr0

$fallbackDirsPsr0 = array()
private

Référencé par ClassLoader\getFallbackDirs().

◆ $fallbackDirsPsr4

$fallbackDirsPsr4 = array()
private

◆ $missingClasses

$missingClasses = array()
private

◆ $prefixDirsPsr4

$prefixDirsPsr4 = array()
private

Référencé par ClassLoader\getPrefixesPsr4().

◆ $prefixesPsr0

$prefixesPsr0 = array()
private

◆ $prefixLengthsPsr4

$prefixLengthsPsr4 = array()
private

◆ $registeredLoaders

$registeredLoaders = array()
staticprivate

◆ $useIncludePath

$useIncludePath = false
private

◆ $vendorDir

$vendorDir
private

La documentation de cette classe a été générée à partir du fichier suivant :