1 | <?php |
||
8 | final class MacAddress extends Natural |
||
9 | { |
||
10 | public function __construct($value) |
||
11 | { |
||
12 | $options = array( |
||
13 | 'options' => array( |
||
14 | 'max_range' => pow(2, 48) - 1 |
||
15 | ) |
||
16 | ); |
||
17 | |||
18 | $value = filter_var($value, FILTER_VALIDATE_INT, $options); |
||
19 | |||
20 | if (false === $value) { |
||
21 | throw new InvalidNativeArgumentException($value, array('mac address (<= 281,474,976,710,655)')); |
||
22 | } |
||
23 | |||
24 | parent::__construct($value); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param string $value |
||
29 | * @return MacAddress |
||
30 | * @throws InvalidNativeArgumentException |
||
31 | */ |
||
32 | public static function fromString($value) |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | public function toStringWithDash() |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | public function toStringWithColon() |
||
58 | |||
59 | /** |
||
60 | * @return string |
||
61 | */ |
||
62 | public function toStringWithDot() |
||
66 | } |
||
67 |