GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f9a184...b81ec7 )
by Andreas
04:10
created

ExportCustomerObserver   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A execute() 0 10 2
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Observer\Customer;
7
8
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
9
use CommerceLeague\ActiveCampaign\Service\ExportCustomerService;
10
use Magento\Customer\Model\Customer as MagentoCustomer;
11
use Magento\Framework\Event\Observer;
12
use Magento\Framework\Event\ObserverInterface;
13
14
/**
15
 * Class ExportCustomerObserver
16
 */
17
class ExportCustomerObserver implements ObserverInterface
18
{
19
    /**
20
     * @var ConfigHelper
21
     */
22
    private $configHelper;
23
24
    /**
25
     * @var ExportCustomerService
26
     */
27
    private $exportCustomerService;
28
29
    /**
30
     * @param ConfigHelper $configHelper
31
     * @param ExportCustomerService $exportCustomerService
32
     */
33
    public function __construct(
34
        ConfigHelper $configHelper,
35
        ExportCustomerService $exportCustomerService
36
    ) {
37
        $this->configHelper = $configHelper;
38
        $this->exportCustomerService = $exportCustomerService;
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function execute(Observer $observer)
45
    {
46
        if (!$this->configHelper->isApiEnabled()) {
47
            return;
48
        }
49
50
        /** @var MagentoCustomer $magentoCustomer */
51
        $magentoCustomer = $observer->getEvent()->getData('customer');
52
53
        $this->exportCustomerService->export($magentoCustomer);
54
    }
55
}
56