Completed
Pull Request — master (#8)
by steef
03:12
created

AbstractParser   C

Complexity

Total Complexity 2

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 41

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 41
dl 0
loc 65
ccs 50
cts 50
cp 1
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 3
    public function getAllDates($year)
51
    {
52
        $array = [
53 3
            new NewYearsDay($year),
54 3
            new DutchPancakeDay($year),
55 3
            new WorldPiDay($year),
56 3
            new ChristmasEvening($year),
57 3
            new FirstChristmasDay($year),
58 3
            new SecondChristmasDay($year),
59 3
            new LastDayOfYear($year),
60 3
            new DutchSecretaryDay($year),
61 3
            new LiberationDay($year),
62 3
            new DutchNeighboursDay($year),
63 3
            new DevelopersDay($year),
64 3
            new ValentinesDay($year),
65 3
            new SeriousRequest($year),
66 3
            new FathersDay($year),
67 3
            new DayOfConstruction($year),
68 3
            new PinkSaturday($year),
69 3
            new ChilderensDay($year),
70 3
            new AgressionDay($year),
71 3
            new EnvironmentDay($year),
72 3
            new TouretteDay($year),
73 3
            new ChildLabourDay($year),
74 3
            new BloodDonationDay($year),
75 3
            new DessertDay($year),
76 3
            new DrugsAbuseDay($year),
77 3
            new DutchVeteransDay($year),
78 3
            new HumanDay($year),
79 3
            new PeaceAndPreyDay($year),
80 3
            new RefugeeDay($year),
81 3
            new TortureDay($year),
82 3
            new UnitedNationsDay($year),
83 3
            new WorldOceanDay($year),
84 3
            new InternationalCoopDay($year),
85 3
            new NelsonMandelaDay($year),
86 3
            new OutsideTheTimeDay($year),
87 3
            new SystemEngineerDay($year),
88 3
            new GardenGuyDay($year),
89 3
            new WorldPopulationDay($year),
90 3
            new FirstEasterDay($year),
91 3
            new SecondEasterDay($year),
92 3
            new GoodFriday($year),
93 3
            new MothersDay($year),
94
        ];
95
96 3
        $return = [];
97 3
        $i = 0;
98
99
        /**
100
         * @var SpecialDateInterface $item
101
         */
102 3
        foreach ($array as $item) {
103 3
            $key = $item->getStartDate()->format('Y') . '-' . $item->getStartDate()->format('m') . '-' . $item->getStartDate()->format('d') . '.' . $i;
104 3
            $i++;
105 3
            $return[$key] = $item;
106
        }
107
108 3
        ksort($return);
109
110 3
        return $return;
111
    }
112
}