Completed
Push — master ( 157295...918236 )
by Sébastien
02:44
created

DateHelper::isWeekend()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.2
cc 4
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace TrelloBurndown\Helper;
4
5
/**
6
 * Trait DateHelper.
7
 */
8
trait DateHelper
9
{
10
    /**
11
     * @param \DateTime $date
12
     *
13
     * @return bool
14
     */
15
    public function isWeekend(\DateTime $date)
16
    {
17
        if ($date instanceof \DateTime && ($date->format('N') == 6 || $date->format('N') == 7)) {
1 ignored issue
show
Unused Code introduced by
This if statement, and the following return statement can be replaced with return $date instanceof ...ate->format('N') == 7);.
Loading history...
18
            return true;
19
        }
20
21
        return false;
22
    }
23
}
24