Completed
Push — master ( 8fd8d8...81863e )
by Tonina
877:57 queued 875:15
created

Campaign::isActiveAtPointInTime()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\BannerServer\Entity\BannerSelection;
6
7
/**
8
 * @license GNU GPL v2+
9
 */
10
class Campaign {
11
12
	private $identifier;
13
	private $start;
14
	private $end;
15
	private $impressionThreshold;
16
17
	/**
18
	 * @var Bucket[]
19
	 */
20
	private $buckets;
21
22
	public function __construct( string $identifier, \DateTime $start, \DateTime $end, array $buckets, ImpressionThresholdInterface $impressionThreshold ) {
23
		$this->identifier = $identifier;
24
		$this->start = $start;
25
		$this->end = $end;
26
		$this->buckets = $buckets;
27
		$this->impressionThreshold = $impressionThreshold;
28
	}
29
30
	public function getIdentifier(): string {
31
		return $this->identifier;
32
	}
33
34
	public function getEnd(): \DateTime {
35
		return $this->end;
36
	}
37
38
	public function isActiveAtPointInTime( \DateTime $time ): bool {
39
		return $time->getTimestamp() > $this->start->getTimestamp() && $time->getTimestamp() < $this->end->getTimestamp();
40
	}
41
}