1 | <?php |
||
10 | class Tier implements \JsonSerializable |
||
11 | { |
||
12 | /** |
||
13 | * Developer's desktop/workstation |
||
14 | */ |
||
15 | const LOCAL = 'local'; |
||
16 | |||
17 | /** |
||
18 | * Development server aka sandbox. This is where unit testing is performed by the developer. |
||
19 | */ |
||
20 | const DEVELOPMENT = 'development'; |
||
21 | |||
22 | /** |
||
23 | * CI build target, or for developer testing of side effects |
||
24 | */ |
||
25 | const INTEGRATION = 'integration'; |
||
26 | |||
27 | /** |
||
28 | * This is the stage where interface testing is performed. |
||
29 | * Quality analysis team make sure that the new code will not have any impact on the existing |
||
30 | * functionality and they test major functionalities of the system once after deploying the |
||
31 | * new code in their respective environment(i.e. QA environment) |
||
32 | */ |
||
33 | const TEST = 'test'; |
||
34 | |||
35 | /** |
||
36 | * Mirror of production environment |
||
37 | */ |
||
38 | const STAGING = 'staging'; |
||
39 | |||
40 | /** |
||
41 | * Serves end-users/clients |
||
42 | */ |
||
43 | const PRODUCTION = 'production'; |
||
44 | |||
45 | /** |
||
46 | * @var array |
||
47 | */ |
||
48 | private $allPossibleTiers; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | private $tier; |
||
54 | |||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | private $applicationTiers; |
||
59 | |||
60 | /** |
||
61 | * @param string $tier |
||
62 | * @param array|null $applicationTiers |
||
63 | */ |
||
64 | public function __construct($tier, array $applicationTiers = null) |
||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | public function get() |
||
87 | |||
88 | /** |
||
89 | * @return string |
||
90 | */ |
||
91 | public function __toString() |
||
95 | |||
96 | /** |
||
97 | * @return array |
||
98 | */ |
||
99 | public function getApplicationTiers() |
||
103 | |||
104 | /** |
||
105 | * @return array |
||
106 | */ |
||
107 | public function jsonSerialize() |
||
114 | |||
115 | /** |
||
116 | * @param string $tier |
||
117 | * @param array $applicationTiers |
||
118 | * |
||
119 | * @throws Exception\InvalidArgumentException |
||
120 | */ |
||
121 | private function validateDefinition($tier, array $applicationTiers) |
||
143 | } |
||
144 |