File tree Expand file tree Collapse file tree 3 files changed +324
-46
lines changed Expand file tree Collapse file tree 3 files changed +324
-46
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ $mask->cep('89566410');
30
30
# returns '198.298.398-98'
31
31
$mask->cpf('19829839898');
32
32
33
- # returns '3635359000123 '
34
- $mask->cnpj('03.635.359/0001-23 ');
33
+ # returns '03.635.359/0001-23 '
34
+ $mask->cnpj('3635359000123 ');
35
35
36
36
# returns '12.345.678-9'
37
37
$mask->rg('123456789');
Original file line number Diff line number Diff line change 4
4
5
5
class Constants
6
6
{
7
+ /* Supported types */
8
+ const CEP = "CEP " ;
9
+ const CPF = "CPF " ;
10
+ const CNPJ = "CNPJ " ;
11
+ const DATE = "DATE " ;
12
+ const RG = "RG " ;
13
+ const PHONE = "PHONE " ;
14
+ const CELL_PHONE = "CELL_PHONE " ;
15
+ const CUSTOM = "CUSTOM " ;
16
+ const CREDIT_CARD = "CREDIT_CARD " ;
17
+
7
18
/**
8
- * 🇧🇷 Tamanho exato de cada tipo de informação
9
- * 🇺🇸 Exact size of each type of information
10
- * 🇮🇹 Dimensione esatta di ogni tipo di informazione
19
+ * Masks of any supported type
20
+ *
21
+ * @const LENGHT
22
+ */
23
+ const MASK = [
24
+ "CEP " => "#####-### " ,
25
+ "CPF " => "###.###.###-## " ,
26
+ "CNPJ " => "##.###.###/####-## " ,
27
+ "DATE " => "##/##/#### " ,
28
+ "RG " => "##.###.###-# " ,
29
+ "PHONE " => "(##) ####-#### " ,
30
+ "CELL_PHONE " => "(##) #####-#### " ,
31
+ "CREDIT_CARD " => "####.****.****.#### "
32
+ ];
33
+
34
+ /**
35
+ * Define auto complete type (with zero to the left)
36
+ *
37
+ * @const LENGHT
38
+ */
39
+ const AUTO_COMPLETE = [
40
+ "CEP " ,
41
+ "CPF " ,
42
+ "CNPJ " ,
43
+ "RG "
44
+ ];
45
+
46
+ /**
47
+ * Exact size of each type of information
48
+ *
49
+ * @const LENGHT
11
50
*/
12
51
const LENGTH = [
13
52
'CEP ' => 8 ,
14
- 'CPF ' => 11
53
+ 'CPF ' => 11 ,
54
+ 'CNPJ ' => 14 ,
55
+ 'RG ' => 9 ,
56
+ 'PHONE ' => 10
57
+ ];
58
+
59
+ /**
60
+ * Define mask class errors
61
+ *
62
+ * @const ERROR
63
+ */
64
+ const ERROR = [
65
+ 'NULL ' => 'The value entered is null. ' ,
66
+ 'INVALID ' => 'Not supported type entered. '
15
67
];
68
+
16
69
}
You can’t perform that action at this time.
0 commit comments