1 | <?php |
||
8 | class Translation |
||
9 | { |
||
10 | /** |
||
11 | * Setup public vars. |
||
12 | */ |
||
13 | public $translation; |
||
14 | public $translator; |
||
15 | public $string; |
||
16 | public $debug; |
||
17 | public $from; |
||
18 | public $to; |
||
19 | public $save; |
||
20 | public $vars; |
||
21 | public $load; |
||
22 | |||
23 | /** |
||
24 | * Setup default values. |
||
25 | * |
||
26 | * @param string $string |
||
27 | */ |
||
28 | public function __construct($string, $vars = []) |
||
50 | |||
51 | /** |
||
52 | * Setup debug value. |
||
53 | * |
||
54 | * @param bool $debug |
||
55 | */ |
||
56 | public function debug($debug) |
||
62 | |||
63 | /** |
||
64 | * Setup fromLang value. |
||
65 | * |
||
66 | * @param string $lang |
||
67 | */ |
||
68 | public function from($lang) |
||
74 | |||
75 | /** |
||
76 | * Setup tolang value. |
||
77 | * |
||
78 | * @param string $lang |
||
79 | */ |
||
80 | public function to($lang) |
||
86 | |||
87 | /** |
||
88 | * Setup translator. |
||
89 | * |
||
90 | * @param string $translator |
||
91 | */ |
||
92 | public function translator($translator) |
||
98 | |||
99 | /** |
||
100 | * Setup save option. |
||
101 | * |
||
102 | * @param bool $save |
||
103 | */ |
||
104 | public function Save($save) |
||
110 | |||
111 | /** |
||
112 | * Setup load option. |
||
113 | * |
||
114 | * @param bool $load |
||
115 | */ |
||
116 | public function load($load) |
||
122 | |||
123 | public function loadIfExists() |
||
143 | |||
144 | /** |
||
145 | * Function to save translations to DB. |
||
146 | */ |
||
147 | public function checkSave() |
||
169 | |||
170 | /** |
||
171 | * This fuction is called to know the status of host, and it would set translation if debug is true. |
||
172 | * |
||
173 | * @param string $host |
||
174 | */ |
||
175 | public function checkHost($host) |
||
188 | |||
189 | private function replaceVars() |
||
195 | |||
196 | /** |
||
197 | * This fuction is called by trans() function of Fadade Laralang |
||
198 | * It would call run() function of this class and returns the translation. |
||
199 | */ |
||
200 | public function __toString() |
||
215 | } |
||
216 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.