1 | <?php |
||
15 | class LanguageDetector implements Detector |
||
16 | { |
||
17 | /* ----------------------------------------------------------------- |
||
18 | | Properties |
||
19 | | ----------------------------------------------------------------- |
||
20 | */ |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $languages; |
||
26 | |||
27 | /* ----------------------------------------------------------------- |
||
28 | | Getters & Setters |
||
29 | | ----------------------------------------------------------------- |
||
30 | */ |
||
31 | |||
32 | /** |
||
33 | * Get the languages. |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | 18 | public function languages(): array |
|
41 | |||
42 | /** |
||
43 | * Get the languages keys. |
||
44 | * |
||
45 | * @return array |
||
46 | */ |
||
47 | 18 | public function keys(): array |
|
51 | |||
52 | /* ----------------------------------------------------------------- |
||
53 | | Main Methods |
||
54 | | ----------------------------------------------------------------- |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * Handle the given request. |
||
59 | * |
||
60 | * @param \Illuminate\Http\Request $request |
||
61 | * |
||
62 | * @return $this |
||
63 | */ |
||
64 | 372 | public function handle(Request $request): Detector |
|
70 | |||
71 | /** |
||
72 | * Handle from the given accept language. |
||
73 | * |
||
74 | * @param string $acceptLanguage |
||
75 | * |
||
76 | * @return $this |
||
77 | */ |
||
78 | 372 | public function fromAcceptLanguage(string $acceptLanguage): Detector |
|
88 | |||
89 | /* ----------------------------------------------------------------- |
||
90 | | Other Methods |
||
91 | | ----------------------------------------------------------------- |
||
92 | */ |
||
93 | |||
94 | /** |
||
95 | * Parse the accept language. |
||
96 | * |
||
97 | * @param string $acceptLanguage |
||
98 | */ |
||
99 | 372 | protected function parse(string $acceptLanguage): void |
|
112 | } |
||
113 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.