Passed
Push — master ( b68a78...d29a76 )
by Jean-Christophe
16:10 queued 03:52
created

Framework   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 17
eloc 25
c 1
b 0
f 0
dl 0
loc 89
ccs 40
cts 40
cp 1
rs 10

17 Methods

Rating   Name   Duplication   Size   Complexity  
A getAction() 0 2 1
A getController() 0 2 1
A hasAdmin() 0 2 1
A getVersion() 0 2 1
A getUrl() 0 2 1
A getRequest() 0 2 1
A getCookies() 0 2 1
A getTranslator() 0 2 1
A getNormalizer() 0 2 1
A getORM() 0 2 1
A getSession() 0 2 1
A getAssets() 0 2 1
A getRouter() 0 2 1
A getCacheSystem() 0 2 1
A diBootstrap() 0 5 1
A diSemantic() 0 5 1
A getAnnotationsEngine() 0 2 1
1
<?php
2
3
/**
4
 * Ubiquity\core
5
 * This class is part of Ubiquity
6
 * @author jc
7
 * @version 1.0.0
8
 *
9
 */
10
namespace Ubiquity\core;
11
12
use Ubiquity\assets\AssetsManager;
13
use Ubiquity\contents\normalizers\NormalizersManager;
14
use Ubiquity\controllers\Router;
15
use Ubiquity\controllers\Startup;
16
use Ubiquity\orm\OrmUtils;
17
use Ubiquity\translation\TranslatorManager;
18
use Ubiquity\utils\http\UCookie;
19
use Ubiquity\utils\http\URequest;
20
use Ubiquity\utils\http\USession;
21
use Ubiquity\cache\CacheManager;
22
23
class Framework {
24
	public const version = '~2.4.0';
25
26 4
	public static function getVersion() {
27 4
		return self::version;
28
	}
29
30 4
	public static function getController() {
31 4
		return Startup::getController ();
32
	}
33
34 5
	public static function getAction() {
35 5
		return Startup::getAction ();
36
	}
37
38 4
	public static function getUrl() {
39 4
		return \implode ( "/", Startup::$urlParts );
40
	}
41
42 1
	public static function getRouter() {
43 1
		return new Router ();
44
	}
45
46 1
	public static function getORM() {
47 1
		return new OrmUtils ();
48
	}
49
50 1
	public static function getRequest() {
51 1
		return new URequest ();
52
	}
53
54 1
	public static function getSession() {
55 1
		return new USession ();
56
	}
57
58 1
	public static function getCookies() {
59 1
		return new UCookie ();
60
	}
61
62 1
	public static function getTranslator() {
63 1
		return new TranslatorManager ();
64
	}
65
66 1
	public static function getNormalizer() {
67 1
		return new NormalizersManager ();
68
	}
69
70 4
	public static function hasAdmin() {
71 4
		return \class_exists ( "controllers\Admin" );
72
	}
73
74 1
	public static function getAssets() {
75 1
		return new AssetsManager ();
76
	}
77
78 3
	public static function getCacheSystem(){
79 3
		return \get_class(CacheManager::$cache);
80
	}
81
82 3
	public static function getAnnotationsEngine(){
83 3
		return \get_class(CacheManager::getAnnotationsEngineInstance());
84
	}
85
86
	/**
87
	 * Returns an instance of JsUtils initialized with Semantic (for di injection)
88
	 *
89
	 * @param \Ubiquity\controllers\Controller $controller
90
	 * @param array $options
91
	 * @return \Ajax\php\ubiquity\JsUtils
92
	 */
93 43
	public static function diSemantic($controller, $options = [ 'defer' => true,'gc' => true ]) {
94 43
		$jquery = new \Ajax\php\ubiquity\JsUtils ( $options, $controller );
95 43
		$jquery->semantic ( new \Ajax\Semantic () );
96 43
		$jquery->setAjaxLoader ( "<div class=\"ui active centered inline text loader\">Loading</div>" );
97 43
		return $jquery;
98
	}
99
100
	/**
101
	 * Returns an instance of JsUtils initialized with Bootstrap (for di injection)
102
	 *
103
	 * @param \Ubiquity\controllers\Controller $controller
104
	 * @param array $options
105
	 * @return \Ajax\php\ubiquity\JsUtils
106
	 */
107 1
	public static function diBootstrap($controller, $options = [ 'defer' => true,'gc' => true ]) {
108 1
		$jquery = new \Ajax\php\ubiquity\JsUtils ( $options, $controller );
109 1
		$jquery->bootstrap ( new \Ajax\Bootstrap () );
110 1
		$jquery->setAjaxLoader ( "<div class=\"ui active centered inline text loader\">Loading</div>" );
111 1
		return $jquery;
112
	}
113
}
114
115