Skip to content

Commit 8344f48

Browse files
author
Maxofil
committed
oprava
1 parent 4a53d80 commit 8344f48

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"require": {
1414
"php": ">=7.4",
1515
"nette/application": "^3.0",
16-
"nette/caching": "^3.0"
16+
"nette/caching": "^3.0",
17+
"nette/utils": "^3.0"
1718
},
1819
"autoload": {
1920
"psr-4": {

src/ObserverComponent/EventMapper.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44

55
namespace Infinityloop\ObserverComponent;
66

7-
class EventMapper
7+
final class EventMapper
88
{
9+
use Nette\SmartObject;
10+
911
private \Nette\Application\Application $application;
1012
private \Nette\Caching\IStorage $storage;
1113
private ?\Nette\Caching\Cache $eventMap = null;
1214
private bool $debugMode;
1315

1416
public function __construct(
1517
\Nette\Application\Application $application,
16-
\Nette\Caching\IStorage $storage
18+
\Nette\Caching\IStorage $storage,
19+
bool $debugMode
1720
)
1821
{
1922
$this->application = $application;
2023
$this->storage = $storage;
21-
$this->debugMode = \App\Bootstrap::isDebugMode();
24+
$this->debugMode = $debugMode;
2225
}
2326

2427
public function registerObserver(IObserverComponent $component) : void
@@ -65,7 +68,8 @@ public function dispatchEvent(IEvent $event) : void
6568

6669
private function getObserverList(string $eventName) : array
6770
{
68-
return $this->getEventMap()->load($eventName) ?? [];
71+
return $this->getEventMap()->load($eventName)
72+
?? [];
6973
}
7074

7175
private function isComponentRegistered(string $componentPath) : bool

0 commit comments

Comments
 (0)