Passed
Push — master ( d5c6e8...acf3eb )
by Jean-Christophe
06:08
created

Display::getLinks()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
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
class Display {
10
	private static $links=[
11
							"Website"=>"https://ubiquity.kobject.net",
12
							"Guide"=>"https://micro-framework.readthedocs.io/en/latest/?badge=latest",
13
							"Documentation API"=>"https://api.kobject.net/ubiquity/",
14
							"GitHub"=>"https://github.com/phpMv/ubiquity"
15
	];
16
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 2
	public static function getLinks(){
26 2
		$links=self::$links;
27 2
		if (Framework::hasAdmin()) {
28 2
			$links['UbiquityMyAdmin']='Admin';
29
		}
30 2
		return $links;
31
	}
32
	
33 2
	public static function getPageInfos(){
34 2
		return ['Controller'=>Framework::getController(),
35 2
				'Action'=>Framework::getAction(),
36 2
				'Route'=>Framework::getUrl(),
37 2
				'Path'=>Router::path(''),
38 2
				'ActiveTheme'=>ThemesManager::getActiveTheme()
39
		];
40
	}
41
	
42 2
	public static function getDefaultPage(){
43 2
		$activeTheme=ThemesManager::getActiveTheme();
44 2
		if($activeTheme==null){
45
			$activeTheme="index";
46
		}
47 2
		return '@framework/index/'.$activeTheme.'.html';
48
	}
49
	
50 2
	public static function getThemes(){
51 2
		return ThemesManager::getAvailableThemes();
52
	}
53
}
54
55