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   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 62
ccs 19
cts 19
cp 1
rs 10
c 2
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 14 2
A getSuccessMessage() 0 6 1
A getFailureMessage() 0 5 1
A isOptional() 0 4 1
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