Completed
Push — master ( 88699b...ae29c5 )
by Gabriel
13s
created

FakeShowApplicationConfirmationPresenter   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 4
cbo 0
dl 0
loc 50
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A presentConfirmation() 0 8 2
A getShownApplication() 0 3 1
A getShownUpdateToken() 0 3 1
A presentAccessViolation() 0 3 1
A accessViolationWasShown() 0 3 1
A presentTechnicalError() 0 3 1
A getShownTechnicalError() 0 3 1
A presentApplicationWasAnonymized() 0 3 1
A anonymizedResponseWasShown() 0 3 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\MembershipContext\Tests\Integration\UseCases\ShowApplicationConfirmation;
6
7
use WMDE\Fundraising\Frontend\MembershipContext\Domain\Model\Application;
8
use WMDE\Fundraising\Frontend\MembershipContext\UseCases\ShowApplicationConfirmation\ShowApplicationConfirmationPresenter;
9
10
/**
11
 * @license GNU GPL v2+
12
 * @author Jeroen De Dauw < [email protected] >
13
 */
14
class FakeShowApplicationConfirmationPresenter implements ShowApplicationConfirmationPresenter {
15
16
	private $application;
17
	private $updateToken;
18
	private $anonymizedResponseWasShown = false;
19
	private $accessViolationWasShown = false;
20
	private $shownTechnicalError;
21
22
	public function presentConfirmation( Application $application, string $updateToken ): void {
23
		if ( $this->application !== null ) {
24
			throw new \RuntimeException( 'Presenter should only be invoked once' );
25
		}
26
27
		$this->application = $application;
28
		$this->updateToken = $updateToken;
29
	}
30
31
	public function getShownApplication(): Application {
32
		return $this->application;
33
	}
34
35
	public function getShownUpdateToken(): string {
36
		return $this->updateToken;
37
	}
38
39
	public function presentApplicationWasAnonymized(): void {
40
		$this->anonymizedResponseWasShown = true;
41
	}
42
43
	public function anonymizedResponseWasShown(): bool {
44
		return $this->anonymizedResponseWasShown;
45
	}
46
47
	public function presentAccessViolation(): void {
48
		$this->accessViolationWasShown = true;
49
	}
50
51
	public function accessViolationWasShown(): bool {
52
		return $this->accessViolationWasShown;
53
	}
54
55
	public function presentTechnicalError( string $error ): void {
56
		$this->shownTechnicalError = $error;
57
	}
58
59
	public function getShownTechnicalError(): string {
60
		return $this->shownTechnicalError;
61
	}
62
63
}