merged branch gajdaw/2_1_component_classloader_cs (PR #4073)

Commits
-------

bc8855e [2.1][Component][ClassLoader] cs

Discussion
----------

[2.1][Component][ClassLoader] cs

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

---------------------------------------------------------------------------

by fabpot at 2012-04-23T06:18:26Z

Can you please remove the changes you have already made in the other PR as I merge 2.0 into master regularly. Then, you will need to squash you commits to avoid any conflict when merging will occur. Thanks.

---------------------------------------------------------------------------

by gajdaw at 2012-04-23T06:50:58Z

I hope that's it.
This commit is contained in:
Fabien Potencier 2012-04-23 12:23:18 +02:00
commit 918769ded9
6 changed files with 29 additions and 9 deletions

View File

@ -47,8 +47,8 @@ class ApcClassLoader
/**
* Constructor.
*
* @param string $prefix A prefix to create a namespace in APC
* @param object $classFinder
* @param string $prefix A prefix to create a namespace in APC
* @param object $classFinder An object that implements findFile() method.
*
* @api
*/
@ -88,6 +88,7 @@ class ApcClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)

View File

@ -25,7 +25,7 @@ namespace Symfony\Component\ClassLoader;
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* // to enable searching the include path (e.g. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
@ -43,16 +43,31 @@ class ClassLoader
private $fallbackDirs = array();
private $useIncludePath = false;
/**
* Returns prefixes.
*
* @return array
*/
public function getPrefixes()
{
return $this->prefixes;
}
/**
* Returns fallback directories.
*
* @return array
*/
public function getFallbackDirs()
{
return $this->fallbackDirs;
}
/**
* Adds prefixes.
*
* @param array $prefixes Prefixes to add
*/
public function addPrefixes(array $prefixes)
{
foreach ($prefixes as $prefix => $path) {
@ -63,8 +78,8 @@ class ClassLoader
/**
* Registers a set of classes
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function addPrefix($prefix, $paths)
{
@ -128,6 +143,7 @@ class ClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)

View File

@ -22,7 +22,7 @@ class ClassMapGenerator
* Generate a class map file
*
* @param array|string $dirs Directories or a single path to search in
* @param string $file The name of the class map file
* @param string $file The name of the class map file
*/
static public function dump($dirs, $file)
{

View File

@ -73,6 +73,7 @@ class DebugClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)

View File

@ -42,7 +42,7 @@ namespace Symfony\Component\ClassLoader;
* ));
*
*
* // to enable searching the include path (eg. for PEAR packages)
* // to enable searching the include path (e.g. for PEAR packages)
* $loader->useIncludePath(true);
*
* // activate the autoloader

View File

@ -48,8 +48,8 @@ class XcacheClassLoader
/**
* Constructor.
*
* @param string $prefix A prefix to create a namespace in Xcache
* @param object $classFinder
* @param string $prefix A prefix to create a namespace in Xcache
* @param object $classFinder An object that implements findFile() method.
*
* @api
*/
@ -89,12 +89,14 @@ class XcacheClassLoader
* Loads the given class or interface.
*
* @param string $class The name of the class
*
* @return Boolean|null True, if loaded
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
require $file;
return true;
}
}