Completed
Push — master ( 6d6774...64f3ed )
by Jeroen
11:23 queued 05:13
created

DashboardController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 7
cp 0
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kunstmaan\DashboardBundle\Controller;
4
5
use Kunstmaan\DashboardBundle\Manager\WidgetManager;
6
use Kunstmaan\DashboardBundle\Widget\DashboardWidget;
7
use Symfony\Component\Routing\Annotation\Route;
8
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9
use Symfony\Component\HttpFoundation\Request;
10
11
class DashboardController extends Controller
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...e\Controller\Controller has been deprecated with message: since Symfony 4.2, use "Symfony\Bundle\FrameworkBundle\Controller\AbstractController" instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
12
{
13
    /**
14
     * The index action will render the main screen the users see when they log in in to the admin
15
     *
16
     * @Route("/", name="kunstmaan_dashboard")
17
     *
18
     * @param \Symfony\Component\HttpFoundation\Request $request
19
     *
20
     * @return array
0 ignored issues
show
Documentation introduced by
Should the return type not be \Symfony\Component\HttpFoundation\Response?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
21
     */
22
    public function indexAction(Request $request)
23
    {
24
        /** @var WidgetManager $widgetManager */
25
        $widgetManager = $this->get('kunstmaan_dashboard.manager.widgets');
26
        /** @var DashboardWidget[] $widgets */
27
        $widgets = $widgetManager->getWidgets();
28
        $segmentId = $request->query->get('segment');
29
30
        return $this->render('@KunstmaanDashboard/Dashboard/index.html.twig', array('widgets' => $widgets, 'id' => $segmentId));
31
    }
32
}
33