lochmueller /
language_detection
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Lochmueller\LanguageDetection\Handler; |
||
| 6 | |||
| 7 | use Psr\EventDispatcher\EventDispatcherInterface; |
||
| 8 | use Psr\Http\Message\ServerRequestInterface; |
||
| 9 | use TYPO3\CMS\Core\Site\Entity\SiteInterface; |
||
| 10 | |||
| 11 | abstract class AbstractHandler |
||
| 12 | { |
||
| 13 | public function __construct(protected EventDispatcherInterface $eventDispatcher) {} |
||
| 14 | |||
| 15 | protected function getSiteFromRequest(ServerRequestInterface $request): SiteInterface |
||
| 16 | { |
||
| 17 | $site = $request->getAttribute('site'); |
||
| 18 | if (!($site instanceof SiteInterface)) { |
||
| 19 | throw new \Exception('Found no valid site object in request', 1_637_813_123); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 20 | } |
||
| 21 | |||
| 22 | return $site; |
||
| 23 | } |
||
| 24 | } |
||
| 25 |