1 | <?php |
||
63 | class App |
||
64 | { |
||
65 | /** |
||
66 | * Configuration |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected static $config; |
||
71 | /** |
||
72 | * Root directory |
||
73 | * |
||
74 | * @var string |
||
75 | */ |
||
76 | protected static $rootDirectory; |
||
77 | /** |
||
78 | * Entity manager |
||
79 | * |
||
80 | * @var EntityManager |
||
81 | */ |
||
82 | protected static $entityManager; |
||
83 | /** |
||
84 | * Developer mode |
||
85 | * |
||
86 | * @var boolean |
||
87 | */ |
||
88 | protected static $devMode; |
||
89 | /** |
||
90 | * Account service |
||
91 | * |
||
92 | * @var AccountService |
||
93 | */ |
||
94 | protected static $accountService = null; |
||
95 | /** |
||
96 | * Virtual host service |
||
97 | * |
||
98 | * @var VirtualHostService |
||
99 | */ |
||
100 | protected static $vhostService = null; |
||
101 | /** |
||
102 | * Domain service |
||
103 | * |
||
104 | * @var DomainService |
||
105 | */ |
||
106 | protected static $domainService = null; |
||
107 | /** |
||
108 | * Active Storage adapter |
||
109 | * |
||
110 | * @var StorageAdapterStrategyInterface |
||
111 | */ |
||
112 | protected static $storageAdapter; |
||
113 | /** |
||
114 | * Persistence adapter factory |
||
115 | * |
||
116 | * @var PersistenceAdapterFactoryInterface |
||
117 | */ |
||
118 | protected static $persistenceAdapterFactory; |
||
119 | /** |
||
120 | * Persistence service |
||
121 | * |
||
122 | * @var PersistenceServiceInterface |
||
123 | */ |
||
124 | protected static $persistenceService; |
||
125 | /** |
||
126 | * Service service |
||
127 | * |
||
128 | * @var ServiceServiceInterface |
||
129 | */ |
||
130 | protected static $serviceService; |
||
131 | /** |
||
132 | * Application level messages |
||
133 | * |
||
134 | * @var array |
||
135 | */ |
||
136 | protected static $messages = []; |
||
137 | /** |
||
138 | * App domain |
||
139 | * |
||
140 | * @var string |
||
141 | */ |
||
142 | const DOMAIN = 'admin'; |
||
143 | |||
144 | /** |
||
145 | * Bootstrap |
||
146 | * |
||
147 | * @see https://github.com/toggl/toggl_api_docs/blob/master/reports.md |
||
148 | * @see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/configuration.html |
||
149 | * |
||
150 | * @param bool $devMode Developer mode |
||
151 | */ |
||
152 | public static function bootstrap($devMode = false) |
||
170 | |||
171 | /** |
||
172 | * Initialize Doctrine |
||
173 | */ |
||
174 | protected static function initializeDoctrine() |
||
208 | |||
209 | /** |
||
210 | * Return the entity manager |
||
211 | * |
||
212 | * @return EntityManager |
||
213 | */ |
||
214 | public static function getEntityManager() |
||
218 | |||
219 | /** |
||
220 | * Get a configuration value |
||
221 | * |
||
222 | * @param null $key Optional: config value key |
||
223 | * @return mixed Configuration value(s) |
||
224 | */ |
||
225 | 3 | public static function getConfig($key = null) |
|
240 | |||
241 | /** |
||
242 | * Return the contents of a particular template |
||
243 | * |
||
244 | * @param string $template Template name |
||
245 | * @param bool $useDefault Use a default template |
||
246 | * @return string template contents |
||
247 | */ |
||
248 | public static function getTemplate($template, $useDefault = false) |
||
262 | |||
263 | /** |
||
264 | * Return the account service |
||
265 | * |
||
266 | * @return AccountService Account service |
||
267 | */ |
||
268 | public static function getAccountService() |
||
276 | |||
277 | /** |
||
278 | * Return the virtual host service |
||
279 | * |
||
280 | * @return VirtualHostService Virtual host service |
||
281 | */ |
||
282 | public static function getVirtualHostService() |
||
290 | |||
291 | /** |
||
292 | * Return the domain service |
||
293 | * |
||
294 | * @return DomainService Domain service |
||
295 | */ |
||
296 | public static function getDomainService() |
||
304 | |||
305 | /** |
||
306 | * Return the shell service service |
||
307 | * |
||
308 | * @return ServiceServiceInterface Service service |
||
309 | */ |
||
310 | public static function getServiceService() |
||
314 | |||
315 | /** |
||
316 | * Add an application level message |
||
317 | * |
||
318 | * @param string $message Message |
||
319 | * @param string $level Log level |
||
320 | */ |
||
321 | public static function addMessage($message, $level = LogLevel::INFO) |
||
328 | |||
329 | /** |
||
330 | * Return all application level messages |
||
331 | * |
||
332 | * @return array Messages |
||
333 | */ |
||
334 | public static function getMessages() |
||
338 | } |
||
339 |