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

InitialDonationStatusPicker   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 4
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