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.
Passed
Push — master ( e4b67a...d8327a )
by Andreas
03:56
created

Import::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 8
rs 10
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Controller\Adminhtml\Contact;
7
8
use CommerceLeague\ActiveCampaign\Controller\Adminhtml\AbstractContact;
9
use CommerceLeague\ActiveCampaign\MessageQueue\Contact\ImportMessageBuilder;
10
use CommerceLeague\ActiveCampaign\MessageQueue\Topics;
11
use Magento\Backend\App\Action;
12
use Magento\Backend\Model\View\Result\Redirect as ResultRedirect;
13
use Magento\Framework\App\Action\HttpPostActionInterface;
14
use Magento\Framework\MessageQueue\PublisherInterface;
15
16
/**
17
 * Class Import
18
 */
19
class Import extends AbstractContact implements HttpPostActionInterface
20
{
21
    /**
22
     * @var ImportMessageBuilder
23
     */
24
    private $importMessageBuilder;
25
26
    /**
27
     * @var PublisherInterface
28
     */
29
    private $publisher;
30
31
    /**
32
     * @param Action\Context $context
33
     * @param ImportMessageBuilder $importMessageBuilder
34
     * @param PublisherInterface $publisher
35
     */
36
    public function __construct(
37
        Action\Context $context,
38
        ImportMessageBuilder $importMessageBuilder,
39
        PublisherInterface $publisher
40
    ) {
41
        $this->importMessageBuilder = $importMessageBuilder;
42
        $this->publisher = $publisher;
43
        parent::__construct($context);
44
    }
45
46
    /**
47
     * @inheritDoc
48
     */
49
    public function execute()
50
    {
51
        $this->publisher->publish(
52
            Topics::CONTACT_IMPORT,
53
            $this->importMessageBuilder->build()
54
        );
55
56
        $this->messageManager->addNoticeMessage(
57
            __('Message is added to queue, contacts will be imported soon')
58
        );
59
60
        /** @var ResultRedirect $resultRedirect */
61
        $resultRedirect = $this->resultRedirectFactory->create();
62
        return $resultRedirect->setPath('*/*/');
63
    }
64
}
65
66