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.
Passed
Pull Request — master (#1061)
by Maxim
04:23 queued 01:35
created

Local   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 58.33%

Importance

Changes 0
Metric Value
dl 0
loc 78
ccs 14
cts 24
cp 0.5833
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
    private $configuration;
20
21
    /**
22
     * Local constructor.
23
     * @param $config
24
     */
25 15
    public function __construct(Configuration $config = null)
26
    {
27 15
        if ($config === null) {
28 14
            $config = new Configuration('localhost', 'localhost');
29 14
        }
30
31 15
        $this->configuration = $config;
32 15
    }
33
34
    /**
35
     * @return Configuration
36
     */
37 9
    public function getConfiguration()
38
    {
39 9
        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 9
    public function mustRun($command, $callback = null)
64
    {
65 9
        $process = new Process($command);
66
        $process
67 9
            ->setTimeout(self::TIMEOUT)
68 9
            ->setIdleTimeout(self::TIMEOUT)
69 9
            ->mustRun($callback);
70
71 9
        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