|
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\Application; |
|
15
|
|
|
|
|
16
|
|
|
use Valkyrja\Application\Constant\ComponentClass; |
|
|
|
|
|
|
17
|
|
|
use Valkyrja\Application\Constant\ConfigName; |
|
|
|
|
|
|
18
|
|
|
use Valkyrja\Application\Constant\EnvName; |
|
|
|
|
|
|
19
|
|
|
use Valkyrja\Application\Contract\Application; |
|
|
|
|
|
|
20
|
|
|
use Valkyrja\Application\Support\Component; |
|
|
|
|
|
|
21
|
|
|
use Valkyrja\Config\Config as ParentConfig; |
|
22
|
|
|
use Valkyrja\Support\Directory; |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Class Config. |
|
26
|
|
|
* |
|
27
|
|
|
* @author Melech Mizrachi |
|
28
|
|
|
*/ |
|
29
|
|
|
class Config extends ParentConfig |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @inheritDoc |
|
33
|
|
|
* |
|
34
|
|
|
* @var array<string, string> |
|
35
|
|
|
*/ |
|
36
|
|
|
protected static array $envNames = [ |
|
37
|
|
|
ConfigName::ENV => EnvName::ENV, |
|
38
|
|
|
ConfigName::DEBUG_MODE => EnvName::DEBUG_MODE, |
|
39
|
|
|
ConfigName::URL => EnvName::URL, |
|
40
|
|
|
ConfigName::TIMEZONE => EnvName::TIMEZONE, |
|
41
|
|
|
ConfigName::VERSION => EnvName::VERSION, |
|
42
|
|
|
ConfigName::KEY => EnvName::KEY, |
|
43
|
|
|
ConfigName::COMPONENTS => EnvName::COMPONENTS, |
|
44
|
|
|
ConfigName::CACHE_FILE_PATH => EnvName::CACHE_FILE_PATH, |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param non-empty-string $env The environment |
|
|
|
|
|
|
49
|
|
|
* @param non-empty-string $url The url |
|
50
|
|
|
* @param non-empty-string $timezone The timezone |
|
51
|
|
|
* @param non-empty-string $version The version |
|
52
|
|
|
* @param non-empty-string $key The secret key |
|
53
|
|
|
* @param class-string<Component>[] $components The components |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __construct( |
|
56
|
|
|
public string $env = 'production', |
|
57
|
|
|
public bool $debugMode = false, |
|
58
|
|
|
public string $url = 'localhost', |
|
59
|
|
|
public string $timezone = 'UTC', |
|
60
|
|
|
public string $version = Application::VERSION, |
|
61
|
|
|
public string $key = 'some_secret_app_key', |
|
62
|
|
|
public array $components = [], |
|
63
|
|
|
public string $cacheFilePath = '' |
|
64
|
|
|
) { |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function setPropertiesFromEnv(string $env): void |
|
68
|
|
|
{ |
|
69
|
|
|
if ($this->cacheFilePath === '') { |
|
70
|
|
|
$this->cacheFilePath = Directory::cachePath('config.php'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
$this->components = [ |
|
74
|
|
|
ComponentClass::API, |
|
75
|
|
|
ComponentClass::ASSET, |
|
76
|
|
|
ComponentClass::AUTH, |
|
77
|
|
|
ComponentClass::BROADCAST, |
|
78
|
|
|
ComponentClass::CACHE, |
|
79
|
|
|
ComponentClass::CRYPT, |
|
80
|
|
|
ComponentClass::FILESYSTEM, |
|
81
|
|
|
ComponentClass::HTTP_CLIENT, |
|
82
|
|
|
ComponentClass::JWT, |
|
83
|
|
|
ComponentClass::LOG, |
|
84
|
|
|
ComponentClass::MAIL, |
|
85
|
|
|
ComponentClass::NOTIFICATION, |
|
86
|
|
|
ComponentClass::ORM, |
|
87
|
|
|
ComponentClass::SESSION, |
|
88
|
|
|
ComponentClass::SMS, |
|
89
|
|
|
ComponentClass::VIEW, |
|
90
|
|
|
]; |
|
91
|
|
|
|
|
92
|
|
|
parent::setPropertiesFromEnv($env); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
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