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\Executor\HttpExceptionExecutorDecoratorFactory; |
|
|
|
|
22
|
|
|
use Micro\Plugin\Http\Business\Executor\RouteExecutorFactoryInterface; |
23
|
|
|
use Micro\Plugin\Http\Configuration\HttpExceptionResponsePluginConfigurationInterface; |
24
|
|
|
use Micro\Plugin\Http\Decorator\ExceptionResponseBuilderDecorator; |
|
|
|
|
25
|
|
|
use Micro\Plugin\Http\Facade\HttpFacadeInterface; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @author Stanislau Komar <[email protected]> |
29
|
|
|
* |
30
|
|
|
* @method HttpExceptionResponsePluginConfigurationInterface configuration() |
31
|
|
|
*/ |
32
|
|
|
class HttpExceptionResponsePlugin implements DependencyProviderInterface, PluginDependedInterface, ConfigurableInterface |
33
|
|
|
{ |
34
|
|
|
use PluginConfigurationTrait; |
35
|
|
|
|
36
|
|
|
private HttpFacadeInterface $httpFacade; |
37
|
|
|
|
38
|
1 |
|
public function provideDependencies(Container $container): void |
39
|
|
|
{ |
40
|
1 |
|
$container->decorate(HttpFacadeInterface::class, function ( |
41
|
1 |
|
HttpFacadeInterface $httpFacade |
42
|
1 |
|
): HttpFacadeInterface { |
43
|
1 |
|
$this->httpFacade = $httpFacade; |
44
|
|
|
|
45
|
1 |
|
return $this->createDecorator(); |
46
|
1 |
|
}, $this->configuration()->getDecoratedLevel()); |
47
|
|
|
} |
48
|
|
|
|
49
|
1 |
|
protected function createDecorator(): HttpFacadeInterface |
50
|
|
|
{ |
51
|
1 |
|
return new ExceptionResponseBuilderDecorator( |
52
|
1 |
|
$this->httpFacade, |
53
|
1 |
|
$this->createHttpExceptionExecutorDecoratorFactory() |
54
|
1 |
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
1 |
|
protected function createHttpExceptionExecutorDecoratorFactory(): RouteExecutorFactoryInterface |
58
|
|
|
{ |
59
|
1 |
|
return new HttpExceptionExecutorDecoratorFactory($this->httpFacade); |
60
|
|
|
} |
61
|
|
|
|
62
|
1 |
|
public function getDependedPlugins(): iterable |
63
|
|
|
{ |
64
|
1 |
|
return [ |
65
|
1 |
|
HttpCorePlugin::class, |
66
|
1 |
|
]; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
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