MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe ClassLoader

Membros públicos

 __construct ($ns=null, $includePath=null)
 
 setNamespaceSeparator ($sep)
 
 getNamespaceSeparator ()
 
 setIncludePath ($includePath)
 
 getIncludePath ()
 
 setFileExtension ($fileExtension)
 
 getFileExtension ()
 
 register ()
 
 unregister ()
 
 loadClass ($className)
 
 canLoadClass ($className)
 

Membros públicos estáticos

static classExists ($className)
 
static getClassLoader ($className)
 

Descrição detalhada

A ClassLoader is an autoloader for class files that can be installed on the SPL autoload stack. It is a class loader that either loads only classes of a specific namespace or all namespaces and it is suitable for working together with other autoloaders in the SPL autoload stack.

If no include path is configured through the constructor or setIncludePath, a ClassLoader relies on the PHP include_path.

Autor
Roman Borschel roman.nosp@m.@cod.nosp@m.e-fac.nosp@m.tory.nosp@m..org
Desde
2.0

Definido na linha 34 do ficheiro ClassLoader.php.

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( $ns = null,
$includePath = null )

Creates a new ClassLoader that loads classes of the specified namespace from the specified include path.

If no include path is given, the ClassLoader relies on the PHP include_path. If neither a namespace nor an include path is given, the ClassLoader will be responsible for loading all classes, thereby relying on the PHP include_path.

Parâmetros
string$nsThe namespace of the classes to load.
string$includePathThe base include path to use.

Definido na linha 52 do ficheiro ClassLoader.php.

Documentação das funções

◆ canLoadClass()

canLoadClass ( $className)

Asks this ClassLoader whether it can potentially load the class (file) with the given name.

Parâmetros
string$classNameThe fully-qualified name of the class.
Retorna
boolean TRUE if this ClassLoader can load the class, FALSE otherwise.

Definido na linha 160 do ficheiro ClassLoader.php.

◆ classExists()

static classExists ( $className)
static

Checks whether a class with a given name exists. A class "exists" if it is either already defined in the current request or if there is an autoloader on the SPL autoload stack that is a) responsible for the class in question and b) is able to load a class file in which the class definition resides.

If the class is not already defined, each autoloader in the SPL autoload stack is asked whether it is able to tell if the class exists. If the autoloader is a ClassLoader, canLoadClass is used, otherwise the autoload function of the autoloader is invoked and expected to return a value that evaluates to TRUE if the class (file) exists. As soon as one autoloader reports that the class exists, TRUE is returned.

Note that, depending on what kinds of autoloaders are installed on the SPL autoload stack, the class (file) might already be loaded as a result of checking for its existence. This is not the case with a ClassLoader, who separates these responsibilities.

Parâmetros
string$classNameThe fully-qualified name of the class.
Retorna
boolean TRUE if the class exists as per the definition given above, FALSE otherwise.

Definido na linha 191 do ficheiro ClassLoader.php.

◆ getClassLoader()

static getClassLoader ( $className)
static

Gets the ClassLoader from the SPL autoload stack that is responsible for (and is able to load) the class with the given name.

Parâmetros
string$classNameThe name of the class.
Retorna
The ClassLoader for the class or NULL if no such ClassLoader exists.

Definido na linha 229 do ficheiro ClassLoader.php.

◆ getFileExtension()

getFileExtension ( )

Gets the file extension of class files in the namespace of this ClassLoader.

Retorna
string

Definido na linha 113 do ficheiro ClassLoader.php.

◆ getIncludePath()

getIncludePath ( )

Gets the base include path for all class files in the namespace of this ClassLoader.

Retorna
string

Definido na linha 93 do ficheiro ClassLoader.php.

◆ getNamespaceSeparator()

getNamespaceSeparator ( )

Gets the namespace separator used by classes in the namespace of this ClassLoader.

Retorna
string

Definido na linha 73 do ficheiro ClassLoader.php.

◆ loadClass()

loadClass ( $className)

Loads the given class or interface.

Parâmetros
string$classnameThe name of the class to load.
Retorna
boolean TRUE if the class has been successfully loaded, FALSE otherwise.

Definido na linha 140 do ficheiro ClassLoader.php.

◆ register()

register ( )

Registers this ClassLoader on the SPL autoload stack.

Definido na linha 121 do ficheiro ClassLoader.php.

◆ setFileExtension()

setFileExtension ( $fileExtension)

Sets the file extension of class files in the namespace of this ClassLoader.

Parâmetros
string$fileExtension

Definido na linha 103 do ficheiro ClassLoader.php.

◆ setIncludePath()

setIncludePath ( $includePath)

Sets the base include path for all class files in the namespace of this ClassLoader.

Parâmetros
string$includePath

Definido na linha 83 do ficheiro ClassLoader.php.

◆ setNamespaceSeparator()

setNamespaceSeparator ( $sep)

Sets the namespace separator used by classes in the namespace of this ClassLoader.

Parâmetros
string$sepThe separator to use.

Definido na linha 63 do ficheiro ClassLoader.php.

◆ unregister()

unregister ( )

Removes this ClassLoader from the SPL autoload stack.

Definido na linha 129 do ficheiro ClassLoader.php.


A documentação para esta classe foi gerada a partir do seguinte ficheiro: