File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 1212 ],
1313 "require" : {
1414 "arhframe/iocart" : " 1.0.1" ,
15- "filp/whoops" : " 1.1.1"
15+ "filp/whoops" : " 1.1.1" ,
16+ "symfony/yaml" : " 2.5.3"
1617 },
1718 "autoload" : {
1819 "psr-0" : {
1920 "orange\\ cfhelper\\ services" : " src/" ,
2021 "orange\\ cfhelper\\ application" : " src/" ,
2122 "orange\\ cfhelper\\ configuration" : " src/" ,
23+ "orange\\ cfhelper\\ simulator" : " src/" ,
2224 "orange\\ cfhelper" : " src"
2325 }
2426 }
Original file line number Diff line number Diff line change 1111
1212namespace orange \cfhelper ;
1313
14+ use orange \cfhelper \simulator \CloudFoundrySimulator ;
1415use Symfony \Component \Yaml \Yaml ;
1516
1617class CfHelper
@@ -55,4 +56,9 @@ public function getApplicationInfo()
5556 {
5657 return $ this ->beanLoader ->getBean ('cfhelper.applicationInfo ' );
5758 }
59+
60+ public function simulateCloudFoundry ($ manifestYml = "manifest.yml " )
61+ {
62+ CloudFoundrySimulator::simulate ($ manifestYml );
63+ }
5864}
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright (C) 2014 Orange
4+ *
5+ * This software is distributed under the terms and conditions of the 'MIT'
6+ * license which can be found in the file 'LICENSE' in this package distribution
7+ * or at 'http://opensource.org/licenses/MIT'.
8+ *
9+ * Author: Arthur Halet
10+ * Date: 19/08/2014
11+ */
12+ namespace orange \cfhelper \simulator ;
13+ class CloudFoundrySimulator
14+ {
15+
16+ public static function simulate ($ manifestYml )
17+ {
18+ CloudFoundrySimulator::loadEnv ($ manifestYml );
19+ }
20+
21+ public static function loadEnv ($ manifestYml )
22+ {
23+ $ manifestUnparse = \Symfony \Component \Yaml \Yaml::parse ($ manifestYml );
24+ $ applications = $ manifestUnparse ['applications ' ];
25+ foreach ($ applications as $ application ) {
26+ CloudFoundrySimulator::loadVarEnv ($ application ['env ' ]);
27+ }
28+ }
29+
30+ public static function loadVarEnv (array $ envVars )
31+ {
32+ foreach ($ envVars as $ key => $ value ) {
33+ $ _ENV [$ key ] = $ value ;
34+ }
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments