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.

Issues (203)

Observer/Sales/ExportOrderObserver.php (2 issues)

1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Observer\Sales;
7
8
use CommerceLeague\ActiveCampaign\Helper\Config as ConfigHelper;
9
use CommerceLeague\ActiveCampaign\MessageQueue\Topics;
10
use Magento\Framework\Event\Observer;
11
use Magento\Framework\Event\ObserverInterface;
12
use Magento\Framework\MessageQueue\PublisherInterface;
13
use Magento\Sales\Model\Order as MagentoOrder;
14
15
/**
16
 * Class ExportOrderObserver
17
 */
18
class ExportOrderObserver implements ObserverInterface
19
{
20
    /**
21
     * @var ConfigHelper
22
     */
23
    private $configHelper;
24
25
    /**
26
     * @var PublisherInterface
27
     */
28
    private $publisher;
29
30
    /**
31
     * @param ConfigHelper $configHelper
32
     * @param PublisherInterface $publisher
33
     */
34
    public function __construct(
35
        ConfigHelper $configHelper,
36
        PublisherInterface $publisher
37
    ) {
38
        $this->configHelper = $configHelper;
39
        $this->publisher = $publisher;
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45
    public function execute(Observer $observer)
46
    {
47
        if (!$this->configHelper->isEnabled() || !$this->configHelper->isOrderExportEnabled()) {
48
            return;
49
        }
50
51
        /** @var MagentoOrder $magentoOrder */
52
        $magentoOrder = $observer->getEvent()->getData('order');
53
54
        if ($magentoOrder->getCustomerIsGuest()) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $magentoOrder->getCustomerIsGuest() of type integer|null is loosely compared to true; this is ambiguous if the integer can be 0. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
55
            return;
56
        }
57
58
        $this->publisher->publish(
59
            Topics::SALES_ORDER_EXPORT,
60
            json_encode(['magento_order_id' => $magentoOrder->getId()])
0 ignored issues
show
json_encode(array('magen...magentoOrder->getId())) 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

60
            /** @scrutinizer ignore-type */ json_encode(['magento_order_id' => $magentoOrder->getId()])
Loading history...
61
        );
62
    }
63
}
64