Completed
Push — master ( 25648a...558e7e )
by Jeroen De
14s
created

InitialDonationStatusPicker::__invoke()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.2
c 0
b 0
f 0
cc 4
eloc 8
nc 4
nop 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\DonationContext\UseCases\AddDonation;
6
7
use WMDE\Fundraising\Frontend\DonationContext\Domain\Model\Donation;
8
use WMDE\Fundraising\Frontend\PaymentContext\Domain\Model\PaymentType;
9
10
class InitialDonationStatusPicker {
11
12
	public function __invoke( string $paymentType ): string {
13
		if ( $paymentType === PaymentType::DIRECT_DEBIT ) {
14
			return Donation::STATUS_NEW;
15
		} elseif ( $paymentType === PaymentType::BANK_TRANSFER ) {
16
			return Donation::STATUS_PROMISE;
17
		} elseif ( $paymentType === PaymentType::SOFORT ) {
18
			return Donation::STATUS_PROMISE;
19
		}
20
21
		return Donation::STATUS_EXTERNAL_INCOMPLETE;
22
	}
23
}
24