Skip to content

Commit

Permalink
WIP: SF5 Compatibility, Drop FOS USER
Browse files Browse the repository at this point in the history
  • Loading branch information
BadPixxel committed Sep 27, 2023
1 parent 49973f1 commit 256279c
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 46 deletions.
18 changes: 9 additions & 9 deletions src/SendinblueBridgeBundle.php → src/BrevoBridgeBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge;
namespace BadPixxel\BrevoBridge;

use BadPixxel\SendinblueBridge\Services\EventManager;
use BadPixxel\SendinblueBridge\Services\SmsManager;
use BadPixxel\SendinblueBridge\Services\SmtpManager;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* A Small Bundle to Manage Sending User Email, Events & Sms via Sendinblue Transactional API.
*/
class SendinblueBridgeBundle extends Bundle
class BrevoBridgeBundle extends Bundle
{
/**
* @return void
*/
public function boot()
public function boot(): void
{
if (!$this->container) {
return;
}
//==============================================================================
// Force Loading of SendInBlue Smtp Service
$this->container->get(SmtpManager::class);
$this->container->get(Services\SmtpManager::class);
//==============================================================================
// Force Loading of SendInBlue Events Service
$this->container->get(EventManager::class);
$this->container->get(Services\EventManager::class);
//==============================================================================
// Force Loading of SendInBlue Sms Service
$this->container->get(SmsManager::class);
$this->container->get(Services\SmsManager::class);
}
}
15 changes: 8 additions & 7 deletions src/Services/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,22 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Services;
namespace BadPixxel\BrevoBridge\Services;

use BadPixxel\SendinblueBridge\Services\ConfigurationManager as Configuration;
use BadPixxel\BrevoBridge\Models\Managers\ErrorLoggerTrait;
use BadPixxel\BrevoBridge\Services\ConfigurationManager as Configuration;
use Brevo\Client\Api\AccountApi;
use Brevo\Client\ApiException;
use Brevo\Client\Model\GetAccount;
use Exception;
use GuzzleHttp\Client;
use SendinBlue\Client\Api\AccountApi;
use SendinBlue\Client\ApiException;
use SendinBlue\Client\Model\GetAccount;

/**
* Account Manager for SendingBlue Api.
* Account Manager for Brevo Api.
*/
class AccountManager
{
use \BadPixxel\SendinblueBridge\Models\Managers\ErrorLoggerTrait;
use ErrorLoggerTrait;

/**
* @var AccountApi
Expand Down
24 changes: 12 additions & 12 deletions src/Services/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,45 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Services;
namespace BadPixxel\BrevoBridge\Services;

use SendinBlue\Client\Configuration;
use SendinBlue\Client\Model\SendSmtpEmailReplyTo;
use SendinBlue\Client\Model\SendSmtpEmailSender;
use Brevo\Client\Configuration;
use Brevo\Client\Model\SendSmtpEmailReplyTo;
use Brevo\Client\Model\SendSmtpEmailSender;
use Symfony\Component\Routing\RouterInterface as Router;

/**
* Bridge Configuration Manager for SendingBlue Api.
* Bridge Configuration Manager for Brevo Api.
*/
class ConfigurationManager
{
/**
* @var array
*/
private $config;
private array $config;

/**
* @var null|Configuration
*/
private $sdkConfig;
private ?Configuration $sdkConfig;

/**
* @var null|array
*/
private $eventsCurlConfig;
private ?array $eventsCurlConfig;

/**
* @var bool
*/
private $enabled;
private bool $enabled;

/**
* @param array $configuration
* @param bool $disabled
*/
public function __construct(array $configuration, bool $disabled)
public function __construct(array $configuration)
{
$this->config = $configuration;
$this->enabled = !$disabled;
$this->enabled = empty($configuration['disable_emails']);
}

/**
Expand Down Expand Up @@ -86,6 +85,7 @@ public function getEventsCurlConfig(): array
if (empty($this->config["track_key"])) {
return $this->eventsCurlConfig = array();
}

//==============================================================================
// Generate Curl Options Array
return $this->eventsCurlConfig = array(
Expand Down
11 changes: 6 additions & 5 deletions src/Services/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Services;
namespace BadPixxel\BrevoBridge\Services;

use BadPixxel\SendinblueBridge\Models\AbstractTrackEvent;
use BadPixxel\SendinblueBridge\Services\ConfigurationManager as Configuration;
use BadPixxel\BrevoBridge\Models\AbstractTrackEvent;
use BadPixxel\BrevoBridge\Models\Managers\ErrorLoggerTrait;
use BadPixxel\BrevoBridge\Services\ConfigurationManager as Configuration;
use Exception;

/**
* Tracker Events Manager for SendingBlue Api.
* Tracker Events Manager for Brevo Api.
*/
class EventManager
{
use \BadPixxel\SendinblueBridge\Models\Managers\ErrorLoggerTrait;
use ErrorLoggerTrait;

/**
* Bridge Configuration.
Expand Down
24 changes: 13 additions & 11 deletions src/Services/TemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,26 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Services;

use BadPixxel\SendinblueBridge\Helpers\MjmlConverter;
use BadPixxel\SendinblueBridge\Interfaces\HtmlTemplateProviderInterface;
use BadPixxel\SendinblueBridge\Interfaces\MjmlTemplateProviderInterface;
use BadPixxel\SendinblueBridge\Services\ConfigurationManager as Configuration;
namespace BadPixxel\BrevoBridge\Services;

use BadPixxel\BrevoBridge\Helpers\MjmlConverter;
use BadPixxel\BrevoBridge\Interfaces\HtmlTemplateProviderInterface;
use BadPixxel\BrevoBridge\Interfaces\MjmlTemplateProviderInterface;
use BadPixxel\BrevoBridge\Models\Managers\ErrorLoggerTrait;
use BadPixxel\BrevoBridge\Services\ConfigurationManager as Configuration;
use Brevo\Client\Api\TransactionalEmailsApi;
use Brevo\Client\ApiException;
use Brevo\Client\Model\UpdateSmtpTemplate;
use Exception;
use GuzzleHttp\Client;
use SendinBlue\Client\Api\TransactionalEmailsApi;
use SendinBlue\Client\ApiException;
use SendinBlue\Client\Model\UpdateSmtpTemplate;
use Symfony\Component\Security\Core\User\UserInterface as User;

/**
* Emails Templates Manager for SendingBlue Api.
* Emails Templates Manager for Brevo Api.
*/
class TemplateManager
{
use \BadPixxel\SendinblueBridge\Models\Managers\ErrorLoggerTrait;
use ErrorLoggerTrait;

/**
* Smtp API Service.
Expand Down Expand Up @@ -178,6 +179,7 @@ public function getMjmlConverter(): ?MjmlConverter
if (!$this->config->isMjmlAllowed()) {
return $this->setError("Mjml Api is not configured");
}

//==============================================================================
// Build Mjml Converter
return new MjmlConverter(
Expand Down
4 changes: 2 additions & 2 deletions src/Templates/TestUserEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
* file that was distributed with this source code.
*/

namespace BadPixxel\SendinblueBridge\Templates;
namespace BadPixxel\BrevoBridge\Templates;

use BadPixxel\SendinblueBridge\Models\AbstractEmail;
use BadPixxel\BrevoBridge\Models\AbstractEmail;
use Sonata\UserBundle\Model\UserInterface as User;

/**
Expand Down

0 comments on commit 256279c

Please sign in to comment.