| Total Complexity | 5 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 17 | final class TelephoneNumber extends AbstractMdElement implements ArrayizableElementInterface |
||
| 18 | { |
||
| 19 | use StringElementTrait; |
||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * @param string $content |
||
| 24 | */ |
||
| 25 | public function __construct(string $content) |
||
| 28 | } |
||
| 29 | |||
| 30 | |||
| 31 | /** |
||
| 32 | * Validate the content of the element. |
||
| 33 | * |
||
| 34 | * @param string $content The value to go in the XML textContent |
||
| 35 | * @throws \Exception on failure |
||
| 36 | * @return void |
||
| 37 | */ |
||
| 38 | protected function validateContent(string $content): void |
||
| 41 | } |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * Create a class from an array |
||
| 46 | * |
||
| 47 | * @param array $data |
||
| 48 | * @return static |
||
| 49 | */ |
||
| 50 | public static function fromArray(array $data): static |
||
| 51 | { |
||
| 52 | self::validateArray($data); |
||
| 53 | |||
| 54 | $index = array_key_first($data); |
||
| 55 | return new static($data[$index]); |
||
| 56 | } |
||
| 57 | |||
| 58 | |||
| 59 | /** |
||
| 60 | * Validate an array |
||
| 61 | * |
||
| 62 | * @param array $data |
||
| 63 | * @return void |
||
| 64 | */ |
||
| 65 | public static function validateArray(array $data): void |
||
| 70 | } |
||
| 71 | |||
| 72 | |||
| 73 | /** |
||
| 74 | * Create an array from this class |
||
| 75 | * |
||
| 76 | * @return array |
||
| 77 | */ |
||
| 78 | public function toArray(): array |
||
| 81 | } |
||
| 82 | } |
||
| 83 |