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

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 5
lcom 2
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getMetric() 0 7 2
A getUnit() 0 4 1
A getAlarms() 0 8 1
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