public static $mockServiceName = 'cache';
/**
* Attempts to create the desired cache handler, based upon the
*
* @return CacheInterface
*/
public static function getHandler(Cache
$config, ?string
$handler = null, ?string
$backup = null
) { if (!
isset($config->validHandlers
) ||
$config->validHandlers ===
[]) { throw CacheException::
forInvalidHandlers();
} if (!
isset($config->handler
) || !
isset($config->backupHandler
)) { throw CacheException::
forNoBackup();
} $handler = !
empty($handler) ?
$handler :
$config->handler;
$backup = !
empty($backup) ?
$backup :
$config->backupHandler;
if (!
array_key_exists($handler,
$config->validHandlers
) || !
array_key_exists($backup,
$config->validHandlers
)) { throw CacheException::
forHandlerNotFound();
}