| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 22 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 21 | 	public function perform() { | 
            ||
| 22 | echo "[-] CreateEnvJob starting" . PHP_EOL;  | 
            ||
| 23 | $log = new DeploynautLogFile($this->args['logfile']);  | 
            ||
| 24 | $envCreate = DNCreateEnvironment::get()->byId($this->args['createID']);  | 
            ||
| 25 | |||
| 26 | 		try { | 
            ||
| 27 | 			if(!($envCreate && $envCreate->exists())) { | 
            ||
| 28 | 				throw new RuntimeException(sprintf('Could not find create environment record %s', $args['createID'])); | 
            ||
| 29 | }  | 
            ||
| 30 | |||
| 31 | // This will throw and exception if it fails.  | 
            ||
| 32 | $envCreate->createEnvironment();  | 
            ||
| 33 | |||
| 34 | 		} catch(Exception $e) { | 
            ||
| 35 | $log->write($e->getMessage());  | 
            ||
| 36 | echo "[-] CreateEnvJob failed" . PHP_EOL;  | 
            ||
| 37 | throw $e;  | 
            ||
| 38 | }  | 
            ||
| 39 | |||
| 40 | 		$this->updateStatus('Finished'); | 
            ||
| 41 | echo "[-] CreateEnvJob finished" . PHP_EOL;  | 
            ||
| 42 | }  | 
            ||
| 43 | |||
| 67 | 
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state