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.

CustomerBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A build() 0 9 2
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Gateway\Request;
7
8
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
9
use CommerceLeague\ActiveCampaign\Helper\Contants;
10
use Magento\Customer\Api\Data\CustomerInterface as MagentoCustomerInterface;
11
12
/**
13
 * Class CustomerBuilder
14
 */
15
class CustomerBuilder
16
{
17
    /**
18
     * @var ConfigHelper
19
     */
20
    private $configHelper;
21
22
    /**
23
     * @param ConfigHelper $configHelper
24
     */
25
    public function __construct(ConfigHelper $configHelper)
26
    {
27
        $this->configHelper = $configHelper;
28
    }
29
30
    /**
31
     * @param MagentoCustomerInterface $magentoCustomer
32
     * @return array
33
     */
34
    public function build(MagentoCustomerInterface $magentoCustomer): array
35
    {
36
        $isSubscribed = $magentoCustomer->getExtensionAttributes()->getIsSubscribed();
37
38
        return [
39
            'connectionid' => $this->configHelper->getConnectionId(),
40
            'externalid' => $magentoCustomer->getId(),
41
            'email' => $magentoCustomer->getEmail(),
42
            'acceptsMarketing' => $isSubscribed ? 1 : 0
43
        ];
44
    }
45
}
46