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

Redirect::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 6
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 11
rs 10
1
<?php
2
declare(strict_types=1);
3
/**
4
 */
5
6
namespace CommerceLeague\ActiveCampaign\Controller\Cart;
7
8
use Magento\Customer\Model\Session as CustomerSession;
9
use Magento\Framework\App\Action\Action;
10
use Magento\Framework\App\Action\Context;
11
use Magento\Framework\App\Action\HttpGetActionInterface;
12
13
/**
14
 * Class Redirect
15
 */
16
class Redirect extends Action implements HttpGetActionInterface
17
{
18
    /**
19
     * @var CustomerSession
20
     */
21
    private $customerSession;
22
23
    /**
24
     * @param Context $context
25
     * @param CustomerSession $customerSession
26
     */
27
    public function __construct(
28
        Context $context,
29
        CustomerSession $customerSession
30
    ) {
31
        parent::__construct($context);
32
        $this->customerSession = $customerSession;
33
    }
34
35
    /**
36
     * @inheritDoc
37
     */
38
    public function execute()
39
    {
40
        $url = $this->_url->getUrl('checkout/cart');
41
42
        if (!$this->customerSession->isLoggedIn()) {
43
            $this->messageManager->addSuccessMessage(__('Please sign in to see your cart.'));
44
            $this->customerSession->setBeforeAuthUrl($url);
45
            $url = $this->_url->getUrl('customer/account/login');
46
        }
47
48
        $this->_redirect($url);
49
    }
50
}
51