FastlyModule   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A __construct() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\QueryRepository\Cdn;
6
7
use BEAR\FastlyModule\FastlyPurgeModule;
8
use BEAR\QueryRepository\CdnCacheControlHeaderSetterInterface;
9
use BEAR\QueryRepository\PurgerInterface;
10
use LogicException;
11
use Override;
12
use Ray\Di\AbstractModule;
13
14
use function class_exists;
15
16
final class FastlyModule extends AbstractModule
17
{
18
    public function __construct(
19
        private readonly string $fastlyApiKey,
20
        private readonly string $fastlyServiceId,
21
        AbstractModule|null $module = null,
22
    ) {
23
        parent::__construct($module);
24
25
        if (! class_exists(FastlyPurgeModule::class)) {
26
            throw new LogicException('Install bear/fastly-module'); // @codeCoverageIgnore
27
        }
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     */
33
    #[Override]
34
    protected function configure(): void
35
    {
36
        $this->install(new FastlyPurgeModule($this->fastlyApiKey, $this->fastlyServiceId));
37
        $this->bind(CdnCacheControlHeaderSetterInterface::class)->to(FastlyCacheControlHeaderSetter::class);
0 ignored issues
show
Bug introduced by
The type BEAR\QueryRepository\Cdn...acheControlHeaderSetter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
38
        $this->bind(PurgerInterface::class)->to(FastlyCachePurger::class);
39
    }
40
}
41