Test Failed
Push — master ( 320d62...b1d181 )
by Alexey
05:17
created

Server   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkCsrf() 0 3 2
A checkCsrfForm() 0 6 3
1
<?php
2
3
/**
4
 * Server module
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
class Server extends Module {
12
    function checkCsrf($key, $token) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
13
        return !empty($_SESSION['csrf'][$key]) && $_SESSION['csrf'][$key] == $token;
14
    }
15
16
    function checkCsrfForm($formData) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
17
        if (empty($formData['csrfKey']) || empty($formData['csrfToken'])) {
18
            return false;
19
        }
20
        return $this->checkCsrf($formData['csrfKey'], $formData['csrfToken']);
21
    }
22
}
23