RemoteProcessesGauge   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Petrica
5
 * Date: 5/29/2016
6
 * Time: 16:24
7
 */
8
namespace Petrica\StatsdSystem\Gauge;
9
10
use Petrica\StatsdSystem\Model\RemoteTopCommand;
11
12
class RemoteProcessesGauge extends ProcessesGauge
13
{
14
    /**
15
     * SSH Connection string
16
     *
17
     * @var string
18
     */
19
    protected $sshString;
20
21
    /**
22
     * Path to private key
23
     *
24
     * @var string
25
     */
26
    protected $sshIdentityFile;
27
28
    /**
29
     * Ssh port
30
     *
31
     * @var string
32
     */
33
    protected $sshPort;
34
35
36 1
    public function __construct($sshString, $sshPort = null, $sshIdentityFile = null, $cpuAbove = 5.0, $memoryAbove = 1.0)
37
    {
38 1
        parent::__construct($cpuAbove, $memoryAbove);
39
40 1
        $this->sshString = $sshString;
41 1
        $this->sshIdentityFile = $sshIdentityFile;
42 1
        $this->sshPort = $sshPort;
43
44 1
        $this->command = new RemoteTopCommand($this->sshString, $this->sshPort, $this->sshIdentityFile);
45
46
47 1
        $this->namespace = preg_replace('/[^-+_.A-Za-z0-9]*/i', '', 'statsd.' . $this->sshString . '.' . $this->sshPort);
48
    }
49
}