public function getCurrentDeployment(Environment $environment, $refresh = false)
    {
        $cacheKey = implode(':', ['current-deployment', $environment->project, $environment->id]);
        $data = $this->cache->fetch($cacheKey);
        if ($data === false || $refresh) {
            $deployment = $environment->getCurrentDeployment();
            $data = $deployment->getData();
            $data['_uri'] = $deployment->getUri();
            $this->cache->save($cacheKey, $data, $this->config->get('api.environments_ttl'));
        } else {
            $deployment = new EnvironmentDeployment($data, $data['_uri'], $this->getHttpClient(), true);
        }

        return $deployment;
    }
public function getCurrentDeployment(Environment $environment, $refresh = false)
    {
        $cacheKey = implode(':', ['current-deployment', $environment->project, $environment->id]);
        $data = $this->cache->fetch($cacheKey);
        if ($data === false || $refresh) {
            $deployment = $environment->getCurrentDeployment();
            $data = $deployment->getData();
            $data['_uri'] = $deployment->getUri();
            $this->cache->save($cacheKey, $data, $this->config->get('api.environments_ttl'));
        } else {
            $deployment = new EnvironmentDeployment($data, $data['_uri'], $this->getHttpClient(), true);
        }

        return $deployment;
    }
public function getCurrentDeployment ( Environment $ environment , $ refresh = false ) { $ cacheKey = implode ( ':' , [ 'current-deployment' , $ environment -> project , $ environment -> id ] ) ; $ data = $ this -> cache -> fetch ( $ cacheKey ) ; if ( $ data === false || $ refresh ) { $ deployment = $ environment -> getCurrentDeployment ( ) ; $ data = $ deployment -> getData ( ) ; $ data [ '_uri' ] = $ deployment -> getUri ( ) ; $ this -> cache -> save ( $ cacheKey , $ data , $ this -> config -> get ( 'api.environments_ttl' ) ) ; } else { $ deployment = new EnvironmentDeployment ( $ data , $ data [ '_uri' ] , $ this -> getHttpClient ( ) , true ) ; } return $ deployment ; }
Get the current deployment for an environment.

@param Environment $environment
@param bool        $refresh

@return EnvironmentDeployment
Get the current deployment for an environment .