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

Server::checkCsrfForm()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
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