1 | <?php |
||
26 | final class Config |
||
27 | { |
||
28 | /** |
||
29 | * Path to package composer.json |
||
30 | * |
||
31 | * @var string|null |
||
32 | */ |
||
33 | private $config_path; |
||
34 | |||
35 | /** |
||
36 | * Array with contents of composer.json |
||
37 | * |
||
38 | * @var array|null |
||
39 | */ |
||
40 | private $config_data; |
||
41 | |||
42 | /** |
||
43 | * Config arguments starting with (aframe-) |
||
44 | * |
||
45 | * @var array|null |
||
46 | */ |
||
47 | private $config_args; |
||
48 | |||
49 | /** |
||
50 | * Useful config vars |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private $config_vars; |
||
55 | |||
56 | /** |
||
57 | * Configuration constructor |
||
58 | */ |
||
59 | 69 | public function __construct() |
|
64 | |||
65 | /** |
||
66 | * Get configuration value by key |
||
67 | * |
||
68 | * @param string $prop |
||
69 | * @return string|null |
||
70 | */ |
||
71 | 67 | public function get(string $prop) |
|
75 | |||
76 | /** |
||
77 | * Set configuration value |
||
78 | * |
||
79 | * @param string $key |
||
80 | * @param string $val |
||
81 | */ |
||
82 | 7 | public function set(string $key, string $val) |
|
86 | |||
87 | /** |
||
88 | * Real path to aframe-php composer.json |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 69 | protected function getConfigRealPath() |
|
96 | |||
97 | /** |
||
98 | * Whether config file can be found |
||
99 | * |
||
100 | * @return bool |
||
101 | */ |
||
102 | 69 | protected function configExists() |
|
106 | |||
107 | /** |
||
108 | * Load contents of aframe-php cmposer.json |
||
109 | * |
||
110 | * @return array|null |
||
111 | */ |
||
112 | 69 | protected function loadComposerJson() |
|
116 | |||
117 | /** |
||
118 | * Define Configuration constants |
||
119 | * |
||
120 | * @return void |
||
121 | */ |
||
122 | 69 | protected function defineVars() |
|
132 | } |
||
133 |