Completed
Push — master ( 00092a...39103d )
by wiese
86:17 queued 21:06
created

MailTemplates   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 168
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 168
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
B get() 0 156 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\App;
6
7
use WMDE\Fundraising\Frontend\Factories\FunFunFactory;
8
9
/**
10
 * This file contains a list of all Mail templates and the variables rendered in them.
11
 *
12
 * Some templates contain if statements, leading to different permutations of output, which are rendered individually.
13
 * These outputs are covered by the "variants", which are automatically recursively merged into the main "context".
14
 */
15
class MailTemplates {
16
17
	/**
18
	 * @var FunFunFactory
19
	 */
20
	private $factory;
21
22
	public function __construct( FunFunFactory $factory ) {
23
		$this->factory = $factory;
24
	}
25
26
	public function get(): array {
27
		return [
28
29
			'Mail_Contact_Confirm_to_User.txt.twig' => [
30
				'context' => []
31
			],
32
33
			'Mail_Contact_Forward_to_Operator.txt.twig' => [
34
				'context' => [
35
					'firstName' => 'John',
36
					'lastName' => 'Doe',
37
					'emailAddress' => '[email protected]',
38
					'subject' => 'Missing Link',
39
					'message' => 'Please advise',
40
				],
41
			],
42
43
			'Mail_Donation_Cancellation_Confirmation.txt.twig' => [
44
				'context' => [
45
					'greeting_generator' => $this->factory->getGreetingGenerator(),
46
					'recipient' => [
47
						'lastName' => "O'Reilly",
48
						'salutation' => 'Herr',
49
						'title' => 'Dr.'
50
					],
51
					'donationId' => 42
52
				]
53
			],
54
55
			'Mail_Donation_Confirmation.txt.twig' => [
56
				'context' => [
57
					'greeting_generator' => $this->factory->getGreetingGenerator(),
58
					'donation' => [
59
						'id' => 42,
60
						'amount' => 12.34,
61
						'needsModeration' => false,
62
					],
63
					'recipient' => [
64
						'lastName' => '姜',
65
						'salutation' => 'Frau',
66
						'title' => ''
67
					],
68
				],
69
				'variants' => [
70
					'deposit_unmoderated_non_recurring' => [
71
						'donation' => [
72
							'paymentType' => 'UEB',
73
							'interval' => 0,
74
							'bankTransferCode' => 'WZF3984Y',
75
						]
76
					],
77
					'direct_debit_unmoderated_non_recurring' => [
78
						'donation' => [
79
							'paymentType' => 'BEZ',
80
							'interval' => 0,
81
						]
82
					],
83
					'direct_debit_unmoderated_recurring' => [
84
						'donation' => [
85
							'paymentType' => 'BEZ',
86
							'interval' => 3,
87
						]
88
					],
89
					'paypal_unmoderated_non_recurring' => [
90
						'donation' => [
91
							'paymentType' => 'PPL',
92
							'interval' => 0,
93
						]
94
					],
95
					// PPL and MCP follow the same code path for recurring, no need to test each separately
96
					'micropayment_unmoderated_recurring' => [
97
						'donation' => [
98
							'paymentType' => 'MCP',
99
							'interval' => 6,
100
						]
101
					],
102
					// moderated all generate the same message, no need to test different payment types
103
					'micropayment_moderated_recurring' => [
104
						'donation' => [
105
							'needsModeration' => true,
106
							'paymentType' => 'MCP',
107
							'interval' => 6
108
						],
109
					]
110
				],
111
			],
112
113
			'Mail_Membership_Application_Cancellation_Confirmation.txt.twig' => [
114
				'context' => [
115
					'greeting_generator' => $this->factory->getGreetingGenerator(),
116
					'membershipApplicant' => [
117
						'lastName' => "O'Reilly",
118
						'salutation' => 'Herr',
119
						'title' => 'Dr.'
120
					],
121
					'applicationId' => 23
122
				]
123
			],
124
125
			'Mail_Membership_Application_Confirmation.txt.twig' => [
126
				'context' => [
127
					'greeting_generator' => $this->factory->getGreetingGenerator(),
128
					'lastName' => "O'Reilly",
129
					'salutation' => 'Herr',
130
					'title' => 'Dr.',
131
					'membershipFee' => 15.23,
132
				],
133
				'variants' => [
134
					'direct_debit_active_yearly' => [
135
						'membershipType' => 'active',
136
						'paymentIntervalInMonths' => 12,
137
						'paymentType' => 'BEZ',
138
					],
139
					'direct_debit_sustaining_quarterly' => [
140
						'membershipType' => 'sustaining',
141
						'paymentIntervalInMonths' => 3,
142
						'paymentType' => 'BEZ',
143
					],
144
					'paypal_sustaining_monthly' => [
145
						'membershipType' => 'sustaining',
146
						'paymentIntervalInMonths' => 1,
147
						'paymentType' => 'PPL',
148
					]
149
				]
150
			],
151
152
			'Mail_Subscription_Confirmation.txt.twig' => [
153
				'context' => [
154
					'greeting_generator' => $this->factory->getGreetingGenerator(),
155
					'subscription' => [
156
						'email' => '[email protected]',
157
						'address' => [
158
							'lastName' => "O'Reilly",
159
							'salutation' => 'Herr',
160
							'title' => 'Dr.'
161
						]
162
					]
163
				]
164
			],
165
166
			'Mail_Subscription_Request.txt.twig' => [
167
				'context' => [
168
					'greeting_generator' => $this->factory->getGreetingGenerator(),
169
					'subscription' => [
170
						'email' => '[email protected]',
171
						'confirmationCode' => '00deadbeef',
172
						'address' => [
173
							'lastName' => "O'Reilly",
174
							'salutation' => 'Herr',
175
							'title' => 'Dr.'
176
						]
177
					]
178
				]
179
			],
180
		];
181
	}
182
}
183