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   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
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