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

ExportContactObserver::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
namespace CommerceLeague\ActiveCampaign\Observer\Customer;
6
7
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
8
use CommerceLeague\ActiveCampaign\Service\ExportContactService;
9
use Magento\Customer\Model\Customer;
10
use Magento\Framework\Event\Observer;
11
use Magento\Framework\Event\ObserverInterface;
12
13
/**
14
 * Class ExportContactObserver
15
 */
16
class ExportContactObserver implements ObserverInterface
17
{
18
    /**
19
     * @var ConfigHelper
20
     */
21
    private $configHelper;
22
23
    /**
24
     * @var ExportContactService
25
     */
26
    private $exportContactService;
27
28
    /**
29
     * @param ConfigHelper $configHelper
30
     * @param ExportContactService $exportContactService
31
     */
32
    public function __construct(
33
        ConfigHelper $configHelper,
34
        ExportContactService $exportContactService
35
    ) {
36
        $this->configHelper = $configHelper;
37
        $this->exportContactService = $exportContactService;
38
    }
39
40
    /**
41
     * @param Observer $observer
42
     */
43
    public function execute(Observer $observer)
44
    {
45
        if (!$this->configHelper->isApiEnabled()) {
46
            return;
47
        }
48
49
        /** @var Customer $magentoCustomer */
50
        $magentoCustomer = $observer->getEvent()->getData('customer');
51
52
        $this->exportContactService->exportWithMagentoCustomer($magentoCustomer);
53
    }
54
}
55