Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Aug 30, 2024
1 parent 521a53b commit d55fbf9
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 12 deletions.
10 changes: 3 additions & 7 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@

use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');

$params = $ecsConfig->parameters();

$params->set(Option::PATHS, [
$ecsConfig->paths([
'src',
'tests/Behat',
'tests/Integration',
'tests/Stub',
]);
$ecsConfig->skip(['src/Kernel.php']);

$ecsConfig->parameters()->set(Option::SKIP, [
$ecsConfig->skip([
'src/Kernel.php',
VisibilityRequiredFixer::class => ['*Spec.php'],
]);
};
3 changes: 2 additions & 1 deletion src/MessageHandler/Connection/ConnectionCreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function __invoke(ConnectionCreate $message): void
if ($activeCampaignId !== null) {
throw new InvalidArgumentException(sprintf('The Channel with id "%s" has been already created on ActiveCampaign on the connection with id "%s"', $channelId, $activeCampaignId));
}
try{

try {
$createConnectionResponse = $this->activeCampaignConnectionClient->create($this->connectionMapper->mapFromChannel($channel));
} catch (\Throwable $e) {
$this->logger?->error($e->getMessage(), $e->getTrace());
Expand Down
1 change: 1 addition & 0 deletions src/MessageHandler/Connection/ConnectionUpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function __invoke(ConnectionUpdate $message): void
if ($activeCampaignId !== $message->getActiveCampaignId()) {
throw new InvalidArgumentException(sprintf('The Channel with id "%s" has an ActiveCampaign id that does not match. Expected "%s", given "%s".', $channelId, $message->getActiveCampaignId(), (string) $activeCampaignId));
}

try {
$this->activeCampaignConnectionClient->update($message->getActiveCampaignId(), $this->connectionMapper->mapFromChannel($channel));
} catch (\Throwable $e) {
Expand Down
1 change: 1 addition & 0 deletions src/MessageHandler/Contact/ContactCreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function __invoke(ContactCreate $message): void
if ($activeCampaignId !== null) {
throw new InvalidArgumentException(sprintf('The Customer with id "%s" has been already created on ActiveCampaign on the contact with id "%s"', $customerId, $activeCampaignId));
}

try {
$createContactResponse = $this->activeCampaignContactClient->create($this->contactMapper->mapFromCustomer($customer));
$activeCampaignContactId = $createContactResponse->getResourceResponse()->getId();
Expand Down
3 changes: 2 additions & 1 deletion src/MessageHandler/Contact/ContactUpdateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function __invoke(ContactUpdate $message): void
if ($activeCampaignId !== $message->getActiveCampaignId()) {
throw new InvalidArgumentException(sprintf('The Customer with id "%s" has an ActiveCampaign id that does not match. Expected "%s", given "%s".', $customerId, $message->getActiveCampaignId(), (string) $activeCampaignId));
}
try{

try {
$this->activeCampaignContactClient->update($message->getActiveCampaignId(), $this->contactMapper->mapFromCustomer($customer));
} catch (\Throwable $e) {
$this->logger?->error($e->getMessage(), $e->getTrace());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function __invoke(EcommerceCustomerCreate $message): void

throw new InvalidArgumentException(sprintf('The Customer with id "%s" has been already created on ActiveCampaign on the EcommerceCustomer with id "%s"', $customerId, $activeCampaignId));
}

try {
$response = $this->activeCampaignClient->create($this->ecommerceCustomerMapper->mapFromCustomerAndChannel($customer, $channel));
} catch (\Throwable $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function __invoke(EcommerceCustomerUpdate $message): void
if ($activeCampaignId !== $message->getActiveCampaignId()) {
throw new InvalidArgumentException(sprintf('The Customer with id "%s" has an ActiveCampaign id that does not match. Expected "%s", given "%s".', $customerId, $message->getActiveCampaignId(), (string) $activeCampaignId));
}

try {
$this->activeCampaignClient->update($message->getActiveCampaignId(), $this->ecommerceCustomerMapper->mapFromCustomerAndChannel($customer, $channel));
} catch (\Throwable $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function __invoke(EcommerceOrderCreate $message): void
if ($activeCampaignId !== null) {
throw new InvalidArgumentException(sprintf('The Order with id "%s" has been already created on ActiveCampaign on the ecommerce order with id "%s"', $orderId, $activeCampaignId));
}

try {
$response = $this->activeCampaignEcommerceOrderClient->create($this->ecommerceOrderMapper->mapFromOrder($order, $message->isInRealTime()));
} catch (\Throwable $e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function __invoke(EcommerceOrderUpdate $message): void
if ($activeCampaignId !== $message->getActiveCampaignId()) {
throw new InvalidArgumentException(sprintf('The Order with id "%s" has an ActiveCampaign id that does not match. Expected "%s", given "%s".', $orderId, $message->getActiveCampaignId(), (string) $activeCampaignId));
}

try {
$this->activeCampaignEcommerceOrderClient->update($message->getActiveCampaignId(), $this->ecommerceOrderMapper->mapFromOrder($order, $message->isInRealTime()));
} catch (\Throwable $e) {
Expand Down
1 change: 1 addition & 0 deletions src/MessageHandler/Webhook/WebhookCreateHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public function __invoke(WebhookCreate $message): void
if ($activeCampaignListId === null) {
throw new InvalidArgumentException(sprintf('The Channel with id "%s" does not have an ActiveCampaign list id.', $channelId));
}

try {
$this->activeCampaignWebhookClient->create($this->webhookMapper->map(
sprintf('Update Sylius newsletter subscription to list "%s"', $activeCampaignListId),
Expand Down
2 changes: 1 addition & 1 deletion src/WebgriffeSyliusActiveCampaignPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Webgriffe\SyliusActiveCampaignPlugin;

use function dirname;
use Sylius\Bundle\CoreBundle\Application\SyliusPluginTrait;
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use function dirname;

final class WebgriffeSyliusActiveCampaignPlugin extends AbstractResourceBundle
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private static function getMessageFromCustomerTypeAndChannel(
array $messages,
CustomerInterface $customer,
string $messageClass,
ChannelInterface $channel = null
ChannelInterface $channel = null,
): Envelope {
$messages = array_filter($messages, static function (Envelope $envelope) use ($customer, $messageClass, $channel) {
$message = $envelope->getMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static function getMessageFromCustomerTypeAndChannel(
array $messages,
CustomerInterface $customer,
string $messageClass,
ChannelInterface $channel = null
ChannelInterface $channel = null,
): Envelope {
$messages = array_filter($messages, static function (Envelope $envelope) use ($customer, $messageClass, $channel) {
$message = $envelope->getMessage();
Expand Down

0 comments on commit d55fbf9

Please sign in to comment.