Completed
Push — master ( 2dd332...d6426f )
by steef
02:53
created

AbstractParser   C

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 37

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 37
dl 0
loc 61
ccs 48
cts 48
cp 1
rs 5

1 Method

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