Test Failed
Push — master ( ac669c...c918ec )
by Jean-Christophe
08:37
created

Display::semanticMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Ubiquity\core\postinstall;
4
5
use Ubiquity\core\Framework;
6
use Ubiquity\themes\ThemesManager;
7
use Ubiquity\controllers\Router;
8
9 2
class Display {
10 2
	private static $links=[
11 2
							"Website"=>"https://ubiquity.kobject.net",
12 2
							"Guide"=>"https://micro-framework.readthedocs.io/en/latest/?badge=latest",
13 2
							"Documentation API"=>"https://api.kobject.net/ubiquity/",
14 2
							"GitHub"=>"https://github.com/phpMv/ubiquity"
15
	];
16 2
17
	public static function semanticMenu($id, $semantic) {
18
		$links=self::getLinks();
19
		$menu=$semantic->htmlMenu($id, array_keys($links));
20
		$menu->asLinks(array_values($links), 'new');
21
		$menu->setSecondary();
22
		return $menu;
23
	}
24
	
25
	public static function getLinks(){
26
		$links=self::$links;
27
		if (Framework::hasAdmin()) {
28
			$links['UbiquityMyAdmin']='Admin';
29
		}
30
		return $links;
31
	}
32
	
33
	public static function getPageInfos(){
34
		return ['Controller'=>Framework::getController(),
35
				'Action'=>Framework::getAction(),
36
				'Route'=>Framework::getUrl(),
37
				'Path'=>Router::path(''),
38
				'ActiveTheme'=>ThemesManager::getActiveTheme()
39
		];
40
	}
41
	
42
	public static function getDefaultPage(){
43
		$activeTheme=ThemesManager::getActiveTheme();
44
		if($activeTheme==null){
45
			$activeTheme="index";
46
		}
47
		return '@framework/index/'.$activeTheme.'.html';
48
	}
49
	
50
	public static function getThemes(){
51
		return ThemesManager::getAvailableThemes();
52
	}
53
}
54
55