1 | <?php |
||
11 | class ConfigDefinition |
||
12 | { |
||
13 | /** |
||
14 | * @var integer componenets group |
||
15 | */ |
||
16 | const GROUP_COMPONENTS = 1; |
||
17 | |||
18 | /** |
||
19 | * @var integer modules group |
||
20 | */ |
||
21 | const GROUP_MODULES = 2; |
||
22 | |||
23 | /** |
||
24 | * @var integer applications group |
||
25 | */ |
||
26 | const GROUP_APPLICATIONS = 3; |
||
27 | |||
28 | /** |
||
29 | * @var integer boostrap section group |
||
30 | */ |
||
31 | const GROUP_BOOTSTRAPS = 4; |
||
32 | |||
33 | private $_group; |
||
34 | |||
35 | private $_key; |
||
36 | |||
37 | private $_config = []; |
||
38 | |||
39 | /** |
||
40 | * Consturctor |
||
41 | * |
||
42 | * @param string $group |
||
43 | * @param string $key |
||
44 | * @param mixed $config |
||
45 | */ |
||
46 | public function __construct($group, $key, $config) |
||
52 | |||
53 | private $_env = Config::ENV_ALL; |
||
54 | |||
55 | /** |
||
56 | * Set env |
||
57 | * |
||
58 | * @param string $env |
||
59 | * @return static |
||
60 | */ |
||
61 | public function env($env) |
||
67 | |||
68 | private $_runtime = Config::RUNTIME_ALL; |
||
69 | |||
70 | /** |
||
71 | * Set runtime |
||
72 | * |
||
73 | * @param string $runtime |
||
74 | * @return static |
||
75 | */ |
||
76 | public function runtime($runtime) |
||
82 | |||
83 | /** |
||
84 | * Set console runtime |
||
85 | * |
||
86 | * @return static |
||
87 | */ |
||
88 | public function consoleRuntime() |
||
94 | |||
95 | /** |
||
96 | * Set web runtime |
||
97 | * |
||
98 | * @return static |
||
99 | */ |
||
100 | public function webRuntime() |
||
106 | |||
107 | /** |
||
108 | * Getter method for group |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getGroup() |
||
116 | |||
117 | /** |
||
118 | * Getter method for config key |
||
119 | * |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getKey() |
||
126 | |||
127 | /** |
||
128 | * Getter method for config |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getConfig() |
||
136 | |||
137 | /** |
||
138 | * Validate whether its given runtime or not |
||
139 | * |
||
140 | * @param string $runtime |
||
141 | * @return boolean |
||
142 | */ |
||
143 | public function validateRuntime($runtime) |
||
147 | |||
148 | /** |
||
149 | * Validate whether given env exsts or not. |
||
150 | * |
||
151 | * @param array $envs |
||
152 | * @return boolean |
||
153 | */ |
||
154 | public function validateEnvs(array $envs) |
||
158 | } |