Skip to content

Commit e0234b0

Browse files
committed
Added FQCNAsKey parameter to CacheManager::getDriverList()
1 parent 160968c commit e0234b0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/Phpfastcache/CacheManager.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,11 @@ public static function getStaticAllDrivers(): array
374374
}
375375

376376
/**
377+
* @param bool $FQNAsKey Describe keys with Full Qualified Class Name
377378
* @return string[]
378379
* @throws PhpfastcacheUnsupportedOperationException
379380
*/
380-
public static function getDriverList(): array
381+
public static function getDriverList($FQCNAsKey = false): array
381382
{
382383
static $driverList;
383384

@@ -396,7 +397,15 @@ public static function getDriverList(): array
396397

397398
$driverList = \array_merge($driverList, \array_keys(self::$driverCustoms));
398399

399-
\sort($driverList);
400+
if($FQCNAsKey){
401+
$realDriverList = [];
402+
foreach ($driverList as $driverName){
403+
$realDriverList[self::getDriverClass($driverName)] = $driverName;
404+
}
405+
$driverList = $realDriverList;
406+
}
407+
408+
\asort($driverList);
400409

401410
return $driverList;
402411
}

0 commit comments

Comments
 (0)