| Total Complexity | 13 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class CompositeTranslator implements Translator |
||
| 16 | { |
||
| 17 | protected $translators = []; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @{inheritDoc} |
||
| 21 | */ |
||
| 22 | public function translateKeyInput($keyName) |
||
| 23 | { |
||
| 24 | foreach ($this->translators as $translator) { |
||
| 25 | if (false !== ($translation = $translator->translateKeyInput($keyName))) { |
||
| 26 | return $translation; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | return false; |
||
|
|
|||
| 31 | } |
||
| 32 | |||
| 33 | |||
| 34 | /** |
||
| 35 | * @{inheritDoc} |
||
| 36 | */ |
||
| 37 | public function translateValueInput($keyName, $value) |
||
| 38 | { |
||
| 39 | foreach ($this->translators as $translator) { |
||
| 40 | if (false !== ($translation = $translator->translateValueInput($keyName, $value))) { |
||
| 41 | return $translation; |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | return false; |
||
| 46 | } |
||
| 47 | |||
| 48 | |||
| 49 | /** |
||
| 50 | * @{inheritDoc} |
||
| 51 | */ |
||
| 52 | public function translateKeyOutput($keyName) |
||
| 53 | { |
||
| 54 | foreach ($this->translators as $translator) { |
||
| 55 | if (false !== ($translation = $translator->translateKeyOutput($keyName))) { |
||
| 56 | return $translation; |
||
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | return false; |
||
| 61 | } |
||
| 62 | |||
| 63 | |||
| 64 | /** |
||
| 65 | * @{inheritDoc} |
||
| 66 | */ |
||
| 67 | public function translateValueOutput($keyName, $value) |
||
| 76 | } |
||
| 77 | |||
| 78 | |||
| 79 | /** |
||
| 80 | * @{inheritDoc} |
||
| 81 | */ |
||
| 82 | 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: