Conditions | 5 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | function translator(string $translator = null, string $key = null) |
||
17 | { |
||
18 | if ($translator !== null && $key === null) { |
||
19 | throw new Exception( |
||
20 | 'Please set translation key' |
||
21 | ); |
||
22 | } |
||
23 | |||
24 | if ($translator === null && $key === null) { |
||
25 | throw new Exception( |
||
26 | 'Please provide translator and translation key' |
||
27 | ); |
||
28 | } |
||
29 | |||
30 | return app($translator)->get($key); |
||
31 | } |
||
33 |