UIController::indexAction()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 17
ccs 13
cts 13
cp 1
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
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\Runner\RunnerManager;
17
18
class UIController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class UIController
Loading history...
19
{
20
    use TraitCommon;
21
22
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
23
     * @var RunnerManager
24
     */
25
    protected $runnerManager;
26
27
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
28
     * @var ?string
29
     */
30
    protected $template;
31
32 1
    public function __construct(RunnerManager $runnerManager, string $template = null)
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
33
    {
34 1
        $this->runnerManager = $runnerManager;
35 1
        $this->template = $template;
36 1
    }
37
38
    /**
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...
39
     * @return \Symfony\Component\HttpFoundation\Response
40
     */
41 1
    public function indexAction(Request $request)
42
    {
43 1
        list($filterIds, $filterChecks, $filterGroups, $filterTags) = $this->getFilterParams($request);
44 1
        $filterChecks = $filterChecks ? $filterChecks : $filterIds;
45
46 1
        $groups = $this->runnerManager->findGroups();
47 1
        $tags = $this->runnerManager->findTags();
48 1
        $checks = $this->runnerManager->findChecks();
49
50 1
        $selectedChecks = $this->runnerManager->findChecksSorted($filterChecks, $filterGroups, $filterTags);
51
52 1
        return $this->render($this->template ?? '@TviMonitor/UI/index.b4.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...
53 1
            'groups' => $groups,
54 1
            'tags' => $tags,
55 1
            'checks' => $checks,
56 1
            'filters' => ['checks' => $filterChecks, 'groups' => $filterGroups, 'tags' => $filterTags],
57 1
            'selectedChecks' => $selectedChecks,
58
        ]);
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...
59
    }
60
}
61