| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | class CombinationFormatter implements DataFormatterInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var DataFormatterInterface[] |
||
| 11 | */ |
||
| 12 | protected $formatters = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * |
||
| 16 | */ |
||
| 17 | 9 | public function __construct(DataFormatterInterface ...$formatters) |
|
| 18 | { |
||
| 19 | 9 | $this->formatters = $formatters; |
|
| 20 | 9 | } |
|
| 21 | |||
| 22 | /** |
||
| 23 | * Get the value of formatters |
||
| 24 | * |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | 3 | public function getFormatters(): array |
|
| 28 | { |
||
| 29 | 3 | return $this->formatters; |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * |
||
| 34 | */ |
||
| 35 | 3 | public function formatData($value) |
|
| 36 | { |
||
| 37 | 3 | foreach ($this->formatters as $formatter) { |
|
| 38 | 3 | $value = $formatter->formatData($value); |
|
| 39 | } |
||
| 40 | |||
| 41 | 3 | return $value; |
|
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * |
||
| 46 | */ |
||
| 47 | 3 | public function formatInput($value) |
|
| 54 | } |
||
| 55 | } |
||
| 56 |