Completed
Push — master ( e9a9f0...13c004 )
by Vladimir
06:49
created

UIController::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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\Controller;
13
14
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
use Symfony\Component\HttpFoundation\Request;
16
use Tvi\MonitorBundle\Check\CheckInterface;
17
use Tvi\MonitorBundle\Runner\RunnerManager;
18
19
class UIController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UIController
Loading history...
20
{
21
    use TraitCommon;
22
23
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
24
     * @var RunnerManager
25
     */
26
    protected $runnerManager;
27
28 1
    public function __construct(RunnerManager $runnerManager)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
29
    {
30 1
        $this->runnerManager = $runnerManager;
31 1
    }
32
33
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $request should have a doc-comment as per coding-style.
Loading history...
34
     * @return \Symfony\Component\HttpFoundation\Response
35
     */
36 1
    public function indexAction(Request $request)
37
    {
38 1
        list($filterIds, $filterChecks, $filterGroups, $filterTags) = $this->getFilterParams($request);
39 1
        $filterChecks = $filterChecks ? $filterChecks : $filterIds;
40
41 1
        $groups = $this->runnerManager->findGroups();
42 1
        $tags = $this->runnerManager->findTags();
43 1
        $checks = $this->runnerManager->findChecks();
44
45 1
        $selectedChecks = $this->runnerManager->findChecks($filterChecks, $filterGroups, $filterTags);
46
47 1
        uasort($checks, static function (CheckInterface $a, CheckInterface $b) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
48 1
            return ($a->getGroup() === $b->getGroup()) ? 0 : ($a->getGroup() < $b->getGroup() ? -1 : 1);
49 1
        });
0 ignored issues
show
Coding Style introduced by
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...
50
51 1
        return $this->render('@TviMonitor/ui/index.html.twig', [
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
52 1
                'groups' => $groups,
53 1
                'tags' => $tags,
54 1
                'checks' => $checks,
55 1
                'filters' => ['checks' => $filterChecks, 'groups' => $filterGroups, 'tags' => $filterTags],
56 1
                'selectedChecks' => $selectedChecks,
57
            ]);
0 ignored issues
show
Coding Style introduced by
This line of the multi-line function call does not seem to be indented correctly. Expected 8 spaces, but found 12.
Loading history...
Coding Style introduced by
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...
58
    }
59
}
60