Pantheon\Terminus\Models\Environment::setHttpsCertificate PHP Method

setHttpsCertificate() public method

Add/replace an HTTPS certificate on the environment
public setHttpsCertificate ( array $certificate = [] )
$certificate array Certificate data elements as follow string cert Certificate string key RSA private key string intermediary CA intermediate certificate(s)
    public function setHttpsCertificate($certificate = [])
    {
        // Weed out nulls
        $params = array_filter($certificate, function ($param) {
            $is_not_null = !is_null($param);
            return $is_not_null;
        });
        $response = $this->request()->request(sprintf('sites/%s/environments/%s/add-ssl-cert', $this->getSite()->id, $this->id), ['method' => 'post', 'form_params' => $params]);
        // The response to the PUT is actually a workflow
        $workflow_data = $response['data'];
        $workflow = $this->getContainer()->get(Workflow::class, [$workflow_data, ['environment' => $this]]);
        return $workflow;
    }