createRouteExecutorFactory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Http;
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\Framework\Kernel\Plugin\PluginDependedInterface;
21
use Micro\Plugin\Http\Business\Exception\Renderer\RendererFactory;
22
use Micro\Plugin\Http\Business\Exception\Renderer\RendererFactoryInterface;
23
use Micro\Plugin\Http\Business\Executor\HttpExceptionPageExecutorDecoratorFactory;
0 ignored issues
show
Bug introduced by
The type Micro\Plugin\Http\Busine...xecutorDecoratorFactory 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...
24
use Micro\Plugin\Http\Business\Executor\RouteExecutorFactoryInterface;
25
use Micro\Plugin\Http\Configuration\HttpExceptionResponseDevPluginConfigurationInterface;
26
use Micro\Plugin\Http\Decorator\HttpFacadeExceptionDevDecorator;
0 ignored issues
show
Bug introduced by
The type Micro\Plugin\Http\Decora...deExceptionDevDecorator 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...
27
use Micro\Plugin\Http\Facade\HttpFacadeInterface;
28
29
/**
30
 * @author Stanislau Komar <[email protected]>
31
 *
32
 * @method HttpExceptionResponseDevPluginConfigurationInterface configuration()
33
 */
34
class HttpExceptionResponseDevPlugin implements ConfigurableInterface, DependencyProviderInterface, PluginDependedInterface
35
{
36
    use PluginConfigurationTrait;
37
38
    private HttpFacadeInterface $httpFacade;
39
40 33
    public function provideDependencies(Container $container): void
41
    {
42 33
        $container->decorate(HttpFacadeInterface::class, function (
43 33
            HttpFacadeInterface $httpFacade
44 33
        ) {
45 33
            $this->httpFacade = $httpFacade;
46
47 33
            return $this->createDecorator();
48 33
        });
49
    }
50
51 33
    protected function createDecorator(): HttpFacadeInterface
52
    {
53 33
        return new HttpFacadeExceptionDevDecorator(
54 33
            $this->httpFacade,
55 33
            $this->createRouteExecutorFactory()
56 33
        );
57
    }
58
59 33
    protected function createRouteExecutorFactory(): RouteExecutorFactoryInterface
60
    {
61 33
        return new HttpExceptionPageExecutorDecoratorFactory(
62 33
            $this->httpFacade,
63 33
            $this->createExceptionRendererFactory(),
64 33
            $this->configuration()
65 33
        );
66
    }
67
68 33
    protected function createExceptionRendererFactory(): RendererFactoryInterface
69
    {
70 33
        return new RendererFactory($this->configuration());
71
    }
72
73 33
    public function getDependedPlugins(): iterable
74
    {
75 33
        return [
76 33
            HttpCorePlugin::class,
77 33
        ];
78
    }
79
}
80