GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WebToken::verify()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 8
nc 6
nop 2
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Security\Authentication;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class WebToken
20
 *
21
 * @package O2System\Security\Authentication
22
 */
23
class WebToken
24
{
25
    /**
26
     * WebToken::verify
27
     *
28
     * Checks if the posted X-WEB-TOKEN protection token is valid.
29
     *
30
     * @param string   $token    X-WEB-TOKEN protection token.
31
     * @param \Closure $callback Callback verification process.
32
     *
33
     * @return bool
34
     */
35
    public function verify($token = null, \Closure $callback)
36
    {
37
        $token = isset($token)
38
            ? $token
39
            : input()->server('HTTP_X_WEB_TOKEN');
40
41
        if (is_null($token)) {
42
            return false;
43
        } elseif (is_callable($callback)) {
44
            return call_user_func($callback, $token);
45
        }
46
47
        return false;
48
    }
49
}