Total Complexity | 3 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
21 | final class TelephoneNumber extends AbstractMdElement implements |
||
22 | ArrayizableElementInterface, |
||
23 | SchemaValidatableElementInterface |
||
24 | { |
||
25 | use SchemaValidatableElementTrait; |
||
26 | use StringElementTrait; |
||
|
|||
27 | |||
28 | |||
29 | /** |
||
30 | * @param string $content |
||
31 | */ |
||
32 | public function __construct(string $content) |
||
35 | } |
||
36 | |||
37 | |||
38 | /** |
||
39 | * Create a class from an array |
||
40 | * |
||
41 | * @param array $data |
||
42 | * @return static |
||
43 | */ |
||
44 | public static function fromArray(array $data): static |
||
45 | { |
||
46 | Assert::allString($data, ArrayValidationException::class); |
||
47 | |||
48 | $index = array_key_first($data); |
||
49 | return new static($data[$index]); |
||
50 | } |
||
51 | |||
52 | |||
53 | /** |
||
54 | * Create an array from this class |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | public function toArray(): array |
||
61 | } |
||
62 | } |
||
63 |