Total Complexity | 3 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | abstract class AbstractHandler |
||
12 | { |
||
13 | protected EventDispatcherInterface $eventDispatcher; |
||
14 | |||
15 | public function __construct(EventDispatcherInterface $eventDispatcher) |
||
16 | { |
||
17 | $this->eventDispatcher = $eventDispatcher; |
||
18 | } |
||
19 | |||
20 | protected function getSiteFromRequest(ServerRequestInterface $request): SiteInterface |
||
21 | { |
||
22 | $site = $request->getAttribute('site'); |
||
23 | if (!($site instanceof SiteInterface)) { |
||
24 | throw new \Exception('Found no valid site object in request', 1_637_813_123); |
||
|
|||
25 | } |
||
26 | |||
27 | return $site; |
||
28 | } |
||
30 |