Completed
Push — master ( 28bc7f...19cfe3 )
by Tim
67:28 queued 60:59
created

InactiveCampaignBucketSelection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A selectBucketForCampaign() 0 5 3
A __construct() 0 2 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\BucketTesting;
6
7
/**
8
 * @license GNU GPL v2+
9
 */
10
class InactiveCampaignBucketSelection implements BucketSelectionStrategy {
11
12
	private $now;
13
14 208
	public function __construct( CampaignDate $now ) {
15 208
		$this->now = $now;
16 208
	}
17
18 208
	public function selectBucketForCampaign( Campaign $campaign ): ?Bucket {
19 208
		if ( !$campaign->isActive() || $campaign->isExpired( $this->now ) ) {
20 207
			return $campaign->getDefaultBucket();
21
		}
22 205
		return null;
23
	}
24
25
26
}