Acquia\CloudApi\Client\CloudApi::getInstance PHP Method

getInstance() public static method

Returns an instance of CloudApi, reusing a previous one if available.
public static getInstance ( $site_name = NULL, $stage = NULL, $creds_filename = NULL ) : CloudApi
$site_name The name of the site for which credentials should be used.
$stage Optional. If provided a file with the suffix matching the stage will be used rather than the default cloudapi.ini file.
return CloudApi An instance of the CloudApi class.
    public static function getInstance($site_name = NULL, $stage = NULL, $creds_filename = NULL)
    {
        // Not thread-safe, but doesn't need to be.
        if (!isset(self::$instances[$site_name][$stage][$creds_filename])) {
            self::$instances[$site_name][$stage][$creds_filename] = new CloudApi($site_name, $stage, $creds_filename);
        }
        return self::$instances[$site_name][$stage][$creds_filename];
    }