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.

SSHCheck::check()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
ccs 10
cts 10
cp 1
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 9
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * This file is part of the Gerrie package.
4
 *
5
 * (c) Andreas Grunwald <[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
namespace Gerrie\Check;
12
13
/**
14
 * Check if ssh is installed.
15
 *
16
 * @author Andreas Grunwald <[email protected]>
17
 */
18
class SSHCheck implements CheckInterface
19
{
20
    /**
21
     * Version of ssh
22
     *
23
     * @var string
24
     */
25
    private $sshVersion = '';
26
27
    /**
28
     * Executes the check itselfs
29
     *
30
     * @return boolean
31
     */
32 1
    public function check()
33
    {
34 1
        $returnVar = 0;
35 1
        $output = [];
36 1
        $sshVersion = exec('ssh -V 2>&1', $output, $returnVar);
37
38 1
        $result = false;
39 1
        if ($returnVar === 0) {
40 1
            $result = true;
41 1
            $this->sshVersion = $sshVersion;
42 1
        }
43
44 1
        return $result;
45
    }
46
47
    /**
48
     * Returns the message, if the check succeeded
49
     *
50
     * @return string
51
     */
52 1
    public function getSuccessMessage()
53
    {
54 1
        $message = '"ssh" is installed and usable in version "%s".';
55 1
        $message = sprintf($message, $this->sshVersion);
56 1
        return $message;
57
    }
58
59
    /**
60
     * Returns the message, if the check fails
61
     *
62
     * @return string
63
     */
64 1
    public function getFailureMessage()
65
    {
66 1
        $message = '"ssh" is not installed. Please install "ssh".';
67 1
        return $message;
68
    }
69
70
    /**
71
     * Returns if this check is optional or required.
72
     *
73
     * @return bool
74
     */
75 1
    public function isOptional()
76
    {
77 1
        return false;
78
    }
79
}
80