save() public method

Save a given string into a given path handling backup.
public save ( string $path, string $content, string $visibility = self::VISIBILITY_PRIVATE )
$path string
$content string
$visibility string The visibilty to use for this file.
 /**
  * {@inheritdoc}
  */
 public function handle($config, CertificateResponse $response)
 {
     $domain = $response->getCertificateRequest()->getDistinguishedName()->getCommonName();
     $privateKey = $response->getCertificateRequest()->getKeyPair()->getPrivateKey();
     $certificate = $response->getCertificate();
     $this->repository->save('nginxproxy/' . $domain . '.key', $this->serializer->serialize($privateKey, PemEncoder::FORMAT));
     // Simple certificate
     $certPem = $this->serializer->serialize($certificate, PemEncoder::FORMAT);
     // Issuer chain
     $issuerChain = [];
     $issuerCertificate = $certificate->getIssuerCertificate();
     while (null !== $issuerCertificate) {
         $issuerChain[] = $this->serializer->serialize($issuerCertificate, PemEncoder::FORMAT);
         $issuerCertificate = $issuerCertificate->getIssuerCertificate();
     }
     $chainPem = implode("\n", $issuerChain);
     // Full chain
     $fullChainPem = $certPem . $chainPem;
     $this->repository->save('nginxproxy/' . $domain . '.crt', $fullChainPem);
 }