Test Failed
Push — master ( ec8ff1...24c3c9 )
by Vladimir
05:33
created

Manager::findChecks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
ccs 0
cts 0
cp 0
crap 2
rs 10
c 0
b 0
f 0
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\Runner;
13
14
use Tvi\MonitorBundle\Check\CheckInterface;
15
use Tvi\MonitorBundle\Check\Group;
16
use Tvi\MonitorBundle\Check\Manager as CheckManager;
17
use Tvi\MonitorBundle\Check\Tag;
18
19
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
20
 * @author Vladimir Turnaev <[email protected]>
21
 */
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...
22
class Manager
23
{
24
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
25
     * @var CheckManager
26
     */
27
    protected $checkManager;
28
29 1
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
30
     * @param CheckManager $checkManager
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
31 1
     */
32 1
    public function __construct(CheckManager $checkManager)
33
    {
34
        $this->checkManager = $checkManager;
35
    }
36
37 1
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $alias should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $groups should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $tags should have a doc-comment as per coding-style.
Loading history...
38
     * @return Runner
39 1
     */
40
    public function getRunner($alias = null, $groups = null, $tags = null): Runner
41 1
    {
42
        $checks = $this->checkManager->getChecks($alias, $groups, $tags);
43 1
44
        $runner = new Runner(null, $checks);
45
46
        return $runner;
47
    }
48
49
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
50
     * @param null|string|string[] $alias
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
51
     * @param null|string|string[] $groups
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
52
     * @param null|string|string[] $tags
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
53
     *
54
     * @return CheckInterface[]
55
     */
56
    public function findChecks($alias = null, $groups = null, $tags = null): array
57
    {
58
        return $this->checkManager->getChecks($alias, $groups, $tags);
59
    }
60
61
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
62
     * @param null|string|string[] $tags
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
63
     *
64
     * @return Tag[]
65
     */
66
    public function findTags($tags = null): array
67
    {
68
        return $this->checkManager->getTags($tags);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->checkManager->getTags($tags) returns the type Tvi\MonitorBundle\Check\Group which is incompatible with the type-hinted return array.
Loading history...
Bug introduced by
$tags of type null|string|string[] is incompatible with the type Tvi\MonitorBundle\Check\Group expected by parameter $group of Tvi\MonitorBundle\Check\Manager::getTags(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

68
        return $this->checkManager->getTags(/** @scrutinizer ignore-type */ $tags);
Loading history...
69
    }
70
71
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
72
     * @param null|string|string[] $groups
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
73
     *
74
     * @return Group[]
75
     */
76
    public function findGroups($groups = null): array
77
    {
78
        return $this->checkManager->getGroups($groups);
79
    }
80
}
81