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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveCallback() 0 15 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
}