Passed
Push — master ( d7f029...202469 )
by Jean-Christophe
15: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
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