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

ExportContactService::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Service;
7
8
use CommerceLeague\ActiveCampaign\Gateway\Request\ContactBuilder as ContactRequestBuilder;
9
use CommerceLeague\ActiveCampaign\MessageQueue\Topics;
10
use Magento\Customer\Model\Customer as MagentoCustomer;
11
use Magento\Framework\MessageQueue\PublisherInterface;
12
use Magento\Newsletter\Model\Subscriber;
13
14
/**
15
 * Class ExportContactService
16
 */
17
class ExportContactService
18
{
19
    /**
20
     * @var ContactRequestBuilder
21
     */
22
    private $contactRequestBuilder;
23
24
    /**
25
     * @var PublisherInterface
26
     */
27
    private $publisher;
28
29
    /**
30
     * @param ContactRequestBuilder $contactRequestBuilder
31
     * @param PublisherInterface $publisher
32
     */
33
    public function __construct(
34
        ContactRequestBuilder $contactRequestBuilder,
35
        PublisherInterface $publisher
36
    ) {
37
        $this->contactRequestBuilder = $contactRequestBuilder;
38
        $this->publisher = $publisher;
39
    }
40
41
    /**
42
     * @param MagentoCustomer $magentoCustomer
43
     */
44
    public function exportWithMagentoCustomer(MagentoCustomer $magentoCustomer): void
45
    {
46
        $data = [
47
            'email' => $magentoCustomer->getData('email'),
48
            'request' => $this->contactRequestBuilder->buildWithMagentoCustomer($magentoCustomer)
49
        ];
50
51
        $this->publisher->publish(Topics::CONTACT_EXPORT, json_encode($data));
0 ignored issues
show
Bug introduced by
json_encode($data) of type string is incompatible with the type array|object expected by parameter $data of Magento\Framework\Messag...herInterface::publish(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

51
        $this->publisher->publish(Topics::CONTACT_EXPORT, /** @scrutinizer ignore-type */ json_encode($data));
Loading history...
52
    }
53
54
    /**
55
     * @param Subscriber $subscriber
56
     */
57
    public function exportWithSubscriber(Subscriber $subscriber): void
58
    {
59
        $data = [
60
            'email' => $subscriber->getEmail(),
61
            'request' => $this->contactRequestBuilder->buildWithSubscriber($subscriber)
62
        ];
63
64
        $this->publisher->publish(Topics::CONTACT_EXPORT, json_encode($data));
0 ignored issues
show
Bug introduced by
json_encode($data) of type string is incompatible with the type array|object expected by parameter $data of Magento\Framework\Messag...herInterface::publish(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

64
        $this->publisher->publish(Topics::CONTACT_EXPORT, /** @scrutinizer ignore-type */ json_encode($data));
Loading history...
65
    }
66
}
67