Passed
Push — master ( 20b8ac...10939c )
by Jean-Christophe
06:31
created

Display   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 65%

Importance

Changes 0
Metric Value
wmc 8
eloc 17
dl 0
loc 33
ccs 13
cts 20
cp 0.65
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultPage() 0 6 3
A getPageInfos() 0 2 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 = [ "Website" => "https://ubiquity.kobject.net","Guide" => "https://micro-framework.readthedocs.io/en/latest/?badge=latest","Documentation API" => "https://api.kobject.net/ubiquity/","GitHub" => "https://github.com/phpMv/ubiquity" ];
11
12
	public static function semanticMenu($id, $semantic) {
13
		$links = self::getLinks ();
14
		$menu = $semantic->htmlMenu ( $id, array_keys ( $links ) );
15
		$menu->asLinks ( array_values ( $links ), 'new' );
16
		$menu->setSecondary ();
17
		return $menu;
18
	}
19
20 2
	public static function getLinks() {
21 2
		$links = self::$links;
22 2
		if (Framework::hasAdmin ()) {
23 2
			$links ['UbiquityMyAdmin'] = 'Admin';
24
		}
25 2
		return $links;
26
	}
27
28 2
	public static function getPageInfos() {
29 2
		return [ 'Controller' => Framework::getController (),'Action' => Framework::getAction (),'Route' => Framework::getUrl (),'Path' => Router::path ( '' ),'ActiveTheme' => ThemesManager::getActiveTheme () ];
30
	}
31
32 2
	public static function getDefaultPage() {
33 2
		$activeTheme = ThemesManager::getActiveTheme ();
34 2
		if ($activeTheme == null || ThemesManager::isCustom ( $activeTheme )) {
35
			$activeTheme = "index";
36
		}
37 2
		return '@framework/index/' . $activeTheme . '.html';
38
	}
39
40 2
	public static function getThemes() {
41 2
		return ThemesManager::getAvailableThemes ();
42
	}
43
}
44
45