Total Complexity | 7 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 92.31% |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
15 | 1 | final class ParamLocaleResolver implements IAppRequestAwareLocaleResolver { |
|
16 | 1 | use \Nette\SmartObject; |
|
17 | |||
18 | /** @var Request|null */ |
||
19 | protected $request = null; |
||
20 | /** @var string */ |
||
21 | protected $param = "locale"; |
||
22 | |||
23 | public function getParam(): string { |
||
24 | 1 | return $this->param; |
|
25 | } |
||
26 | |||
27 | public function setParam(string $param): void { |
||
28 | 1 | $this->param = $param; |
|
29 | 1 | } |
|
30 | |||
31 | public function onRequest(Application $application, Request $request): void { |
||
32 | 1 | $locale = $request->getParameter($this->param); |
|
33 | 1 | if($request->method === Request::FORWARD && $locale === null) { |
|
34 | return; |
||
35 | } |
||
36 | 1 | $this->request = $request; |
|
37 | 1 | } |
|
38 | |||
39 | public function resolve(): ?string { |
||
44 | } |
||
45 | } |
||
46 | ?> |