1 | <?php |
||
5 | class PhoneNumberMatch |
||
6 | { |
||
7 | /** |
||
8 | * The start index into the text. |
||
9 | * @var int |
||
10 | */ |
||
11 | private $start; |
||
12 | |||
13 | /** |
||
14 | * The raw substring matched. |
||
15 | * @var string |
||
16 | */ |
||
17 | private $rawString; |
||
18 | |||
19 | /** |
||
20 | * The matched phone number. |
||
21 | * @var PhoneNumber |
||
22 | */ |
||
23 | private $number; |
||
24 | |||
25 | /** |
||
26 | * Creates a new match |
||
27 | * |
||
28 | * @param int $start The start index into the target text |
||
29 | * @param string $rawString The matched substring of the target text |
||
30 | * @param PhoneNumber $number The matched phone number |
||
31 | * @throws \NullPointerException |
||
32 | */ |
||
33 | public function __construct($start, $rawString, PhoneNumber $number) |
||
47 | |||
48 | /** |
||
49 | * Returns the phone number matched by the receiver. |
||
50 | * @return PhoneNumber |
||
51 | */ |
||
52 | public function number() |
||
56 | |||
57 | /** |
||
58 | * Returns the start index of the matched phone number within the searched text. |
||
59 | * @return int |
||
60 | */ |
||
61 | public function start() |
||
65 | |||
66 | /** |
||
67 | * Returns the exclusive end index of the matched phone number within the searched text. |
||
68 | * @return int |
||
69 | */ |
||
70 | public function end() |
||
74 | |||
75 | /** |
||
76 | * Returns the raw string matched as a phone number in the searched text. |
||
77 | * @return string |
||
78 | */ |
||
79 | public function rawString() |
||
83 | |||
84 | public function __toString() |
||
88 | } |
||
89 |