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

Display::semanticMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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 = [ "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