1 | <?php namespace Propaganistas\LaravelPhone\Rules; |
||
7 | class Phone |
||
8 | { |
||
9 | use ParsesTypes; |
||
10 | |||
11 | /** |
||
12 | * The provided phone countries. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $countries = []; |
||
17 | |||
18 | /** |
||
19 | * The input field name to check for a country value. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $countryField; |
||
24 | |||
25 | /** |
||
26 | * The provided phone types. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $types = []; |
||
31 | |||
32 | /** |
||
33 | * Whether the number's country should be auto-detected. |
||
34 | * |
||
35 | * @var bool |
||
36 | */ |
||
37 | protected $detect = false; |
||
38 | |||
39 | /** |
||
40 | * Whether to allow lenient checks (i.e. landline numbers without area codes). |
||
41 | * |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $lenient = false; |
||
45 | |||
46 | /** |
||
47 | * Set the phone countries. |
||
48 | * |
||
49 | * @param string|array $country |
||
50 | * @return $this |
||
51 | */ |
||
52 | 3 | public function country($country) |
|
60 | |||
61 | /** |
||
62 | * Set the country input field. |
||
63 | * |
||
64 | * @param string $name |
||
65 | * @return $this |
||
66 | */ |
||
67 | 3 | public function countryField($name) |
|
73 | |||
74 | /** |
||
75 | * Set the phone types. |
||
76 | * |
||
77 | * @param string|array $type |
||
78 | * @return $this |
||
79 | */ |
||
80 | 3 | public function type($type) |
|
88 | |||
89 | /** |
||
90 | * Shortcut method for mobile type restriction. |
||
91 | * |
||
92 | * @return $this |
||
93 | */ |
||
94 | 3 | public function mobile() |
|
100 | |||
101 | /** |
||
102 | * Shortcut method for fixed line type restriction. |
||
103 | * |
||
104 | * @return $this |
||
105 | */ |
||
106 | 3 | public function fixedLine() |
|
112 | |||
113 | /** |
||
114 | * Enable automatic country detection. |
||
115 | * |
||
116 | * @return $this |
||
117 | */ |
||
118 | 3 | public function detect() |
|
124 | |||
125 | /** |
||
126 | * Enable lenient number checking. |
||
127 | * |
||
128 | * @return $this |
||
129 | */ |
||
130 | 3 | public function lenient() |
|
136 | |||
137 | /** |
||
138 | * Convert the rule to a validation string. |
||
139 | * |
||
140 | * @return string |
||
141 | */ |
||
142 | 3 | public function __toString() |
|
154 | } |
||
155 |