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 ( aaa283...38e978 )
by Anton
02:16
created

Local   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 57.14%

Importance

Changes 0
Metric Value
dl 0
loc 78
ccs 8
cts 14
cp 0.5714
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 2

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getConfiguration() 0 4 1
A connect() 0 4 1
A run() 0 4 1
A mustRun() 0 10 1
A upload() 0 4 1
A download() 0 4 1
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;
9
10
use Symfony\Component\Process\Process;
11
12
class Local implements ServerInterface
13
{
14
    const TIMEOUT = 300;
15
16
    /**
17
     * @var Configuration
18
     */
19 1
    private $configuration;
20
21
    /**
22 1
     * Local constructor.
23
     * @param $config
24
     */
25
    public function __construct(Configuration $config = null)
26
    {
27 12
        if ($config === null) {
28
            $config = new Configuration('localhost', 'localhost');
29 12
        }
30
31 12
        $this->configuration = $config;
32 12
    }
33 12
34
    /**
35 12
     * @return Configuration
36
     */
37
    public function getConfiguration()
38
    {
39
        return $this->configuration;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */
45
    public function connect()
46
    {
47
        // We do not need to connect to local server.
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function run($command)
54
    {
55
        return $this->mustRun($command);
56
    }
57
58
    /**
59
     * @param string $command
60
     * @param callable $callback
61
     * @return string
62
     */
63
    public function mustRun($command, $callback = null)
64
    {
65
        $process = new Process($command);
66
        $process
67
            ->setTimeout(self::TIMEOUT)
68
            ->setIdleTimeout(self::TIMEOUT)
69
            ->mustRun($callback);
70
71
        return $process->getOutput();
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function upload($local, $remote)
78
    {
79
        copy($local, $remote);
80
    }
81
82
    /**
83
     * {@inheritdoc}
84
     */
85
    public function download($local, $remote)
86
    {
87
        copy($remote, $local);
88
    }
89
}
90