Check   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 28
ccs 5
cts 7
cp 0.7143
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 6 2
A __construct() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of the `tvi/monitor-bundle` project.
5
 *
6
 * (c) https://github.com/turnaev/monitor-bundle/graphs/contributors
7
 *
8
 * For the full copyright and license information, please view the LICENSE.md
9
 * file that was distributed with this source code.
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
Coding Style introduced by
Missing @link tag in file comment
Loading history...
11
12
namespace Tvi\MonitorBundle\Check\redis\Redis;
13
14
use JMS\Serializer\Annotation as JMS;
15
use ZendDiagnostics\Result\Failure;
16
use ZendDiagnostics\Check\Redis;
17
use Tvi\MonitorBundle\Check\CheckAbstract;
18
19
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
 * @JMS\ExclusionPolicy("all")
21
 *
22
 * @author Vladimir Turnaev <[email protected]>
23
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
24
class Check extends CheckAbstract
25
{
26
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
27
     * @var Redis
28
     */
29
    private $checker;
0 ignored issues
show
Coding Style introduced by
Private member variable "checker" must be prefixed with an underscore
Loading history...
30
31
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
32
     * @param string      $host
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
33
     * @param int         $port
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
34
     * @param string|null $auth
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
35
     */
36 2
    public function __construct($host = 'localhost', $port = 6379, $auth = null)
37
    {
38 2
        $this->checker = new Redis($host, $port, $auth);
39 2
    }
40
41
    /**
42
     * Perform the check.
43
     *
44
     * @see \ZendDiagnostics\Check\CheckInterface::check()
45
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
46 2
    public function check()
47
    {
48
        try {
49 2
            return $this->checker->check();
50
        } catch (\Exception $e) {
51
            return new Failure($e->getMessage());
52
        }
53
    }
54
}
55