SeasonalHolidaysFilter::accept()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the Yasumi package.
4
 *
5
 * Copyright (c) 2015 - 2020 AzuyaLabs
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author Sacha Telgenhof <[email protected]>
11
 */
12
13
namespace Yasumi\Filters;
14
15
use Yasumi\Holiday;
16
17
/**
18
 * SeasonalHolidaysFilter is a class for filtering all seasonal holidays.
19
 *
20
 * OfficialHolidaysFilter is a class that returns all holidays that are considered seasonal of any given holiday
21
 * provider.
22
 *
23
 * Example usage:
24
 * $holidays = Yasumi::create('Netherlands', 2015);
25
 * $seasonal = new SeasonalHolidaysFilter($holidays->getIterator());
26
 */
27
class SeasonalHolidaysFilter extends AbstractFilter
28
{
29
    /**
30
     * Checks whether the current element of the iterator is a seasonal holiday.
31
     *
32
     * @return bool
33
     */
34
    public function accept(): bool
35
    {
36
        return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_SEASON;
37
    }
38
}
39