CheckLanguageDetectionEvent::getRequest()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lochmueller\LanguageDetection\Event;
6
7
use Psr\EventDispatcher\StoppableEventInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use TYPO3\CMS\Core\Site\Entity\SiteInterface;
10
11
final class CheckLanguageDetectionEvent extends AbstractEvent implements StoppableEventInterface
12
{
13
    private bool $handle = true;
14
15
    public function __construct(
16
        private SiteInterface $site,
17
        private ServerRequestInterface $request
18
    ) {}
19
20
    public function getSite(): SiteInterface
21
    {
22
        return $this->site;
23
    }
24
25
    public function getRequest(): ServerRequestInterface
26
    {
27
        return $this->request;
28
    }
29
30
    public function isLanguageDetectionEnable(): bool
31
    {
32
        return $this->handle;
33
    }
34
35
    public function disableLanguageDetection(): void
36
    {
37
        $this->handle = false;
38
    }
39
40
    public function isPropagationStopped(): bool
41
    {
42
        return !$this->isLanguageDetectionEnable();
43
    }
44
}
45