File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,15 @@ public static function maskCpf($value)
2626 return Mask::cpf ($ value );
2727 }
2828
29+ /**
30+ * @param string $value
31+ * @return string|null
32+ */
33+ public static function maskCns ($ value )
34+ {
35+ return Mask::cns ($ value );
36+ }
37+
2938 /**
3039 * @param string $value
3140 * @return string|string[]|null
Original file line number Diff line number Diff line change @@ -33,6 +33,19 @@ public static function cpf($value)
3333 return vsprintf ("%s%s%s.%s%s%s.%s%s%s-%s%s " , str_split ($ value ));
3434 }
3535
36+ /**
37+ * @param string $value
38+ * @return string|null
39+ */
40+ public static function cns ($ value )
41+ {
42+ $ value = preg_replace ('/\D/ ' , '' , $ value );
43+ if (strlen ($ value ) < 15 ) {
44+ return null ;
45+ }
46+ return vsprintf ("%s%s%s %s%s%s%s %s%s%s%s %s%s%s%s " , str_split ($ value ));
47+ }
48+
3649 /**
3750 * @param string $value
3851 * @return string|string[]|null
You can’t perform that action at this time.
0 commit comments