Passed
Pull Request — master (#2019)
by Gabriel
64:37
created

MembershipApplicationFormPresenter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\Presentation\Presenters;
6
7
use WMDE\Fundraising\Frontend\Presentation\TwigTemplate;
8
9
class MembershipApplicationFormPresenter {
10
	private TwigTemplate $template;
11
	private array $incentives;
12
13
	public function __construct( TwigTemplate $template, array $incentives ) {
14
		$this->template = $template;
15
		$this->incentives = $incentives;
16
	}
17
18
	public function present( array $urls, bool $showMembershipTypeOption, array $initialDonationFormValues, array $initialValidationResult ): string {
19
		return $this->template->render( [
20
			'urls' => $urls,
21
			'showMembershipTypeOption' => $showMembershipTypeOption,
22
			'initialFormValues' => array_merge( $initialDonationFormValues, [ 'incentives' => $this->incentives ] ),
23
			'initialValidationResult' => $initialValidationResult
24
		] );
25
	}
26
}
27