1
0
mirror of synced 2025-01-18 14:31:40 +03:00

DDC-1313 - Optimize behavior of DriverChain::getAllClassNames()

This commit is contained in:
Benjamin Eberlei 2011-08-01 21:45:21 +02:00
parent e12a5fb328
commit ba882be76b

View File

@ -88,15 +88,20 @@ class DriverChain implements Driver
public function getAllClassNames() public function getAllClassNames()
{ {
$classNames = array(); $classNames = array();
$driverClasses = array();
foreach ($this->_drivers AS $namespace => $driver) { foreach ($this->_drivers AS $namespace => $driver) {
$driverClasses = $driver->getAllClassNames(); $oid = spl_object_hash($driver);
foreach ($driverClasses AS $className) { if (!isset($driverClasses[$oid])) {
$driverClasses[$oid] = $driver->getAllClassNames();
}
foreach ($driverClasses[$oid] AS $className) {
if (strpos($className, $namespace) === 0) { if (strpos($className, $namespace) === 0) {
$classNames[] = $className; $classNames[$className] = true;
} }
} }
} }
return array_unique($classNames); return array_keys($classNames);
} }
/** /**