@param string $site
@param string $env

@return \Acquia\Cloud\Api\Response\Domains

@throws \Guzzle\Http\Exception\ClientErrorResponseException

@see http://cloudapi.acquia.com/#GET__sites__site_envs__env_domains-instance_route
11729
public function domains($site, $env)
    {
        $variables = array(
            'site' => $site,
            'env' => $env,
        );
        $request = $this->get(array('{+base_path}/sites/{site}/envs/{env}/domains.json', $variables));
        return new Response\Domains($request);
    }
1194796
public function getKeys($env, $prefix = null)
	{
		$this->validateEnvironment($env);

		$env  = $env === self::APP ? self::EXT : self::APP;
		$keys = array_keys($this->definitions[$env]);

		if ($prefix !== null) {
			$keys = array_map(function ($key) use ($prefix) {
				return $prefix . $key;
			}, $keys);
		}

		return $keys;
	}
1062799
public function getSiteById($idSite, $env, $includeSite404Table = false)
	{
        // Retrieve cache version if front mode to avoid multiple calls
	    $cacheKey = get_class($this) . '_getSiteById_' . $idSite . '_' . $env . '_' . $includeSite404Table;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->getServiceLocator()->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	    
		$select = $this->tableGateway->getSql()->select();
		
		$select->columns(array('*'));
	
		$siteDomainjoin = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id AND sdom_env =\''.$env.'\'');
		
		if($includeSite404Table) {
		    
		    $site404join = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id');
		    
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT)
		           ->join('melis_cms_site_404', $site404join, array('*'), $select::JOIN_LEFT);
		}
		else {
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT);
		}
		
		$select->where('site_id ='.$idSite);
	
		$resultSet = $this->tableGateway->selectWith($select);

		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $resultSet);
		
		return $resultSet;
	}
587016
public function disableLiveDev($site, $env, $discard = false)
    {
        return $this->liveDev($site, $env, self::LIVEDEV_DISABLE, $discard);
    }
861019
public function evaluate(EnvironmentInterface $env)
    {
        $qb = $env->queryBuilder;

        $paramTemplate = $env->newParamName();
        $paramValue = $env->newParamName();
        $paramVs = $env->newParamName();

        $rootAliases = $qb->getRootAliases();
        
        $qb->innerJoin($rootAliases[0] . '.valueSet', $paramVs)
            ->innerJoin($paramVs . '.template', $paramTemplate);

        switch ($this->operator) {
            case 'in':
                $qb->andWhere($paramTemplate . '.id IN (:' . $paramValue . ')');
                break;
            case 'notin':
                $qb->andWhere($paramTemplate . '.id NOT IN (:' . $paramValue . ')');
                break;
        }

        $qb->setParameter($paramValue, $this->getRight()->getValue());
    }
912491
protected function buildSiteApiResponse(Site $site)
    {
        $siteApiResponse = new SiteApiResponse(Tracking::UNKNOWN_AUTHOR);

        $siteApiResponse->populateFromObject($site);

        return $siteApiResponse;
    }
463133
static function getConfiguration(array $env): Configuration {
    $nodes = (int) ($env['CIRCLE_NODE_TOTAL'] ?? '0');
    return new Configuration([
      'commit_sha' => $env['CIRCLE_SHA1'] ?? null,
      'parallel' => $nodes > 1 ? 'true' : 'false',
      'service_branch' => $env['CIRCLE_BRANCH'] ?? null,
      'service_build_url' => $env['CIRCLE_BUILD_URL'] ?? null,
      'service_job_number' => $env['CIRCLE_NODE_INDEX'] ?? null,
      'service_name' => 'circleci',
      'service_number' => $env['CIRCLE_BUILD_NUM'] ?? null
    ]);
  }
198133
public function getoneConfigActivity(string $env):Renderer
    {
        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined environment $env", "solution" =>
            "Environment must be [dev or prod]")));
        }

        $file = (array) JL::open(FEnv::get("framework.config").'hosts/hosts.'.$env.'.json');
        if (!(isset($file['allowed'])) || !(isset($file['denied']))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined key allowed or denied in host.dev.json",
                "solution" => "Add the correct tags [allowed, denied]")));
        }

        $allowed = ((array)$file['allowed']);
        $denied = ((array)$file['denied']);


        return ((new Renderer())->jsonRenderer(array("code" => 200,
            "results" => array("allowed" => implode(";", $allowed), "denied" => implode(";", $denied)))));
    }
539269
public function setEnv($env = null)
    {
        if (in_array($env, \WebServCo\Framework\Environment::getOptions())) {
            $this->env = $env;
        } else {
            $this->env = \WebServCo\Framework\Environment::ENV_DEV;
        }

        return true;
    }
49674
public function collectEnvVars(array $env)
    {
        $envCollector = new CiEnvVarsCollector($this->config);

        try {
            $this->jsonFile->fillJobs($envCollector->collect($env));
        } catch (\PhpCoveralls\Bundle\CoverallsBundle\Entity\Exception\RequirementsNotSatisfiedException $e) {
            $e->setReadEnv($envCollector->getReadEnv());

            throw $e;
        }

        return $this;
    }
462018
static function getConfiguration(array $env): Configuration {
    return new Configuration([
      'commit_sha' => $env['CI_BUILD_REF'] ?? null,
      'service_branch' => $env['CI_BUILD_REF_NAME'] ?? null,
      'service_job_id' => $env['CI_BUILD_ID'] ?? null,
      'service_job_number' => $env['CI_BUILD_NAME'] ?? null,
      'service_name' => 'gitlab-ci'
    ]);
  }
931552
static function getConfiguration(array $env): Configuration {
    $repoName = $env['APPVEYOR_REPO_NAME'] ?? null;
    $serviceNumber = $env['APPVEYOR_BUILD_VERSION'] ?? null;

    return new Configuration([
      'commit_sha' => $env['APPVEYOR_REPO_COMMIT'] ?? null,
      'git_author_email' => $env['APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL'] ?? null,
      'git_author_name' => $env['APPVEYOR_REPO_COMMIT_AUTHOR'] ?? null,
      'git_message' => $env['APPVEYOR_REPO_COMMIT_MESSAGE'] ?? null,
      'service_branch' => $env['APPVEYOR_REPO_BRANCH'] ?? null,
      'service_build_url' => $repoName && $serviceNumber ? "https://ci.appveyor.com/project/$repoName/build/$serviceNumber" : null,
      'service_job_id' => $env['APPVEYOR_BUILD_ID'] ?? null,
      'service_job_number' => $env['APPVEYOR_BUILD_NUMBER'] ?? null,
      'service_name' => 'appveyor',
      'service_number' => $serviceNumber
    ]);
  }
329730
private function downloadPantheonBackup($env) {
    $project_properties = $this->getProjectProperties();
    $terminus_site_env  = $this->getPantheonSiteEnv($env);

    $terminus_url_request = $this->taskExec('terminus backup:get ' . $terminus_site_env . ' --element="db"')
      ->dir($project_properties['web_root'])
      ->interactive(false)
      ->run();

    if ($terminus_url_request->wasSuccessful()) {
      $terminus_url = $terminus_url_request->getMessage();
    }
    else {
      $this->yell('Failed to find a recent backup for the ' . $terminus_site_env . ' site. Does one exist?');
      return FALSE;
    }

    $wget_database = $this->taskExec('wget -O vendor/database.sql.gz "' . trim($terminus_url) . '"')->run();

    if (!$wget_database->wasSuccessful()) {
      $this->yell('Remote database sync failed.');
      return FALSE;
    }

    return TRUE;
  }
751740
public function getKey($env, $key)
	{
		$map = $this->getMap($env);

		return isset($map[$key]) ? $map[$key] : null;
	}
303023
private function createV1Website($name, $ipAddress, $https, array $domains, array...$siteApps)
    {

        return $this->send('create_website', $name, $ipAddress, $https, $domains, ...$siteApps);
    }
340484
public function updateActivity(string $env):Renderer
    {
        $allowed     = $this->get("request")->get("allowed");
        $denied     = $this->get("request")->get("denied");

        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined environment $env", "solution" =>
                "Environment must be [dev or prod]")));
        }

        if (trim($allowed) == "" || trim($denied) == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Error on hosts parameters")));
        }


        $allowed = (object)(explode(";", $allowed));
        $denied = (object)(explode(";", $denied));

        $a = new \stdClass();
        $a->allowed = $allowed;
        $a->denied = $denied;

        JL::put(
            FEnv::get("framework.config").'hosts/hosts.'.$env.'.json',
            json_encode($a, JSON_PRETTY_PRINT)
        );

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
961086
private function _parseInterceptMap($env)
    {
        // Set up authN/authZ if an URL mapping was given.
        if (isset($env['auth.interceptUrlMap']) && is_array($env['auth.interceptUrlMap'])) {
            // We may need to modify the intercept map, so make a copy of it
            $interceptMap = $env['auth.interceptUrlMap'];

            // Always allow HEAD requests unless the user specifically blocked them
            if (!array_key_exists('HEAD', $interceptMap)) {
                $interceptMap['HEAD'] = ['/**' => ['authN' => 'permitAll', 'authZ' => 'permitAll']];
            }

            // If the request method is not in the Intercept Map, throw an exception
            if (!array_key_exists($env['REQUEST_METHOD'], $interceptMap)) {
                throw new \Exception(
                    "Request Type: " . $env['REQUEST_METHOD'] . " does not exist in Auth Intercept Map"
                );
            }

            $antPathMatcher = new AntPathMatcher();
            foreach ($interceptMap[$env['REQUEST_METHOD']] as $pattern => $auth_array) {
                // Break out of the foreach loop if this URL matches the pattern.
                if ($antPathMatcher->match($pattern, $env['PATH_INFO'])) {
                    $this->authN_type = $auth_array['authN'];
                    $this->authZ_roles = $auth_array['authZ'];
                    break;
                }
            }
        }
    }