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

BannerSelectionUseCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 25
ccs 0
cts 15
cp 0
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A provideBannerRequest() 0 9 2
A cancelBannerSelection() 0 5 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\BannerServer\UseCase\BannerSelection;
6
7
use WMDE\BannerServer\Entity\BannerSelection\CampaignCollection;
8
9
/**
10
 * @license GNU GPL v2+
11
 */
12
class BannerSelectionUseCase {
13
14
	private $campaignCollection;
15
16
	public function __construct( CampaignCollection $campaignCollection ) {
17
		$this->campaignCollection = $campaignCollection;
18
	}
19
20
	public function provideBannerRequest( Visitor $visitor ): BannerSelection {
21
		if ( $visitor->hasDonated() ) {
22
			return $this->cancelBannerSelection( $visitor );
23
		}
24
25
		return new BannerSelection(
26
			'test',
27
			new Visitor( 1, 'Testbucket', false ),
28
			new \DateTime()
29
		);
30
	}
31
32
	private function cancelBannerSelection( Visitor $visitor ): BannerSelection {
33
		return new BannerSelection(
34
			null,
35
			$visitor,
36
			new \DateTime()
37
		);
38
	}
39
}