Passed
Push — master ( 3c6fac...a2ff31 )
by Anthony
01:54
created

getLeftNavigationAction()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 9
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 18
rs 9.4285
1
<?php
2
namespace Ribs\RibsAdminBundle\Controller;
3
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\Response;
7
8
class NavigationBuilderController extends Controller
9
{
10
	public function getLeftNavigationAction()
11
	{
12
		$navigation = json_decode(file_get_contents($this->em->get('kernel')->getRootDir() . "/../src/Ribs/RibsAdminBundle/Resources/json/navigation.json"));
0 ignored issues
show
Bug Best Practice introduced by
The property em does not exist on Ribs\RibsAdminBundle\Con...gationBuilderController. Did you maybe forget to declare it?
Loading history...
13
		$menu = null;
14
		
15
		foreach ($navigation["items"] as $item) {
16
			if ($this->get("ribs_admin.acess_rights")->testRight($item["right"])) {
17
				$menu = [
18
					"url" => $item["url"]
19
				];
20
			}
21
		}
22
		
23
		dump($menu);
0 ignored issues
show
Bug introduced by
The function dump was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
		/** @scrutinizer ignore-call */ 
24
  dump($menu);
Loading history...
24
		
25
		return new Response();
26
		
27
		return $menu;
0 ignored issues
show
Unused Code introduced by
return $menu is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
28
	}
29
}