Test Failed
Push — master ( f043ce...f1785b )
by Antonio Carlos
04:03
created

ServerLoad::makeMessage()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 3.0416

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 2
dl 0
loc 16
ccs 10
cts 12
cp 0.8333
crap 3.0416
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
namespace PragmaRX\Health\Checkers;
4
5
use PragmaRX\Health\Support\Result;
6
7
class ServerLoad extends ServerUptime
8
{
9
    /**
10
     * Check resource.
11
     *
12
     * @return Result
13
     */
14 1
    public function check()
15
    {
16 1
        $current = $this->getCurrentUptime();
17
18
        $inTrouble =
19 1
            $current['load_1'] > $this->target->maxLoad['load_1'] ||
0 ignored issues
show
Bug introduced by
The property maxLoad does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
20
            $current['load_5'] > $this->target->maxLoad['load_5'] ||
21 1
            $current['load_15'] > $this->target->maxLoad['load_15'];
22
23 1
        return $this->makeResult(! $inTrouble, $this->makeMessage($current));
24
    }
25
26 1
    protected function makeMessage($current, $saved = null)
27
    {
28 1
        $current['load_1'] > $this->target->maxLoad['load_1'] ||
0 ignored issues
show
Bug introduced by
The property maxLoad does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
29
            $current['load_5'] > $this->target->maxLoad['load_5'] ||
30
            $current['load_15'] > $this->target->maxLoad['load_15'];
31
32 1
        return sprintf(
33 1
            $this->target->getErrorMessage(),
34 1
            $current['load_1'],
35 1
            $current['load_5'],
36 1
            $current['load_15'],
37 1
            $this->target->maxLoad['load_1'],
38 1
            $this->target->maxLoad['load_5'],
39 1
            $this->target->maxLoad['load_15']
40
        );
41
    }
42
}
43