1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 06:36:52 +02:00

refactor(dependencies): update code according to coding doctrine coding standard

This commit is contained in:
Awilum
2020-09-07 21:32:18 +03:00
parent 3d5ceb7088
commit 47b055af18

View File

@@ -106,19 +106,7 @@ flextype()->container()['slugify'] = static function () {
flextype()->container()['cache'] = static function () {
$driver_name = flextype('registry')->get('flextype.settings.cache.driver');
if (! $driver_name || $driver_name === 'auto') {
if (extension_loaded('apcu')) {
$driver_name = 'apcu';
} elseif (extension_loaded('wincache')) {
$driver_name = 'wincache';
} else {
$driver_name = 'files';
}
}
if (flextype('registry')->get('flextype.settings.cache.enabled') === false) {
$driver_name = 'devnull';
}
$config = [];
function getDriverConfig(string $driver_name): array
{
@@ -135,6 +123,20 @@ flextype()->container()['cache'] = static function () {
return $config;
}
if (! $driver_name || $driver_name === 'auto') {
if (extension_loaded('apcu')) {
$driver_name = 'apcu';
} elseif (extension_loaded('wincache')) {
$driver_name = 'wincache';
} else {
$driver_name = 'files';
}
}
if (flextype('registry')->get('flextype.settings.cache.enabled') === false) {
$driver_name = 'devnull';
}
switch ($driver_name) {
case 'apcu':
$config = new Config(getDriverConfig($driver_name));