1 | <?php |
||
26 | final class Config |
||
27 | { |
||
28 | |||
29 | /** |
||
30 | * Path to package composer.json |
||
31 | * |
||
32 | * @var string|null |
||
33 | */ |
||
34 | private $config_path; |
||
35 | |||
36 | /** |
||
37 | * Array with contents of composer.json |
||
38 | * |
||
39 | * @var array|null |
||
40 | */ |
||
41 | private $cfg_data; |
||
42 | |||
43 | /** |
||
44 | * Config vars |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | private $config_vars; |
||
49 | |||
50 | /** |
||
51 | * Configuration constructor |
||
52 | */ |
||
53 | 105 | public function __construct() |
|
58 | |||
59 | /** |
||
60 | * Get configuration value by key |
||
61 | * |
||
62 | * @param string $prop |
||
63 | * @return string|null |
||
64 | */ |
||
65 | 103 | public function get(string $prop) |
|
69 | |||
70 | /** |
||
71 | * Set configuration value |
||
72 | * |
||
73 | * @param string $key |
||
74 | * @param mixed $val |
||
75 | * @return Config |
||
76 | */ |
||
77 | 105 | public function set(string $key, $val) : Config |
|
82 | |||
83 | /** |
||
84 | * Real path to aframe-php composer.json |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 105 | protected function getConfigRealPath() |
|
92 | |||
93 | /** |
||
94 | * Whether config file can be found |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | 105 | protected function configExists() |
|
102 | |||
103 | /** |
||
104 | * Load contents of aframe-php cmposer.json |
||
105 | * and read aframe config |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | 105 | protected function loadComposerJson() |
|
116 | |||
117 | /** |
||
118 | * Define Configuration constants |
||
119 | * |
||
120 | * @return void |
||
121 | */ |
||
122 | 105 | protected function defineVars() |
|
129 | } |
||
130 |