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 ( 5543fb...d29718 )
by Andreas
03:19
created

CustomerSaveAfterObserver::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 2
nc 2
nop 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
namespace CommerceLeague\ActiveCampaign\Observer;
6
7
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
8
use CommerceLeague\ActiveCampaign\Service\Contact\CreateUpdateContactService;
9
use Magento\Customer\Model\Customer;
10
use Magento\Framework\Event\Observer;
11
use Magento\Framework\Event\ObserverInterface;
12
13
/**
14
 * Class CustomerSaveAfterObserver
15
 */
16
class CustomerSaveAfterObserver implements ObserverInterface
17
{
18
    /**
19
     * @var ConfigHelper
20
     */
21
    private $configHelper;
22
23
    /**
24
     * @var CreateUpdateContactService
25
     */
26
    private $createUpdateContactService;
27
28
    /**
29
     * @param ConfigHelper $configHelper
30
     * @param CreateUpdateContactService $createUpdateContactService
31
     */
32
    public function __construct(
33
        ConfigHelper $configHelper,
34
        CreateUpdateContactService $createUpdateContactService
35
    ) {
36
        $this->configHelper = $configHelper;
37
        $this->createUpdateContactService = $createUpdateContactService;
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 $customer */
50
        $customer = $observer->getEvent()->getData('customer');
51
        $this->createUpdateContactService->execute($customer);
52
    }
53
}
54