Passed
Push — master ( d7f029...202469 )
by Jean-Christophe
15:08
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
8
/**
9
 * Ubiquity\core\postinstall$Display
10
 * This class is part of Ubiquity
11
 *
12
 * @author jc
13
 * @version 1.0.0
14
 *
15
 */
16
class Display {
17
	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" ];
18
19
	public static function semanticMenu($id, $semantic) {
20
		$links = self::getLinks ();
21
		$menu = $semantic->htmlMenu ( $id, \array_keys ( $links ) );
22
		$menu->asLinks ( \array_values ( $links ), 'new' );
23
		$menu->setSecondary ();
24
		return $menu;
25
	}
26
27 3
	public static function getLinks() {
28 3
		$links = self::$links;
29 3
		if (Framework::hasAdmin ()) {
30 3
			$links ['Webtools'] = 'Admin';
31
		}
32 3
		return $links;
33
	}
34
35 3
	public static function getPageInfos() {
36 3
		return [ 'Controller' => Framework::getController (),'Action' => Framework::getAction (),'Route' => Framework::getUrl (),'Path' => '/','ActiveTheme' => ThemesManager::getActiveTheme () ?? 'none'];
37
	}
38
39 3
	public static function getDefaultPage() {
40 3
		$activeTheme = ThemesManager::getActiveTheme ();
41 3
		if ($activeTheme == null || ThemesManager::isCustom ( $activeTheme )) {
42
			$activeTheme = "index";
43
		}
44 3
		return '@framework/index/' . $activeTheme . '.html';
45
	}
46
47 3
	public static function getThemes() {
48 3
		return ThemesManager::getAvailableThemes ();
49
	}
50
}
51
52