moved the class loader to its own component

This commit is contained in:
Fabien Potencier 2011-01-27 13:04:16 +01:00
parent 7bd30398c6
commit 42f9c556a3
3 changed files with 15 additions and 9 deletions

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpFoundation;
namespace Symfony\Component\ClassLoader;
/**
* UniversalClassLoader implements a "universal" autoloader for PHP 5.3.
@ -162,10 +162,12 @@ class UniversalClassLoader
/**
* Registers this instance as an autoloader.
*
* @param Boolean $prepend Whether to prepend the autoloader or not
*/
public function register()
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'));
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**

View File

@ -1,6 +1,6 @@
<?php
require_once __DIR__.'/../../../HttpFoundation/UniversalClassLoader.php';
require_once __DIR__.'/../../../ClassLoader/UniversalClassLoader.php';
/*
* This file is part of the Symfony package.
@ -11,7 +11,7 @@ require_once __DIR__.'/../../../HttpFoundation/UniversalClassLoader.php';
* file that was distributed with this source code.
*/
use Symfony\Component\HttpFoundation\UniversalClassLoader;
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Symfony\Component\HttpKernel\ClassCollectionLoader;
$loader = new UniversalClassLoader();
@ -45,6 +45,7 @@ ClassCollectionLoader::load(array(
'Symfony\\Component\\HttpFoundation\\ServerBag',
'Symfony\\Component\\HttpFoundation\\HeaderBag',
'Symfony\\Component\\HttpFoundation\\Request',
'Symfony\\Component\\HttpFoundation\\UniversalClassLoader',
'Symfony\\Component\\ClassLoader\\UniversalClassLoader',
), __DIR__.'/../..', 'bootstrap', false);

View File

@ -11,6 +11,9 @@ interface ContainerInterface
function set($id, $service, $scope = self::SCOPE_CONTAINER);
function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE);
function has($id);
function getParameter($name);
function hasParameter($name);
function setParameter($name, $value);
function enterScope($name);
function leaveScope($name);
function addScope($name, $parentScope = self::SCOPE_CONTAINER);
@ -1842,7 +1845,7 @@ class Request
}
}
}
namespace Symfony\Component\HttpFoundation
namespace Symfony\Component\ClassLoader
{
class UniversalClassLoader
{
@ -1890,9 +1893,9 @@ class UniversalClassLoader
{
$this->prefixes[$prefix] = $path;
}
public function register()
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'));
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
public function loadClass($class)
{