UsaHoliday   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getHolidays() 0 23 2
1
<?php
2
namespace Holiday\Country;
3
4
use Holiday\Model\AbstractHoliday;
5
6
class UsaHoliday extends AbstractHoliday
7
{
8
    public static function getHolidays($year = null)
9
    {
10
        //@see http://www.theholidayschedule.com/banks/us-bank-holidays.php
11
        $year === null ? $year = intval(date('Y')) : $year = intval($year);
12
        $holidays              = [
13
            new \DateTime(sprintf('%d-%d-%d', $year, 1, 1)),
14
            new \DateTime(sprintf('%d-%d-%d', $year, 1, 18)),
15
            parent::getEasterDate($year),
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getEasterDate() instead of getHolidays()). Are you sure this is correct? If so, you might want to change this to $this->getEasterDate().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
16
            new \DateTime(sprintf('%d-%d-%d', $year, 5, 30)),
17
            new \DateTime(sprintf('%d-%d-%d', $year, 7, 4)),
18
            new \DateTime(sprintf('%d-%d-%d', $year, 9, 5)),
19
            new \DateTime(sprintf('%d-%d-%d', $year, 11, 11)),
20
            new \DateTime(sprintf('%d-%d-%d', $year, 11, 24)),
21
            new \DateTime(sprintf('%d-%d-%d', $year, 12, 24)),
22
            new \DateTime(sprintf('%d-%d-%d', $year, 12, 26)),
23
            new \DateTime(sprintf('%d-%d-%d', $year, 12, 31)),
24
25
        ];
26
27
        sort($holidays);
28
29
        return $holidays;
30
    }
31
}
32