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

Number::isSame()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Validate;
4
5
use Validate\Traits\FakeNameTrait;
6
7
class Number implements \Validate\Contracts\Validate
8
{
9
    use FakeNameTrait;
10
    
11
    /**
12
     * Remove Virgulas do Numeral e Add .
13
     */
14
    public static function toDatabase(string $number)
15
    {
16
        if(strpos($number, ',') > 0) {
17
            $number = str_replace('.', '', $number);
18
            $number = str_replace(',', '.', $number);
19
        }
20
        return $number;
21
    }
22
23
    public static function toUser($number)
24
    {
25
        return $number;
26
    }
27
28
    public static function validate($number)
29
    {
30
        return true;
31
    }
32
33
    public static function isSame(string $to, string $from)
34
    {
35
        return (self::toDatabase($to)===self::toDatabase($from));
36
    }
37
38
}
39