DashboardNavMenu   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A items() 0 20 4
1
<?php 
2
3
namespace Epesi\Base\Dashboard\Integration;
4
5
use Epesi\Core\Layout\Integration\Joints\NavMenuJoint;
6
use Illuminate\Support\Facades\Auth;
7
use Epesi\Core\System\Modules\ModuleView;
0 ignored issues
show
Bug introduced by
The type Epesi\Core\System\Modules\ModuleView was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Epesi\Base\Dashboard\Models\Dashboard;
9
10
class DashboardNavMenu extends NavMenuJoint
11
{
12
	public function items()
13
	{
14
		$ret = [];
15
		
16
		foreach (Dashboard::create()->addCondition('user_id', Auth::id())->setOrder('position') as $dashboard) {
17
			$ret[$dashboard['name']] = [
18
					'access' => true,
19
					'weight' => $dashboard['position'],
20
					'action' => ModuleView::moduleLink('dashboard', 'body', ['dashboard' => $dashboard->id])
21
			];
22
		}
23
24
		return $ret? [
25
				__('DASHBOARD') => count($ret) > 1? [
26
				        'item' => ['icon' => 'tachometer alternate'],
27
						'access' => true,
28
						'group' => $ret,
29
						'weight' => -10000
30
				]: array_merge(reset($ret), ['weight' => -10000]),
31
		]: [];
32
	}
33
}