AbstractParser   C
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 41

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 41
dl 0
loc 65
ccs 39
cts 52
cp 0.75
rs 5
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAllDates() 0 62 2
1
<?php
2
3
namespace Stefanius\SpecialDates\DateParser;
4
5
use Stefanius\SpecialDates\CommonDates\FirstEasterDay;
6
use Stefanius\SpecialDates\CommonDates\GoodFriday;
7
use Stefanius\SpecialDates\CommonDates\MothersDay;
8
use Stefanius\SpecialDates\CommonDates\SecondEasterDay;
9
use Stefanius\SpecialDates\Dates\AgressionDay;
10
use Stefanius\SpecialDates\Dates\BloodDonationDay;
11
use Stefanius\SpecialDates\Dates\ChilderensDay;
12
use Stefanius\SpecialDates\Dates\ChildLabourDay;
13
use Stefanius\SpecialDates\CommonDates\ChristmasEvening;
14
use Stefanius\SpecialDates\Dates\DayOfConstruction;
15
use Stefanius\SpecialDates\Dates\DessertDay;
16
use Stefanius\SpecialDates\Dates\DevelopersDay;
17
use Stefanius\SpecialDates\Dates\DrugsAbuseDay;
18
use Stefanius\SpecialDates\Dates\DutchNeighboursDay;
19
use Stefanius\SpecialDates\Dates\DutchPancakeDay;
20
use Stefanius\SpecialDates\Dates\DutchSecretaryDay;
21
use Stefanius\SpecialDates\Dates\DutchVeteransDay;
22
use Stefanius\SpecialDates\Dates\EnvironmentDay;
23
use Stefanius\SpecialDates\CommonDates\FathersDay;
24
use Stefanius\SpecialDates\CommonDates\FirstChristmasDay;
25
use Stefanius\SpecialDates\Dates\GardenGuyDay;
26
use Stefanius\SpecialDates\Dates\HumanDay;
27
use Stefanius\SpecialDates\Dates\InternationalCoopDay;
28
use Stefanius\SpecialDates\CommonDates\LastDayOfYear;
29
use Stefanius\SpecialDates\CommonDates\LiberationDay;
30
use Stefanius\SpecialDates\Dates\NelsonMandelaDay;
31
use Stefanius\SpecialDates\CommonDates\NewYearsDay;
32
use Stefanius\SpecialDates\Dates\OutsideTheTimeDay;
33
use Stefanius\SpecialDates\Dates\PeaceAndPreyDay;
34
use Stefanius\SpecialDates\Dates\PinkSaturday;
35
use Stefanius\SpecialDates\Dates\RefugeeDay;
36
use Stefanius\SpecialDates\CommonDates\SecondChristmasDay;
37
use Stefanius\SpecialDates\Dates\SeriousRequest;
38
use Stefanius\SpecialDates\Dates\SystemEngineerDay;
39
use Stefanius\SpecialDates\Dates\TortureDay;
40
use Stefanius\SpecialDates\Dates\TouretteDay;
41
use Stefanius\SpecialDates\Dates\UnitedNationsDay;
42
use Stefanius\SpecialDates\CommonDates\ValentinesDay;
43
use Stefanius\SpecialDates\Dates\WorldOceanDay;
44
use Stefanius\SpecialDates\Dates\WorldPiDay;
45
use Stefanius\SpecialDates\Dates\WorldPopulationDay;
46
use Stefanius\SpecialDates\SDK\SpecialDateInterface;
47
48
class AbstractParser
0 ignored issues
show
Complexity introduced by
The class AbstractParser has a coupling between objects value of 41. Consider to reduce the number of dependencies under 13.
Loading history...
49
{
50 2
    public function getAllDates($year)
51
    {
52
        $array = [
53 2
            new NewYearsDay($year),
54 2
            new DutchPancakeDay($year),
55 2
            new WorldPiDay($year),
56 2
            new ChristmasEvening($year),
57 2
            new FirstChristmasDay($year),
58 2
            new SecondChristmasDay($year),
59 2
            new LastDayOfYear($year),
60 2
            new DutchSecretaryDay($year),
61 2
            new LiberationDay($year),
62 2
            new DutchNeighboursDay($year),
63 2
            new DevelopersDay($year),
64 2
            new ValentinesDay($year),
65 2
            new SeriousRequest($year),
66 2
            new FathersDay($year),
67 2
            new DayOfConstruction($year),
68 2
            new PinkSaturday($year),
69 2
            new ChilderensDay($year),
70 2
            new AgressionDay($year),
71 2
            new EnvironmentDay($year),
72 2
            new TouretteDay($year),
73 2
            new ChildLabourDay($year),
74 2
            new BloodDonationDay($year),
75 2
            new DessertDay($year),
76 2
            new DrugsAbuseDay($year),
77 2
            new DutchVeteransDay($year),
78 2
            new HumanDay($year),
79 2
            new PeaceAndPreyDay($year),
80 2
            new RefugeeDay($year),
81 2
            new TortureDay($year),
82 2
            new UnitedNationsDay($year),
83 2
            new WorldOceanDay($year),
84 2
            new InternationalCoopDay($year),
85 2
            new NelsonMandelaDay($year),
86 2
            new OutsideTheTimeDay($year),
87 2
            new SystemEngineerDay($year),
88 2
            new GardenGuyDay($year),
89 2
            new WorldPopulationDay($year),
90 2
            new FirstEasterDay($year),
91
            new SecondEasterDay($year),
92
            new GoodFriday($year),
93
            new MothersDay($year),
94
        ];
95
96
        $return = [];
97
        $i = 0;
98
99
        /**
100
         * @var SpecialDateInterface $item
101
         */
102
        foreach ($array as $item) {
103
            $key = $item->getStartDate()->format('Y') . '-' . $item->getStartDate()->format('m') . '-' . $item->getStartDate()->format('d') . '.' . $i;
104
            $i++;
105
            $return[$key] = $item;
106
        }
107
108
        ksort($return);
109
110
        return $return;
111
    }
112
}