Pantheon\Terminus\Site\SiteAwareTrait::getOptionalSiteEnv PHP Method

getOptionalSiteEnv() public method

Get the site and environment with the given ids, if provided
public getOptionalSiteEnv ( string $site_env_id ) : array
$site_env_id string The site/environment id in the form [[.]]
return array The site and environment in an array, if provided; may return [null, null]
    public function getOptionalSiteEnv($site_env_id)
    {
        if (empty($site_env_id)) {
            return [null, null];
        }
        list($site_id, $env_id) = array_pad(explode('.', $site_env_id), 2, null);
        $site = $this->getSite($site_id);
        $env = !empty($env_id) ? $site->getEnvironments()->get($env_id) : null;
        return [$site, $env];
    }