1 | <?php namespace Propaganistas\LaravelPhone\Rules; |
||
6 | class Phone |
||
7 | { |
||
8 | use ParsesCountries, |
||
9 | ParsesTypes; |
||
10 | |||
11 | /** |
||
12 | * The provided phone countries. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $countries = []; |
||
17 | |||
18 | /** |
||
19 | * The provided phone types. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $types = []; |
||
24 | |||
25 | /** |
||
26 | * Whether the number's country should be auto-detected. |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $detect = false; |
||
31 | |||
32 | /** |
||
33 | * Whether to allow lenient checks (i.e. landline numbers without area codes). |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $lenient = false; |
||
38 | |||
39 | /** |
||
40 | * Set the phone countries. |
||
41 | * |
||
42 | * @param string|array $country |
||
43 | * @return $this |
||
44 | */ |
||
45 | public function country($country) |
||
53 | |||
54 | /** |
||
55 | * Set the phone types. |
||
56 | * |
||
57 | * @param string|array $type |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function type($type) |
||
68 | |||
69 | /** |
||
70 | * Enable automatic country detection. |
||
71 | * |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function detect() |
||
80 | |||
81 | /** |
||
82 | * Enable lenient number checking. |
||
83 | * |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function lenient() |
||
92 | |||
93 | /** |
||
94 | * Convert the rule to a validation string. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | public function __toString() |
||
107 | } |