DNCreateEnvironment::getBackend PHP Method

getBackend() public method

Fetches the EnvironmentCreateBackend based on the EnvironmentType saved to this job.
public getBackend ( ) : EnvironmentCreateBackend | null
return EnvironmentCreateBackend | null
    public function getBackend()
    {
        $data = unserialize($this->Data);
        if (isset($data['EnvironmentType']) && class_exists($data['EnvironmentType'])) {
            $env = Injector::inst()->get($data['EnvironmentType']);
            if ($env instanceof EnvironmentCreateBackend) {
                return $env;
            } else {
                throw new Exception("Invalid backend: " . $data['EnvironmentType']);
            }
        }
        return null;
    }