|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Jitamin. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (C) Jitamin Team |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Jitamin\Bus\Subscriber; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Bootstrap Subscriber. |
|
18
|
|
|
*/ |
|
19
|
|
|
class BootstrapSubscriber extends BaseSubscriber implements EventSubscriberInterface |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Get event listeners. |
|
23
|
|
|
* |
|
24
|
|
|
* @static |
|
25
|
|
|
* |
|
26
|
|
|
* @return array |
|
27
|
|
|
*/ |
|
28
|
|
|
public static function getSubscribedEvents() |
|
29
|
|
|
{ |
|
30
|
|
|
return [ |
|
31
|
|
|
'app.bootstrap' => 'execute', |
|
32
|
|
|
]; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Execute. |
|
37
|
|
|
*/ |
|
38
|
|
|
public function execute() |
|
39
|
|
|
{ |
|
40
|
|
|
$this->logger->debug('Subscriber executed: '.__METHOD__); |
|
|
|
|
|
|
41
|
|
|
$this->languageModel->loadCurrentLanguage(); |
|
|
|
|
|
|
42
|
|
|
$this->timezoneModel->setCurrentTimezone(); |
|
|
|
|
|
|
43
|
|
|
$this->actionManager->attachEvents(); |
|
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
if ($this->userSession->isLogged()) { |
|
|
|
|
|
|
46
|
|
|
$this->sessionStorage->hasSubtaskInProgress = $this->subtaskStatusModel->hasSubtaskInProgress($this->userSession->getId()); |
|
|
|
|
|
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Destruct of the subscriber. |
|
52
|
|
|
*/ |
|
53
|
|
|
public function __destruct() |
|
54
|
|
|
{ |
|
55
|
|
|
if (DEBUG) { |
|
56
|
|
|
foreach ($this->db->getLogMessages() as $message) { |
|
|
|
|
|
|
57
|
|
|
$this->logger->debug('SQL: '.$message); |
|
|
|
|
|
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
$this->logger->debug('APP: nb_queries={nb}', ['nb' => $this->db->getStatementHandler()->getNbQueries()]); |
|
|
|
|
|
|
61
|
|
|
$this->logger->debug('APP: rendering_time={time}', ['time' => microtime(true) - $this->request->getStartTime()]); |
|
|
|
|
|
|
62
|
|
|
$this->logger->debug('APP: memory_usage='.$this->helper->text->bytes(memory_get_usage())); |
|
|
|
|
|
|
63
|
|
|
$this->logger->debug('APP: uri='.$this->request->getUri()); |
|
|
|
|
|
|
64
|
|
|
$this->logger->debug('###############################################'); |
|
|
|
|
|
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.