Passed
Push — master ( b8bdbf...0c1875 )
by Rutger
15:13
created

Oauth2BaseWebController::beforeAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 10
cc 2
nc 2
nop 1
crap 2.0625
1
<?php
2
3
namespace rhertogh\Yii2Oauth2Server\controllers\web\base;
4
5
use rhertogh\Yii2Oauth2Server\Oauth2Module;
6
use yii\web\Controller;
7
use yii\web\ForbiddenHttpException;
8
9
/**
10
 * @property Oauth2Module $module
11
 */
12
abstract class Oauth2BaseWebController extends Controller
13
{
14 4
    public function beforeAction($action)
15
    {
16 4
        if (!$this->module->validateTlsConnection()) {
17
            throw new ForbiddenHttpException('TLS connection is required.');
18
        }
19
20 4
        return parent::beforeAction($action);
21
    }
22
}
23