Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Class: ClassLoader

Source Location: /system/vendor/composer/ClassLoader.php

Class Overview


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


Author(s):

Methods



Class Details

[line 43]
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\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.




Tags:

author:  Jordi Boggiano <j.boggiano@seld.be>
author:  Fabien Potencier <fabien@symfony.com>
see:  http://www.php-fig.org/psr/psr-4/
see:  http://www.php-fig.org/psr/psr-0/


[ Top ]


Class Methods


method add [line 108]

void add( string $prefix, array|string $paths, [bool $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.



Tags:

access:  public


Parameters:

string   $prefix   The prefix
array|string   $paths   The PSR-0 root directories
bool   $prepend   Whether to prepend the directories

[ Top ]

method addClassMap [line 91]

void addClassMap( $classMap)



Tags:

access:  public


Parameters:

array   $classMap   Class to filename map

[ Top ]

method addPsr4 [line 155]

void addPsr4( string $prefix, array|string $paths, [bool $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.



Tags:

throws:  \InvalidArgumentException
access:  public


Parameters:

string   $prefix   The prefix/namespace, with trailing '\\'
array|string   $paths   The PSR-4 base directories
bool   $prepend   Whether to prepend the directories

[ Top ]

method findFile [line 314]

string|false findFile( string $class)

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



Tags:

return:  The path if found, false otherwise
access:  public


Parameters:

string   $class   The name of the class

[ Top ]

method getClassMap [line 83]

void getClassMap( )



Tags:

access:  public


[ Top ]

method getFallbackDirs [line 73]

void getFallbackDirs( )



Tags:

access:  public


[ Top ]

method getFallbackDirsPsr4 [line 78]

void getFallbackDirsPsr4( )



Tags:

access:  public


[ Top ]

method getPrefixes [line 59]

void getPrefixes( )



Tags:

access:  public


[ Top ]

method getPrefixesPsr4 [line 68]

void getPrefixesPsr4( )



Tags:

access:  public


[ Top ]

method getUseIncludePath [line 248]

bool getUseIncludePath( )

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



Tags:

access:  public


[ Top ]

method isClassMapAuthoritative [line 269]

bool isClassMapAuthoritative( )

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



Tags:

access:  public


[ Top ]

method loadClass [line 298]

bool|null loadClass( string $class)

Loads the given class or interface.



Tags:

return:  True if loaded, null otherwise
access:  public


Parameters:

string   $class   The name of the class

[ Top ]

method register [line 279]

void register( [bool $prepend = false])

Registers this instance as an autoloader.



Tags:

access:  public


Parameters:

bool   $prepend   Whether to prepend the autoloader or not

[ Top ]

method set [line 200]

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

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



Tags:

access:  public


Parameters:

string   $prefix   The prefix
array|string   $paths   The PSR-0 base directories

[ Top ]

method setClassMapAuthoritative [line 259]

void setClassMapAuthoritative( bool $classMapAuthoritative)

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



Tags:

access:  public


Parameters:

bool   $classMapAuthoritative  

[ Top ]

method setPsr4 [line 218]

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

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



Tags:

throws:  \InvalidArgumentException
access:  public


Parameters:

string   $prefix   The prefix/namespace, with trailing '\\'
array|string   $paths   The PSR-4 base directories

[ Top ]

method setUseIncludePath [line 237]

void setUseIncludePath( bool $useIncludePath)

Turns on searching the include path for class files.



Tags:

access:  public


Parameters:

bool   $useIncludePath  

[ Top ]

method unregister [line 287]

void unregister( )

Unregisters this instance as an autoloader.



Tags:

access:  public


[ Top ]


Documentation generated on Sun, 02 Oct 2016 07:46:21 +0000 by phpDocumentor 1.4.3