Test Failed
Push — master ( 45fe2f...125557 )
by Jinyun
02:31
created

NumberOfDaysInAMonth   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A numberOfDays() 0 8 4
1
<?php
2
3
declare(strict_types=1);
4
5
namespace leetcode;
6
7
class NumberOfDaysInAMonth
8
{
9
    public static function numberOfDays(int $year, int $month): int
10
    {
11
        $days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
12
        if (($year % 4 === 0 && $year % 100 !== 0) || $year % 400 === 0) {
13
            $days[1] += 1;
14
        }
15
16
        return $days[$month - 1];
17
    }
18
}
19