Passed
Push — master ( 8baa4a...fa5dd9 )
by João Felipe Magro
01:17
created

CreditCardValidator::isValidCvc()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 3
eloc 1
nc 3
nop 1
1
<?php
2
3
namespace Ipag\Classes\Validators;
4
5
final class CreditCardValidator
6
{
7
    public function isValidMonth($month)
8
    {
9
        return (bool) (is_numeric($month) && $month >= 1 && $month <= 12);
10
    }
11
12
    public function isValidYear($year)
13
    {
14
        return (bool) (is_numeric($year) && strlen($year) >= 2 && strlen($year) <= 4);
15
    }
16
17
    public function isValidCvc($cvc)
18
    {
19
        return (bool) (is_numeric($cvc) && (strlen($cvc) == 3 || strlen($cvc) == 4));
20
    }
21
}
22