Index   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A execute() 0 9 1
1
<?php
2
/**
3
 * Copyright © 2019 O2TI. All rights reserved.
4
 * See LICENSE.txt for license details.
5
 */
6
7
namespace O2TI\SocialLogin\Controller\Endpoint;
8
9
use Magento\Framework\App\Action\Action;
10
use Magento\Framework\App\Action\Context;
11
use Magento\Framework\Url\DecoderInterface;
12
use O2TI\SocialLogin\Provider\Provider;
13
14
class Index extends Action
0 ignored issues
show
Deprecated Code introduced by
The class Magento\Framework\App\Action\Action has been deprecated: 103.0.0 Inheritance in controllers should be avoided in favor of composition ( Ignorable by Annotation )

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

14
class Index extends /** @scrutinizer ignore-deprecated */ Action
Loading history...
15
{
16
    /**
17
     * @var DecoderInterface
18
     */
19
    protected $urlDecoder;
20
21
    /**
22
     * @var Provider
23
     */
24
    protected $provider;
25
26
    /**
27
     * Construct.
28
     *
29
     * @param Context          $context
30
     * @param Provider         $provider
31
     * @param DecoderInterface $urlDecoder
32
     */
33
    public function __construct(
34
        Context $context,
35
        Provider $provider,
36
        DecoderInterface $urlDecoder
37
    ) {
38
        parent::__construct($context);
39
        $this->provider = $provider;
40
        $this->urlDecoder = $urlDecoder;
41
    }
42
43
    /**
44
     * Dispatch request.
45
     *
46
     * @return void
47
     */
48
    public function execute()
49
    {
50
        $provider = $this->_request->getParam('provider');
51
        $isSecure = $this->_request->isSecure();
52
        $referer = $this->_request->getParam('referer');
53
54
        $response = $this->provider->setAutenticateAndReferer($provider, $isSecure, $referer);
0 ignored issues
show
Bug introduced by
$isSecure of type boolean is incompatible with the type integer expected by parameter $isSecure of O2TI\SocialLogin\Provide...AutenticateAndReferer(). ( Ignorable by Annotation )

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

54
        $response = $this->provider->setAutenticateAndReferer($provider, /** @scrutinizer ignore-type */ $isSecure, $referer);
Loading history...
55
        // phpcs:ignore
56
        return $this->_redirect($this->urlDecoder->decode($response['redirectUrl']));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->_redirect(...sponse['redirectUrl'])) returns the type Magento\Framework\App\ResponseInterface which is incompatible with the documented return type void.
Loading history...
57
    }
58
}
59