Conditions | 3 |
Paths | 5 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
37 | public function translate(string $string) : string |
||
38 | { |
||
39 | try { |
||
40 | sleep(random_int(1, 3)); |
||
41 | |||
42 | return $this->translator->translate($string); |
||
43 | } catch (\Throwable $th) { |
||
44 | if ($th->getMessage() === 'Return value of Stichoza\GoogleTranslate\GoogleTranslate::translate() must be of the type string, null returned') { |
||
45 | throw LanguageCodeNotExist::throw($this->source, $this->target); |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 |