1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Quantum PHP Framework |
5
|
|
|
* |
6
|
|
|
* An open source software development framework for PHP |
7
|
|
|
* |
8
|
|
|
* @package Quantum |
9
|
|
|
* @author Arman Ag. <[email protected]> |
10
|
|
|
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org) |
11
|
|
|
* @link http://quantum.softberg.org/ |
12
|
|
|
* @since 2.6.0 |
13
|
|
|
*/ |
14
|
|
|
use Quantum\Libraries\Session\SessionManager; |
15
|
|
|
use Quantum\Libraries\Encryption\Cryptor; |
16
|
|
|
use Quantum\Libraries\Asset\AssetManager; |
17
|
|
|
use Quantum\Libraries\Cache\CacheManager; |
18
|
|
|
use Quantum\Libraries\Auth\AuthManager; |
19
|
|
|
use Quantum\Libraries\Session\Session; |
20
|
|
|
use Quantum\Libraries\Cookie\Cookie; |
21
|
|
|
use Quantum\Libraries\Mailer\Mailer; |
22
|
|
|
use Quantum\Libraries\Cache\Cache; |
23
|
|
|
use Quantum\Hooks\HookManager; |
24
|
|
|
use Quantum\Di\Di; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Gets the session handler |
28
|
|
|
* @return \Quantum\Libraries\Session\Session |
29
|
|
|
* @throws \Quantum\Exceptions\DatabaseException |
30
|
|
|
* @throws \Quantum\Exceptions\SessionException |
31
|
|
|
*/ |
32
|
|
|
function session(): Session |
33
|
|
|
{ |
34
|
|
|
return SessionManager::getHandler(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Gets cookie handler |
39
|
|
|
* @return \Quantum\Libraries\Cookie\Cookie |
40
|
|
|
*/ |
41
|
|
|
function cookie(): Cookie |
42
|
|
|
{ |
43
|
|
|
return new Cookie($_COOKIE, new Cryptor); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Gets the Auth handler |
48
|
|
|
* @return \Quantum\Libraries\Auth\ApiAuth|\Quantum\Libraries\Auth\WebAuth |
49
|
|
|
* @throws \Quantum\Exceptions\AuthException |
50
|
|
|
* @throws \Quantum\Exceptions\ConfigException |
51
|
|
|
* @throws \Quantum\Exceptions\DiException |
52
|
|
|
* @throws \ReflectionException |
53
|
|
|
*/ |
54
|
|
|
function auth() |
55
|
|
|
{ |
56
|
|
|
return AuthManager::getHandler(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Gets the Mail instance |
61
|
|
|
* @return \Quantum\Libraries\Mailer\Mailer |
62
|
|
|
* @throws \Quantum\Exceptions\DiException |
63
|
|
|
* @throws \ReflectionException |
64
|
|
|
*/ |
65
|
|
|
function mailer(): Mailer |
66
|
|
|
{ |
67
|
|
|
return Di::get(Mailer::class); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Gets the AssetManager instance |
72
|
|
|
* @return \Quantum\Libraries\Asset\AssetManager|null |
73
|
|
|
*/ |
74
|
|
|
function asset(): ?AssetManager |
75
|
|
|
{ |
76
|
|
|
return AssetManager::getInstance(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Gets the HookManager instance |
81
|
|
|
* @return \Quantum\Hooks\HookManager |
82
|
|
|
*/ |
83
|
|
|
function hook(): HookManager |
84
|
|
|
{ |
85
|
|
|
return HookManager::getInstance(); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Gets the Cache handler |
90
|
|
|
* @return \Quantum\Libraries\Cache\Cache |
91
|
|
|
*/ |
92
|
|
|
function cache(): Cache |
93
|
|
|
{ |
94
|
|
|
return CacheManager::getHandler(); |
95
|
|
|
} |
96
|
|
|
|