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.9.0 |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
use Quantum\Libraries\Captcha\CaptchaInterface; |
16
|
|
|
use Quantum\Libraries\Captcha\CaptchaManager; |
17
|
|
|
use Quantum\Libraries\Mailer\MailerInterface; |
18
|
|
|
use Quantum\Libraries\Session\SessionManager; |
19
|
|
|
use Quantum\Libraries\Mailer\MailerManager; |
20
|
|
|
use Quantum\Libraries\Asset\AssetManager; |
21
|
|
|
use Quantum\Exceptions\DatabaseException; |
22
|
|
|
use Quantum\Libraries\Cache\CacheManager; |
23
|
|
|
use Quantum\Exceptions\CaptchaException; |
24
|
|
|
use Quantum\Exceptions\ServiceException; |
25
|
|
|
use Quantum\Exceptions\SessionException; |
26
|
|
|
use Quantum\Exceptions\ConfigException; |
27
|
|
|
use Quantum\Exceptions\MailerException; |
28
|
|
|
use Quantum\Libraries\Auth\AuthManager; |
29
|
|
|
use Quantum\Libraries\Session\Session; |
30
|
|
|
use Quantum\Exceptions\LangException; |
31
|
|
|
use Quantum\Exceptions\AuthException; |
32
|
|
|
use Quantum\Libraries\Cookie\Cookie; |
33
|
|
|
use Quantum\Exceptions\AppException; |
34
|
|
|
use Quantum\Libraries\Auth\ApiAuth; |
35
|
|
|
use Quantum\Exceptions\DiException; |
36
|
|
|
use Quantum\Libraries\Auth\WebAuth; |
37
|
|
|
use Quantum\Libraries\Cache\Cache; |
38
|
|
|
use Quantum\Libraries\Csrf\Csrf; |
39
|
|
|
use Quantum\Hooks\HookManager; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Gets the session handler |
43
|
|
|
* @return Session |
44
|
|
|
* @throws ReflectionException |
45
|
|
|
* @throws DatabaseException |
46
|
|
|
* @throws SessionException |
47
|
|
|
* @throws ConfigException |
48
|
|
|
* @throws LangException |
49
|
|
|
* @throws DiException |
50
|
|
|
*/ |
51
|
|
|
function session(): Session |
52
|
|
|
{ |
53
|
|
|
return SessionManager::getHandler(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Gets cookie handler |
58
|
|
|
* @return Cookie |
59
|
|
|
*/ |
60
|
|
|
function cookie(): Cookie |
61
|
|
|
{ |
62
|
|
|
return Cookie::getInstance($_COOKIE); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Gets the Auth handler |
67
|
|
|
* @return ApiAuth|WebAuth |
68
|
|
|
* @throws AuthException |
69
|
|
|
* @throws ConfigException |
70
|
|
|
* @throws DiException |
71
|
|
|
* @throws LangException |
72
|
|
|
* @throws MailerException |
73
|
|
|
* @throws ReflectionException |
74
|
|
|
* @throws ServiceException |
75
|
|
|
*/ |
76
|
|
|
function auth() |
77
|
|
|
{ |
78
|
|
|
return AuthManager::getHandler(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Gets the Mail handler |
83
|
|
|
* @return MailerInterface |
84
|
|
|
* @throws ConfigException |
85
|
|
|
* @throws DiException |
86
|
|
|
* @throws LangException |
87
|
|
|
* @throws ReflectionException |
88
|
|
|
* @throws MailerException |
89
|
|
|
*/ |
90
|
|
|
function mailer(): MailerInterface |
91
|
|
|
{ |
92
|
|
|
return MailerManager::getHandler(); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Gets the AssetManager instance |
97
|
|
|
* @return AssetManager|null |
98
|
|
|
*/ |
99
|
|
|
function asset(): ?AssetManager |
100
|
|
|
{ |
101
|
|
|
return AssetManager::getInstance(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Gets the HookManager instance |
106
|
|
|
* @return HookManager |
107
|
|
|
*/ |
108
|
|
|
function hook(): HookManager |
109
|
|
|
{ |
110
|
|
|
return HookManager::getInstance(); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Gets the Cache handler |
115
|
|
|
* @return Cache |
116
|
|
|
* @throws ReflectionException |
117
|
|
|
* @throws ConfigException |
118
|
|
|
* @throws AppException |
119
|
|
|
* @throws DiException |
120
|
|
|
*/ |
121
|
|
|
function cache(): Cache |
122
|
|
|
{ |
123
|
|
|
return CacheManager::getHandler(); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Gets the Csrf instance |
128
|
|
|
* @return Csrf |
129
|
|
|
*/ |
130
|
|
|
function csrf(): Csrf |
131
|
|
|
{ |
132
|
|
|
return Csrf::getInstance(); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return CaptchaInterface |
137
|
|
|
* @throws ConfigException |
138
|
|
|
* @throws DiException |
139
|
|
|
* @throws ReflectionException |
140
|
|
|
* @throws CaptchaException |
141
|
|
|
*/ |
142
|
|
|
function captcha(): CaptchaInterface |
143
|
|
|
{ |
144
|
|
|
return CaptchaManager::getHandler(); |
145
|
|
|
} |
146
|
|
|
|