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.
Completed
Push — master ( 90cf5c...e17caf )
by Sergey
02:42
created

CallbackResolver::resolveCallback()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 9
nc 4
nop 1
crap 3
1
<?php
2
/*
3
 * This file is part of the reva2/jsonapi.
4
 *
5
 * (c) Sergey Revenko <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
12
namespace Reva2\JsonApi\Decoders;
13
14
use Reva2\JsonApi\Contracts\Decoders\CallbackResolverInterface;
15
16
/**
17
 * Simple callback resolver
18
 *
19
 * @package Reva2\JsonApi\Decoders
20
 * @author Sergey Revenko <[email protected]>
21
 */
22
class CallbackResolver implements CallbackResolverInterface
23
{
24
    const STATIC_METHOD_PATTERN = "/[A-Za-z0-9\._\-]+::[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/";
25
26
    /**
27
     * @inheritdoc
28
     */
29 6
    public function resolveCallback($name)
30
    {
31 6
        if (preg_match(static::STATIC_METHOD_PATTERN, $name)) {
32 5
            list($class, $method) = explode('::', $name, 2);
33 5
            $callback = array($class, $method);
34
        } else {
35 1
            $callback = $name;
36
        }
37
38 6
        if (!is_callable($callback)) {
39 1
            throw new \InvalidArgumentException(sprintf("'%s' is not callable", $name));
40
        }
41
42 5
        return $callback;
43
    }
44
}