Test Failed
Push — master ( f47101...348e9e )
by Ricardo
02:03
created

Cpf   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toUser() 0 3 1
A toDatabase() 0 3 1
A validate() 0 4 1
A isSame() 0 3 1
1
<?php
2
3
namespace Validate;
4
5
use Validate\Traits\FakeNameTrait;
6
7
class Cpf implements \Validate\Contracts\Validate
8
{
9
    use FakeNameTrait;
10
11
    public static function toDatabase($cpf)
12
    {
13
        return preg_replace('/[^0-9]/', '', $cpf);
14
    }
15
    
16
    public static function toUser($cpf)
17
    {
18
        return $cpf;
19
    }
20
21
    public static function validate($cpf)
22
    {
23
24
        return true;
25
    }
26
27
    public static function isSame(string $to, string $from)
28
    {
29
        return (self::toDatabase($to)===self::toDatabase($from));
30
    }
31
32
}
33