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.
Completed
Push — master ( 0b4be3...13043e )
by Frédéric
02:24
created

src/CloudWatchScript/Plugins/DiskMonitoring.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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 View Code Duplication
    public function getAlarms()
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
53
    {
54
        return array(
55
                array("ComparisonOperator" => "GreaterThanThreshold",
56
                        "Threshold" => $this->maxUtil,
57
                        "Name" => $this->name . " exceed " . $this->config->maxUtil . " %")
58
        );
59
    }
60
}
61