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   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPassword() 0 4 1
A __construct() 0 11 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