Skip to content

Commit 3a9750d

Browse files
committed
Remove unused imports
1 parent 5561056 commit 3a9750d

File tree

5 files changed

+31
-52
lines changed

5 files changed

+31
-52
lines changed

Model/Config/Entity/Erasure.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ public function getAllowedStatesToErase(int|string|null $website = null): array
5353
));
5454
}
5555

56-
/**
57-
* @return int
58-
*/
5956
public function getDelay(): int
6057
{
61-
return (int)$this->scopeConfig->getValue(self::CONFIG_PATH_ERASURE_DELAY, ScopeInterface::SCOPE_WEBSITE);
58+
return (int)$this->scopeConfig->getValue(self::CONFIG_PATH_ERASURE_DELAY);
6259
}
6360
}

Model/Customer/Notifier/MailSender.php

+13-10
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,20 @@ public function __construct(
3939
public function send(CustomerInterface $customer): void
4040
{
4141
$delay = $this->erasureConfig->getDelay();
42-
4342
$storeId = $customer->getStoreId() === null ? null : (int)$customer->getStoreId();
44-
$vars = [
45-
'delay' => $delay !== 0 ? $delay / 60 : 0,
46-
'customer' => $customer,
47-
'store' => $this->storeManager->getStore($customer->getStoreId()),
48-
'customer_data' => [
49-
'customer_name' => $this->customerViewHelper->getCustomerName($customer),
50-
],
51-
];
5243

53-
$this->sendMail($customer->getEmail(), $this->customerViewHelper->getCustomerName($customer), $storeId, $vars);
44+
$this->sendMail(
45+
$customer->getEmail(),
46+
$this->customerViewHelper->getCustomerName($customer),
47+
$storeId,
48+
[
49+
'delay' => $delay !== 0 ? $delay / 60 : 0,
50+
'customer' => $customer,
51+
'store' => $this->storeManager->getStore($storeId),
52+
'customer_data' => [
53+
'customer_name' => $this->customerViewHelper->getCustomerName($customer),
54+
]
55+
]
56+
);
5457
}
5558
}

Model/Customer/SourceProvider/IdleFilterModifier.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
class IdleFilterModifier implements ModifierInterface
1717
{
18-
public function __construct(
19-
private ErasureConfig $erasureConfig
20-
) {}
18+
public function __construct(private ErasureConfig $erasureConfig) {}
2119

2220
/**
2321
* @throws Exception

Model/EraseEntityManagement.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Opengento\Gdpr\Model;
99

1010
use Exception;
11-
use Magento\Framework\App\Config\ScopeConfigInterface;
1211
use Magento\Framework\Exception\CouldNotSaveException;
1312
use Magento\Framework\Exception\LocalizedException;
1413
use Magento\Framework\Phrase;
@@ -28,7 +27,6 @@ public function __construct(
2827
private EraseEntityInterfaceFactory $eraseEntityFactory,
2928
private EraseEntityRepositoryInterface $eraseRepository,
3029
private ProcessorFactory $processorFactory,
31-
private ScopeConfigInterface $scopeConfig,
3230
private DateTime $localeDate
3331
) {}
3432

@@ -40,7 +38,7 @@ public function create(int $entityId, string $entityType): EraseEntityInterface
4038
$entity->setEntityType($entityType);
4139
$entity->setState(EraseEntityInterface::STATE_PENDING);
4240
$entity->setStatus(EraseEntityInterface::STATUS_READY);
43-
$entity->setScheduledAt($this->retrieveScheduledAt());
41+
$entity->setScheduledAt($this->createScheduledAt());
4442

4543
return $this->eraseRepository->save($entity);
4644
}
@@ -90,7 +88,7 @@ private function fail(EraseEntityInterface $entity, ?string $message = null): Er
9088
return $this->eraseRepository->save($entity);
9189
}
9290

93-
private function retrieveScheduledAt(): string
91+
private function createScheduledAt(): string
9492
{
9593
return $this->localeDate->gmtDate(
9694
DateTimeFormat::DATETIME_PHP_FORMAT,

Model/Order/Notifier/MailSender.php

+14-31
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,38 @@
1414
use Magento\Sales\Api\Data\OrderInterface;
1515
use Magento\Store\Model\StoreManagerInterface;
1616
use Opengento\Gdpr\Model\Notifier\AbstractMailSender;
17-
use Psr\Log\LoggerInterface;
1817

1918
class MailSender extends AbstractMailSender implements SenderInterface
2019
{
21-
/**
22-
* @var LoggerInterface
23-
*/
24-
private LoggerInterface $logger;
25-
26-
/**
27-
* @var StoreManagerInterface
28-
*/
29-
private StoreManagerInterface $storeManager;
30-
3120
public function __construct(
32-
LoggerInterface $logger,
21+
private StoreManagerInterface $storeManager,
3322
TransportBuilder $transportBuilder,
3423
ScopeConfigInterface $scopeConfig,
35-
StoreManagerInterface $storeManager,
3624
array $configPaths
3725
) {
38-
$this->logger = $logger;
39-
$this->storeManager = $storeManager;
4026
parent::__construct($transportBuilder, $scopeConfig, $configPaths);
4127
}
4228

4329
/**
44-
* @inheritdoc
4530
* @throws LocalizedException
4631
* @throws MailException
4732
*/
4833
public function send(OrderInterface $order): void
4934
{
5035
$storeId = $order->getStoreId() === null ? null : (int)$order->getStoreId();
51-
$vars = [
52-
'order' => $order,
53-
'billing' => $order->getBillingAddress(),
54-
'store' => $this->storeManager->getStore($order->getStoreId()),
55-
'customer_data' => [
56-
'customer_name' => $order->getCustomerName(),
57-
],
58-
];
59-
60-
try {
61-
$this->sendMail($order->getCustomerEmail(), $order->getCustomerName(), $storeId, $vars);
62-
$this->logger->debug(__('GDPR Email Success'));
63-
} catch (MailException $exc) {
64-
$this->logger->error(__('GDPR Email Error: %1', $exc->getMessage()));
65-
}
6636

37+
$this->sendMail(
38+
$order->getCustomerEmail(),
39+
$order->getCustomerName(),
40+
$storeId,
41+
[
42+
'order' => $order,
43+
'billing' => $order->getBillingAddress(),
44+
'store' => $this->storeManager->getStore($storeId),
45+
'customer_data' => [
46+
'customer_name' => $order->getCustomerName(),
47+
]
48+
]
49+
);
6750
}
6851
}

0 commit comments

Comments
 (0)