|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Valkyrja Framework package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Melech Mizrachi <[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 Valkyrja\Cli\Interaction\Provider; |
|
15
|
|
|
|
|
16
|
|
|
use Valkyrja\Application\Env; |
|
|
|
|
|
|
17
|
|
|
use Valkyrja\Cli\Interaction\Config; |
|
18
|
|
|
use Valkyrja\Cli\Interaction\Factory\Contract\OutputFactory; |
|
19
|
|
|
use Valkyrja\Container\Contract\Container; |
|
20
|
|
|
use Valkyrja\Container\Support\Provider; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Class ServiceProvider. |
|
24
|
|
|
* |
|
25
|
|
|
* @author Melech Mizrachi |
|
26
|
|
|
*/ |
|
27
|
|
|
final class ServiceProvider extends Provider |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @inheritDoc |
|
31
|
|
|
*/ |
|
32
|
|
|
public static function publishers(): array |
|
33
|
|
|
{ |
|
34
|
|
|
return [ |
|
35
|
|
|
Config::class => [self::class, 'publishConfig'], |
|
36
|
|
|
OutputFactory::class => [self::class, 'publishOutputFactory'], |
|
37
|
|
|
]; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @inheritDoc |
|
42
|
|
|
*/ |
|
43
|
|
|
public static function provides(): array |
|
44
|
|
|
{ |
|
45
|
|
|
return [ |
|
46
|
|
|
Config::class, |
|
47
|
|
|
OutputFactory::class, |
|
48
|
|
|
]; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Publish the output factory. |
|
53
|
|
|
*/ |
|
54
|
|
|
public static function publishConfig(Container $container): void |
|
55
|
|
|
{ |
|
56
|
|
|
$env = $container->getSingleton(Env::class); |
|
57
|
|
|
/** @var bool $isQuiet */ |
|
58
|
|
|
$isQuiet = $env::CLI_INTERACTION_IS_QUIET; |
|
59
|
|
|
/** @var bool $isInteractive */ |
|
60
|
|
|
$isInteractive = $env::CLI_INTERACTION_IS_INTERACTIVE; |
|
61
|
|
|
/** @var bool $isSilent */ |
|
62
|
|
|
$isSilent = $env::CLI_INTERACTION_IS_SILENT; |
|
63
|
|
|
|
|
64
|
|
|
$container->setSingleton( |
|
65
|
|
|
Config::class, |
|
66
|
|
|
new Config( |
|
67
|
|
|
isQuiet: $isQuiet, |
|
68
|
|
|
isInteractive: $isInteractive, |
|
69
|
|
|
isSilent: $isSilent, |
|
70
|
|
|
) |
|
71
|
|
|
); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Publish the output factory. |
|
76
|
|
|
*/ |
|
77
|
|
|
public static function publishOutputFactory(Container $container): void |
|
78
|
|
|
{ |
|
79
|
|
|
$config = $container->getSingleton(Config::class); |
|
80
|
|
|
|
|
81
|
|
|
$container->setSingleton( |
|
82
|
|
|
OutputFactory::class, |
|
83
|
|
|
new \Valkyrja\Cli\Interaction\Factory\OutputFactory( |
|
84
|
|
|
config: $config |
|
85
|
|
|
) |
|
86
|
|
|
); |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
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