1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Micro framework package. |
7
|
|
|
* |
8
|
|
|
* (c) Stanislau Komar <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Micro\Plugin\Cache; |
15
|
|
|
|
16
|
|
|
use Micro\Component\DependencyInjection\Container; |
17
|
|
|
use Micro\Framework\Kernel\Plugin\ConfigurableInterface; |
18
|
|
|
use Micro\Framework\Kernel\Plugin\DependencyProviderInterface; |
19
|
|
|
use Micro\Framework\Kernel\Plugin\PluginConfigurationTrait; |
20
|
|
|
use Micro\Plugin\Cache\Business\Adapter\AdapterFactory; |
21
|
|
|
use Micro\Plugin\Cache\Business\Adapter\AdapterFactoryInterface; |
22
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\ApcuFactory; |
23
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\ArrayFactory; |
24
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\FilesystemFactory; |
25
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\PdoFactory; |
|
|
|
|
26
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\PhpFilesFactory; |
27
|
|
|
use Micro\Plugin\Cache\Business\Adapter\Concrete\RedisFactory; |
|
|
|
|
28
|
|
|
use Micro\Plugin\Cache\Business\Pool\CachePoolFactory; |
29
|
|
|
use Micro\Plugin\Cache\Business\Pool\CachePoolFactoryInterface; |
30
|
|
|
use Micro\Plugin\Cache\Configuration\CachePluginConfigurationInterface; |
31
|
|
|
use Micro\Plugin\Cache\Facade\CacheFacade; |
32
|
|
|
use Micro\Plugin\Cache\Facade\CacheFacadeInterface; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @method CachePluginConfigurationInterface configuration() |
36
|
|
|
*/ |
37
|
|
|
class CachePlugin implements DependencyProviderInterface, ConfigurableInterface |
38
|
|
|
{ |
39
|
|
|
use PluginConfigurationTrait; |
40
|
|
|
|
41
|
|
|
private Container $container; |
42
|
|
|
|
43
|
4 |
|
public function provideDependencies(Container $container): void |
44
|
|
|
{ |
45
|
4 |
|
$this->container = $container; |
46
|
|
|
|
47
|
4 |
|
$container->register(CacheFacadeInterface::class, function (): CacheFacadeInterface { |
48
|
4 |
|
return $this->createFacade(); |
49
|
4 |
|
}); |
50
|
|
|
} |
51
|
|
|
|
52
|
4 |
|
protected function createFacade(): CacheFacadeInterface |
53
|
|
|
{ |
54
|
4 |
|
return new CacheFacade( |
55
|
4 |
|
$this->createCachePoolFactory() |
56
|
4 |
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
4 |
|
protected function createCachePoolFactory(): CachePoolFactoryInterface |
60
|
|
|
{ |
61
|
4 |
|
return new CachePoolFactory( |
62
|
4 |
|
$this->createAdapterFactory() |
63
|
4 |
|
); |
64
|
|
|
} |
65
|
|
|
|
66
|
4 |
|
protected function createAdapterFactory(): AdapterFactoryInterface |
67
|
|
|
{ |
68
|
4 |
|
return new AdapterFactory( |
69
|
4 |
|
$this->configuration(), |
70
|
4 |
|
[ |
71
|
4 |
|
new ApcuFactory(), |
72
|
4 |
|
new ArrayFactory(), |
73
|
4 |
|
new FilesystemFactory(), |
74
|
4 |
|
new PdoFactory($this->container), |
75
|
4 |
|
new RedisFactory($this->container), |
76
|
4 |
|
new PhpFilesFactory(), |
77
|
4 |
|
] |
78
|
4 |
|
); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths