Sindbad~EG File Manager

Current Path : /opt/nginxhttpd_/src/MessageHandler/
Upload File :
Current File : //opt/nginxhttpd_/src/MessageHandler/InstalledSslHandler.php

<?php

namespace App\MessageHandler;

use GuzzleHttp\Client;
use O2switch\CpanelLib\Client\NginxVarnish;
use O2switch\CpanelLib\Message\InstalledSslMessage;
use Psr\Log\LoggerInterface;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;

class InstalledSslHandler implements MessageHandlerInterface
{

    /** @var NginxVarnish */
    private $client;

    public function __construct(LoggerInterface $logger){
         $this->client = new NginxVarnish(new Client(), $logger);
    }

    public function __invoke(InstalledSslMessage $m){
        $vhost = $m->getApiVhost();
        // cPanel bug....
        $vhost->setSslKeyFile(
            str_replace(['PRIVATEKEY', 'BEGINRSA'], ['PRIVATE KEY', 'BEGIN RSA'], $vhost->getSslKeyFile())
        );
        $this->client
            ->setConfig($m->getConfig())
            ->configureVhost('nginx', $vhost);
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists