turnaev /
monitor-bundle
| 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
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\CheckManager; |
||
| 17 | use Tvi\MonitorBundle\Check\Tag; |
||
| 18 | |||
| 19 | /** |
||
|
0 ignored issues
–
show
|
|||
| 20 | * @author Vladimir Turnaev <[email protected]> |
||
| 21 | */ |
||
|
0 ignored issues
–
show
|
|||
| 22 | class RunnerManager |
||
| 23 | { |
||
| 24 | /** |
||
|
0 ignored issues
–
show
|
|||
| 25 | * @var CheckManager |
||
| 26 | */ |
||
| 27 | protected $checkManager; |
||
| 28 | |||
| 29 | 94 | public function __construct(CheckManager $checkManager) |
|
|
0 ignored issues
–
show
|
|||
| 30 | { |
||
| 31 | 94 | $this->checkManager = $checkManager; |
|
| 32 | 94 | } |
|
| 33 | |||
| 34 | /** |
||
|
0 ignored issues
–
show
|
|||
| 35 | * @param ?string|string[] $ids |
||
|
0 ignored issues
–
show
|
|||
| 36 | * @param ?string|string[] $groups |
||
|
0 ignored issues
–
show
|
|||
| 37 | * @param ?string|string[] $tags |
||
|
0 ignored issues
–
show
|
|||
| 38 | */ |
||
|
0 ignored issues
–
show
|
|||
| 39 | 62 | public function getRunner($ids = null, $groups = null, $tags = null): Runner |
|
| 40 | { |
||
| 41 | 62 | $checks = $this->checkManager->findChecks($ids, $groups, $tags); |
|
| 42 | |||
| 43 | 62 | return new Runner(null, $checks); |
|
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
|
0 ignored issues
–
show
|
|||
| 47 | * @param ?string|string[] $ids |
||
|
0 ignored issues
–
show
|
|||
| 48 | * @param ?string|string[] $groups |
||
|
0 ignored issues
–
show
|
|||
| 49 | * @param ?string|string[] $tags |
||
|
0 ignored issues
–
show
|
|||
| 50 | * |
||
| 51 | * @return CheckInterface[] |
||
| 52 | */ |
||
| 53 | 12 | public function findChecks($ids = null, $groups = null, $tags = null): array |
|
| 54 | { |
||
| 55 | 12 | return $this->checkManager->findChecks($ids, $groups, $tags); |
|
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
|
0 ignored issues
–
show
|
|||
| 59 | * @param ?string|string[] $ids |
||
|
0 ignored issues
–
show
|
|||
| 60 | * @param ?string|string[] $groups |
||
|
0 ignored issues
–
show
|
|||
| 61 | * @param ?string|string[] $tags |
||
|
0 ignored issues
–
show
|
|||
| 62 | * |
||
| 63 | * @return CheckInterface[] |
||
| 64 | */ |
||
| 65 | 1 | public function findChecksSorted($ids = null, $groups = null, $tags = null): array |
|
| 66 | { |
||
| 67 | 1 | $checks = $this->findChecks($ids, $groups, $tags); |
|
| 68 | |||
| 69 | 1 | uasort($checks, static function (CheckInterface $a, CheckInterface $b) { |
|
|
0 ignored issues
–
show
|
|||
| 70 | 1 | return ($a->getGroup() === $b->getGroup()) ? 0 : ($a->getGroup() < $b->getGroup() ? -1 : 1); |
|
| 71 | 1 | }); |
|
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
| 72 | |||
| 73 | 1 | return $checks; |
|
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
|
0 ignored issues
–
show
|
|||
| 77 | * @param ?string|string[] $tags |
||
|
0 ignored issues
–
show
|
|||
| 78 | * |
||
| 79 | * @return Tag[] |
||
| 80 | */ |
||
| 81 | 12 | public function findTags($tags = null): array |
|
| 82 | { |
||
| 83 | 12 | return $this->checkManager->findTags($tags); |
|
|
0 ignored issues
–
show
|
|||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
|
0 ignored issues
–
show
|
|||
| 87 | * @param ?string|string[] $groups |
||
|
0 ignored issues
–
show
|
|||
| 88 | * |
||
| 89 | * @return Group[] |
||
| 90 | */ |
||
| 91 | 11 | public function findGroups($groups = null): array |
|
| 92 | { |
||
| 93 | 11 | return $this->checkManager->findGroups($groups); |
|
| 94 | } |
||
| 95 | } |
||
| 96 |