Passed
Push — master ( b4cb9f...51bac7 )
by Anthony
02:22
created

getLeftNavigationAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace PiouPiou\RibsAdminBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class NavigationBuilderController extends Controller
9
{
10
	/**
11
	 * @return Response function that display the left navigation mapped by user rights
12
	 */
13
	public function getLeftNavigationAction(): Response
14
	{
15
		$navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath() . "/Resources/json/navigation.json"), true);
16
		$menu = [];
17
		
18
		foreach ($navigation["items"] as $item) {
19
			if ($this->get("ribs_admin.acess_rights")->testRight($item["right"])) {
20
				$menu[] = $item;
21
			}
22
		}
23
		
24
		return $this->render("@RibsAdmin/navigation.html.twig", ["navigation" => $menu]);
25
	}
26
}