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 | private $_group; |
||
29 | |||
30 | private $_key; |
||
31 | |||
32 | private $_config = []; |
||
33 | |||
34 | /** |
||
35 | * Consturctor |
||
36 | * |
||
37 | * @param string $group |
||
38 | * @param string $key |
||
39 | * @param mixed $config |
||
40 | */ |
||
41 | public function __construct($group, $key, $config) |
||
47 | |||
48 | private $_env = Config::ENV_ALL; |
||
49 | |||
50 | /** |
||
51 | * Set env |
||
52 | * |
||
53 | * @param string $env |
||
54 | * @return static |
||
55 | */ |
||
56 | public function env($env) |
||
62 | |||
63 | private $_runtime = Config::RUNTIME_ALL; |
||
64 | |||
65 | /** |
||
66 | * Set runtime |
||
67 | * |
||
68 | * @param string $runtime |
||
69 | * @return static |
||
70 | */ |
||
71 | public function runtime($runtime) |
||
77 | |||
78 | /** |
||
79 | * Set console runtime |
||
80 | * |
||
81 | * @return static |
||
82 | */ |
||
83 | public function consoleRuntime() |
||
89 | |||
90 | /** |
||
91 | * Set web runtime |
||
92 | * |
||
93 | * @return static |
||
94 | */ |
||
95 | public function webRuntime() |
||
101 | |||
102 | /** |
||
103 | * Getter method for group |
||
104 | * |
||
105 | * @return string |
||
106 | */ |
||
107 | public function getGroup() |
||
111 | |||
112 | /** |
||
113 | * Getter method for config key |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getKey() |
||
121 | |||
122 | /** |
||
123 | * Getter method for config |
||
124 | * |
||
125 | * @return array |
||
126 | */ |
||
127 | public function getConfig() |
||
131 | |||
132 | /** |
||
133 | * Validate whether its given runtime or not |
||
134 | * |
||
135 | * @param string $runtime |
||
136 | * @return boolean |
||
137 | */ |
||
138 | public function validateRuntime($runtime) |
||
142 | |||
143 | /** |
||
144 | * Validate whether given env exsts or not. |
||
145 | * |
||
146 | * @param array $envs |
||
147 | * @return boolean |
||
148 | */ |
||
149 | public function validateEnvs(array $envs) |
||
153 | } |