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