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.

DiskMonitoring::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace CloudWatchScript\Plugins;
3
4
use CloudWatchScript\AbstractMonitoring;
5
6
/**
7
 * Check Solr using ping URL.
8
 * Add and configure the folliwong lines to the config file
9
 * "Disk" : {
10
 *         "name" : "Name of metric and alarm",
11
 *         "partition" : "/"
12
 *         "maxUtil": 90,
13
 *         "namespace": "Metric/Namespace",
14
 *         "description": "Description"
15
 * }
16
 */
17
class DiskMonitoring extends AbstractMonitoring
18
{
19
    private $maxUtil;
20
    private $partition;
21
22
    /**
23
     * @param array $config
24
     * @param String $name
25
     */
26
    public function __construct($config, $name)
27
    {
28
        parent::__construct($config, $name);
29
        $this->maxUtil = $this->config->maxUtil;
30
        $this->partition = $this->config->partition;
31
    }
32
33
    /**
34
     * @return integer Percentage of use disk space
35
     */
36
    public function getMetric()
37
    {
38
        return 100 -  intval(100 * ( disk_free_space($this->partition) / disk_total_space($this->partition)));
39
40
    }
41
    /**
42
     * @return string "None"
43
     */
44
    public function getUnit()
45
    {
46
        return "Percent";
47
    }
48
49
    /**
50
     * @return array Alarm min and max for number of apache process
51
     */
52
    public function getAlarms()
53
    {
54
        return array(
55
                array("ComparisonOperator" => "GreaterThanThreshold",
56
                        "Threshold" => $this->maxUtil,
57
                        "Name" => $this->name . " exceed " . $this->config->maxUtil . " %")
58
        );
59
    }
60
}
61