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

Display   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 70.83%

Importance

Changes 0
Metric Value
wmc 7
eloc 25
dl 0
loc 43
ccs 17
cts 24
cp 0.7083
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultPage() 0 6 2
A getPageInfos() 0 6 1
A semanticMenu() 0 6 1
A getLinks() 0 6 2
A getThemes() 0 2 1
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