Total Complexity | 13 |
Total Lines | 72 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class CompositeTranslator implements Translator |
||
16 | { |
||
17 | protected $translators = array(); |
||
18 | |||
19 | /** |
||
20 | * @{inheritDoc} |
||
21 | */ |
||
22 | 2 | public function translateKeyInput($keyName) |
|
23 | { |
||
24 | 2 | foreach ($this->translators as $translator) { |
|
25 | 2 | if (false !== ($translation = $translator->translateKeyInput($keyName))) { |
|
26 | 2 | return $translation; |
|
27 | } |
||
28 | } |
||
29 | |||
30 | 1 | return false; |
|
|
|||
31 | } |
||
32 | |||
33 | |||
34 | /** |
||
35 | * @{inheritDoc} |
||
36 | */ |
||
37 | 1 | public function translateValueInput($keyName, $value) |
|
38 | { |
||
39 | 1 | foreach ($this->translators as $translator) { |
|
40 | 1 | if (false !== ($translation = $translator->translateValueInput($keyName, $value))) { |
|
41 | 1 | return $translation; |
|
42 | } |
||
43 | } |
||
44 | |||
45 | 1 | return false; |
|
46 | } |
||
47 | |||
48 | |||
49 | /** |
||
50 | * @{inheritDoc} |
||
51 | */ |
||
52 | 2 | public function translateKeyOutput($keyName) |
|
53 | { |
||
54 | 2 | foreach ($this->translators as $translator) { |
|
55 | 2 | if (false !== ($translation = $translator->translateKeyOutput($keyName))) { |
|
56 | 2 | return $translation; |
|
57 | } |
||
58 | } |
||
59 | |||
60 | 1 | return false; |
|
61 | } |
||
62 | |||
63 | |||
64 | /** |
||
65 | * @{inheritDoc} |
||
66 | */ |
||
67 | 1 | public function translateValueOutput($keyName, $value) |
|
76 | } |
||
77 | |||
78 | |||
79 | /** |
||
80 | * @{inheritDoc} |
||
81 | */ |
||
82 | 2 | public function add(Translator $translator) |
|
89 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: