SwapRule   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 34
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSwapToDay() 0 3 1
A getDirection() 0 3 1
A __construct() 0 5 1
A getSwapWhenDays() 0 3 1
1
<?php
2
3
/**
4
 * Copyright Andreas Heigl <[email protected]>
5
 *
6
 * Licenses under the MIT-license. For details see the included file LICENSE.md
7
 */
8
9
declare(strict_types=1);
10
11
namespace Org_Heigl\Holidaychecker;
12
13
class SwapRule
14
{
15
	/** @var SwapDirection */
16
	private $swapDirection;
17
18
	/** @var GregorianWeekday */
19
	private $swapToDay;
20
21
	/** @var GregorianWeekday[] */
22
	private $swapWhenDay;
23
24
	public function __construct(SwapDirection $direction, GregorianWeekday $swapToGregorianDay, GregorianWeekday ...$swapWhenGregorianDay)
25
	{
26
		$this->swapDirection = $direction;
27
		$this->swapToDay = $swapToGregorianDay;
28
		$this->swapWhenDay = $swapWhenGregorianDay;
29
	}
30
31
	public function getDirection(): SwapDirection
32
	{
33
		return $this->swapDirection;
34
	}
35
36
	public function getSwapToDay(): GregorianWeekday
37
	{
38
		return $this->swapToDay;
39
	}
40
41
	/**
42
	 * @return GregorianWeekday[]
43
	 */
44
	public function getSwapWhenDays(): array
45
	{
46
		return $this->swapWhenDay;
47
	}
48
}
49