actionTwoStep()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 9

Duplication

Lines 21
Ratio 100 %

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 9.3142
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
/**
3
 * Passes data to Tfa model.
4
 *
5
 * @package ThreemaGateway
6
 * @author rugk
7
 * @copyright Copyright (c) 2016 rugk
8
 * @license MIT
9
 */
10
11 View Code Duplication
class ThreemaGateway_ControllerAdmin_Login extends XFCP_ThreemaGateway_ControllerAdmin_Login
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    /**
14
     * Passes the provider ID to the TFA model to enable customized behaviour.
15
     *
16
     * @return XenForo_ControllerResponse_View
17
     */
18
    public function actionTwoStep()
19
    {
20
        /** @var string $providerId */
21
        $providerId = $this->_input->filterSingle('provider', XenForo_Input::STRING);
22
23
        /** @var bool $isThreemaGwProvider whether this is a provider handled by us */
24
        $isThreemaGwProvider = in_array($providerId, ThreemaGateway_Constants::TFA_PROVIDER_ARRAY);
25
26
        if ($isThreemaGwProvider) {
27
            $this->_getTfaModel()->threemagwSetProviderId($providerId);
28
        } else {
29
            // to be sure, better reset the value if we do not handle the things
30
            // (when caching or so might retain this model)
31
            $this->_getTfaModel()->threemagwSetProviderId(null);
32
        }
33
34
        /** @var XenForo_ControllerResponse_View $parent original response */
35
        $parent = parent::actionTwoStep();
36
37
        return $parent;
38
    }
39
40
    /**
41
     * @return XenForo_Model_Tfa
42
     */
43
    protected function _getTfaModel()
44
    {
45
        return $this->getModelFromCache('XenForo_Model_Tfa');
46
    }
47
}
48