| Total Complexity | 6 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Header { |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | public $key; |
||
| 15 | |||
| 16 | /** @var string */ |
||
| 17 | private $_attributeName; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Header constructor. |
||
| 21 | * @param string $columnKey |
||
| 22 | */ |
||
| 23 | 45 | public function __construct(string $columnKey) |
|
| 24 | { |
||
| 25 | 45 | $this->_attributeName = $this->key = $columnKey; |
|
| 26 | 45 | } |
|
| 27 | |||
| 28 | /** |
||
| 29 | * Get the original attribute name. |
||
| 30 | * |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | 13 | public function getAttributeName() : string |
|
| 34 | { |
||
| 35 | 13 | return $this->_attributeName; |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param array $headerFormatters |
||
| 40 | * @return Header |
||
| 41 | */ |
||
| 42 | 44 | public function formatArray(array $headerFormatters) : Header |
|
| 43 | { |
||
| 44 | 44 | foreach ($headerFormatters as $formatter) |
|
| 45 | { |
||
| 46 | 12 | $this->format($formatter); |
|
| 47 | } |
||
| 48 | |||
| 49 | 44 | return $this; |
|
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @param HeaderFormatter $headerFormatter |
||
| 54 | * @return Header |
||
| 55 | */ |
||
| 56 | 12 | public function format(HeaderFormatter $headerFormatter) : Header |
|
| 57 | { |
||
| 58 | 12 | $headerFormatter->format($this); |
|
| 59 | |||
| 60 | 12 | return $this; |
|
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return string |
||
| 65 | */ |
||
| 66 | public function print() : string |
||
| 69 | } |
||
| 70 | } |