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 ( 99078a...9605c1 )
by Oanh
02:49
created

CallablePasswordGetter::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

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 11
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 6
nc 2
nop 1
crap 3
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Server\Password;
9
10
/**
11
 * Get password with use another function (Closure)
12
 *
13
 * @author Vitaliy Zhuk <[email protected]>
14
 */
15
class CallablePasswordGetter implements PasswordGetterInterface
16
{
17
    /**
18
     * @var callable
19
     */
20
    private $callable;
21
22
    /**
23
     * Construct
24
     *
25
     * @param callable $callable
26
     */
27 5
    public function __construct($callable)
28
    {
29 5
        if (!is_callable($callable)) {
30 1
            throw new \InvalidArgumentException(sprintf(
31 1
                'The first argument must be a callable, but "%s" given.',
32 1
                is_object($callable) ? get_class($callable) : gettype($callable)
33 1
            ));
34
        }
35
36 4
        $this->callable = $callable;
37 4
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42 2
    public function getPassword($host, $user)
43
    {
44 2
        return call_user_func($this->callable, $host, $user);
45
    }
46
}
47