Passed
Push — master ( 247a52...f18ab4 )
by Melech
07:21 queued 03:19
created

Config   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A setPropertiesFromEnv() 0 5 1
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;
15
16
use Valkyrja\Cli\Constant\ConfigName;
0 ignored issues
show
Bug introduced by
The type Valkyrja\Cli\Constant\ConfigName 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...
17
use Valkyrja\Cli\Constant\EnvName;
0 ignored issues
show
Bug introduced by
The type Valkyrja\Cli\Constant\EnvName 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...
18
use Valkyrja\Cli\Interaction\Config as InteractionConfig;
19
use Valkyrja\Cli\Middleware\Config as MiddlewareConfig;
20
use Valkyrja\Cli\Routing\Config as RoutingConfig;
21
use Valkyrja\Config\Config as ParentConfig;
22
23
/**
24
 * Class Config.
25
 *
26
 * @author Melech Mizrachi
27
 */
28
class Config extends ParentConfig
29
{
30
    /**
31
     * @inheritDoc
32
     *
33
     * @var array<string, string>
34
     */
35
    protected static array $envNames = [
36
        ConfigName::INTERACTION => EnvName::INTERACTION,
37
        ConfigName::MIDDLEWARE  => EnvName::MIDDLEWARE,
38
        ConfigName::ROUTING     => EnvName::ROUTING,
39
    ];
40
41
    public function __construct(
42
        public InteractionConfig $interaction = new InteractionConfig(),
43
        public MiddlewareConfig $middleware = new MiddlewareConfig(),
44
        public RoutingConfig $routing = new RoutingConfig(),
45
    ) {
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function setPropertiesFromEnv(string $env): void
52
    {
53
        $this->interaction->setPropertiesFromEnv($env);
54
        $this->middleware->setPropertiesFromEnv($env);
55
        $this->routing->setPropertiesFromEnv($env);
56
    }
57
}
58