PHP Class Symfony\Component\ClassLoader\ApcClassLoader

It expects an object implementing a findFile method to find the file. This allow using it as a wrapper around the other loaders of the component (the ClassLoader and the UniversalClassLoader for instance) but also around any other autoloader following this convention (the Composer one for instance) $loader = new ClassLoader(); register classes with namespaces $loader->add('Symfony\Component', __DIR__.'/component'); $loader->add('Symfony', __DIR__.'/framework'); $cachedLoader = new ApcClassLoader('my_prefix', $loader); activate the cached autoloader $cachedLoader->register(); eventually deactivate the non-cached loader if it was registered previously to be sure to use the cached one. $loader->unregister();
Author: Fabien Potencier ([email protected])
Author: Kris Wallsmith ([email protected])
Datei anzeigen Open project: symfony/symfony Class Usage Examples

Protected Properties

Property Type Description
$decorated object A class loader object that implements the findFile() method.

Public Methods

Method Description
__call ( $method, $args ) Passes through all unknown calls onto the decorated object.
__construct ( string $prefix, object $decorated ) Constructor.
findFile ( string $class ) : string | null Finds a file by class name while caching lookups to APC.
loadClass ( string $class ) : boolean | null Loads the given class or interface.
register ( boolean $prepend = false ) Registers this instance as an autoloader.
unregister ( ) Unregisters this instance as an autoloader.

Method Details

__call() public method

Passes through all unknown calls onto the decorated object.
public __call ( $method, $args )

__construct() public method

Constructor.
public __construct ( string $prefix, object $decorated )
$prefix string The APC namespace prefix to use
$decorated object A class loader object that implements the findFile() method

findFile() public method

Finds a file by class name while caching lookups to APC.
public findFile ( string $class ) : string | null
$class string A class name to resolve to file
return string | null

loadClass() public method

Loads the given class or interface.
public loadClass ( string $class ) : boolean | null
$class string The name of the class
return boolean | null True, if loaded

register() public method

Registers this instance as an autoloader.
public register ( boolean $prepend = false )
$prepend boolean Whether to prepend the autoloader or not

unregister() public method

Unregisters this instance as an autoloader.
public unregister ( )

Property Details

$decorated protected_oe property

A class loader object that implements the findFile() method.
protected object $decorated
return object