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 ( ce7c33...c8c4e6 )
by Andreas
03:55
created

ExportOrderService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A export() 0 8 1
A __construct() 0 6 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Service;
7
8
use CommerceLeague\ActiveCampaign\Gateway\Request\OrderBuilder as OrderRequestBuilder;
9
use CommerceLeague\ActiveCampaign\MessageQueue\Topics;
10
use Magento\Framework\MessageQueue\PublisherInterface;
11
use Magento\Sales\Model\Order as MagentoOrder;
12
13
class ExportOrderService
14
{
15
    /**
16
     * @var OrderRequestBuilder
17
     */
18
    private $orderRequestBuilder;
19
20
    /**
21
     * @var PublisherInterface
22
     */
23
    private $publisher;
24
25
    /**
26
     * @param OrderRequestBuilder $orderRequestBuilder
27
     * @param PublisherInterface $publisher
28
     */
29
    public function __construct(
30
        OrderRequestBuilder $orderRequestBuilder,
31
        PublisherInterface $publisher
32
    ) {
33
        $this->orderRequestBuilder = $orderRequestBuilder;
34
        $this->publisher = $publisher;
35
    }
36
37
    public function export(MagentoOrder $magentoOrder): void
38
    {
39
        $data = [
40
            'magento_order_id' => $magentoOrder->getId(),
41
            'request' => $this->orderRequestBuilder->build($magentoOrder)
42
        ];
43
44
        $this->publisher->publish(Topics::ORDER_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

44
        $this->publisher->publish(Topics::ORDER_EXPORT, /** @scrutinizer ignore-type */ json_encode($data));
Loading history...
45
    }
46
}
47