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.

SolrMonitoring::getMetric()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
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
 * "Solr" : {
10
 *         "name" : "Name of metric and alarm",
11
 *         "url": "http://localhost:8080/solr/collection1/admin/ping",
12
 *         "namespace": "Metric/Namespace",
13
 *         "description": "Descrption"
14
 * }
15
 */
16
class SolrMonitoring extends AbstractMonitoring
17
{
18
    private $solrPingUrl;
19
    /**
20
     * @param array $config
21
     * @param String $name
22
     */
23
    public function __construct($config, $name)
24
    {
25
        parent::__construct($config, $name);
26
        $this->solrPingUrl = $this->config->url;
27
    }
28
    /**
29
     * Check solr ping url.
30
     * @return metric 0 Ok, 1 KO
31
     */
32
    public function getMetric()
33
    {
34
        if (@file_get_contents($this->solrPingUrl) === false) {
35
            return 0;
36
        }
37
        return 1;
38
    }
39
    /**
40
     * @return string "None"
41
     */
42
    public function getUnit()
43
    {
44
        return "None";
45
    }
46
    /**
47
     * @return integer 1
48
     */
49
    public function getAlarms()
50
    {
51
        return array(
52
                    array("ComparisonOperator" => "LessThanThreshold",
53
                          "Threshold" => 1,
54
                          "Name" => $this->name)
55
                    );
56
    }
57
}
58