Completed
Pull Request — master (#1159)
by Jeroen De
62:58 queued 45s
created
MembershipContext/src/Domain/Repositories/ApplicationPurgedException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\MembershipContext\Domain\Repositories;
6 6
 
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 class ApplicationPurgedException extends GetMembershipApplicationException {
12 12
 
13 13
 	public function __construct() {
14
-		parent::__construct( 'Tried to access a purged Application' );
14
+		parent::__construct('Tried to access a purged Application');
15 15
 	}
16 16
 
17 17
 }
Please login to merge, or discard this patch.
src/Domain/Repositories/GetMembershipApplicationException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\MembershipContext\Domain\Repositories;
6 6
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class GetMembershipApplicationException extends \RuntimeException {
12 12
 
13
-	public function __construct( string $message = null, \Exception $previous = null ) {
13
+	public function __construct(string $message = null, \Exception $previous = null) {
14 14
 		parent::__construct(
15 15
 			$message ?? 'Could not get membership application',
16 16
 			0,
Please login to merge, or discard this patch.
contexts/MembershipContext/src/DataAccess/DoctrineApplicationRepository.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 	public function storeApplication( Application $application ): void {
44 44
 		if ( $application->hasId() ) {
45 45
 			$this->updateApplication( $application );
46
-		}
47
-		else {
46
+		} else {
48 47
 			$this->insertApplication( $application );
49 48
 		}
50 49
 	}
@@ -56,8 +55,7 @@  discard block
 block discarded – undo
56 55
 		try {
57 56
 			$this->entityManager->persist( $doctrineApplication );
58 57
 			$this->entityManager->flush();
59
-		}
60
-		catch ( ORMException $ex ) {
58
+		} catch ( ORMException $ex ) {
61 59
 			throw new StoreMembershipApplicationException( $ex );
62 60
 		}
63 61
 
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
 		try {
77 75
 			$this->entityManager->persist( $doctrineApplication );
78 76
 			$this->entityManager->flush();
79
-		}
80
-		catch ( ORMException $ex ) {
77
+		} catch ( ORMException $ex ) {
81 78
 			throw new StoreMembershipApplicationException( $ex );
82 79
 		}
83 80
 	}
@@ -209,8 +206,7 @@  discard block
 block discarded – undo
209 206
 	public function getApplicationById( int $id ): ?Application {
210 207
 		try {
211 208
 			$application = $this->getDoctrineApplicationById( $id );
212
-		}
213
-		catch ( ORMException $ex ) {
209
+		} catch ( ORMException $ex ) {
214 210
 			throw new GetMembershipApplicationException( null, $ex );
215 211
 		}
216 212
 
Please login to merge, or discard this patch.
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\MembershipContext\DataAccess;
6 6
 
@@ -36,108 +36,108 @@  discard block
 block discarded – undo
36 36
 
37 37
 	private $entityManager;
38 38
 
39
-	public function __construct( EntityManager $entityManager ) {
39
+	public function __construct(EntityManager $entityManager) {
40 40
 		$this->entityManager = $entityManager;
41 41
 	}
42 42
 
43
-	public function storeApplication( Application $application ): void {
44
-		if ( $application->hasId() ) {
45
-			$this->updateApplication( $application );
43
+	public function storeApplication(Application $application): void {
44
+		if ($application->hasId()) {
45
+			$this->updateApplication($application);
46 46
 		}
47 47
 		else {
48
-			$this->insertApplication( $application );
48
+			$this->insertApplication($application);
49 49
 		}
50 50
 	}
51 51
 
52
-	private function insertApplication( Application $application ): void {
52
+	private function insertApplication(Application $application): void {
53 53
 		$doctrineApplication = new DoctrineApplication();
54
-		$this->updateDoctrineApplication( $doctrineApplication, $application );
54
+		$this->updateDoctrineApplication($doctrineApplication, $application);
55 55
 
56 56
 		try {
57
-			$this->entityManager->persist( $doctrineApplication );
57
+			$this->entityManager->persist($doctrineApplication);
58 58
 			$this->entityManager->flush();
59 59
 		}
60
-		catch ( ORMException $ex ) {
61
-			throw new StoreMembershipApplicationException( $ex );
60
+		catch (ORMException $ex) {
61
+			throw new StoreMembershipApplicationException($ex);
62 62
 		}
63 63
 
64
-		$application->assignId( $doctrineApplication->getId() );
64
+		$application->assignId($doctrineApplication->getId());
65 65
 	}
66 66
 
67
-	private function updateApplication( Application $application ): void {
68
-		$doctrineApplication = $this->getDoctrineApplicationById( $application->getId() );
67
+	private function updateApplication(Application $application): void {
68
+		$doctrineApplication = $this->getDoctrineApplicationById($application->getId());
69 69
 
70
-		if ( $doctrineApplication === null ) {
70
+		if ($doctrineApplication === null) {
71 71
 			throw new StoreMembershipApplicationException();
72 72
 		}
73 73
 
74
-		$this->updateDoctrineApplication( $doctrineApplication, $application );
74
+		$this->updateDoctrineApplication($doctrineApplication, $application);
75 75
 
76 76
 		try {
77
-			$this->entityManager->persist( $doctrineApplication );
77
+			$this->entityManager->persist($doctrineApplication);
78 78
 			$this->entityManager->flush();
79 79
 		}
80
-		catch ( ORMException $ex ) {
81
-			throw new StoreMembershipApplicationException( $ex );
80
+		catch (ORMException $ex) {
81
+			throw new StoreMembershipApplicationException($ex);
82 82
 		}
83 83
 	}
84 84
 
85
-	private function updateDoctrineApplication( DoctrineApplication $doctrineApplication, Application $application ): void {
86
-		$doctrineApplication->setId( $application->getId() );
87
-		$doctrineApplication->setMembershipType( $application->getType() );
85
+	private function updateDoctrineApplication(DoctrineApplication $doctrineApplication, Application $application): void {
86
+		$doctrineApplication->setId($application->getId());
87
+		$doctrineApplication->setMembershipType($application->getType());
88 88
 
89
-		$this->setApplicantFields( $doctrineApplication, $application->getApplicant() );
90
-		$this->setPaymentFields( $doctrineApplication, $application->getPayment() );
91
-		$doctrineApplication->setDonationReceipt( $application->getDonationReceipt() );
89
+		$this->setApplicantFields($doctrineApplication, $application->getApplicant());
90
+		$this->setPaymentFields($doctrineApplication, $application->getPayment());
91
+		$doctrineApplication->setDonationReceipt($application->getDonationReceipt());
92 92
 
93
-		$doctrineStatus = $this->getDoctrineStatus( $application );
94
-		$this->preserveDoctrineStatus( $doctrineApplication, $doctrineStatus );
95
-		$doctrineApplication->setStatus( $doctrineStatus );
93
+		$doctrineStatus = $this->getDoctrineStatus($application);
94
+		$this->preserveDoctrineStatus($doctrineApplication, $doctrineStatus);
95
+		$doctrineApplication->setStatus($doctrineStatus);
96 96
 	}
97 97
 
98
-	private function setApplicantFields( DoctrineApplication $application, Applicant $applicant ): void {
99
-		$application->setApplicantFirstName( $applicant->getName()->getFirstName() );
100
-		$application->setApplicantLastName( $applicant->getName()->getLastName() );
101
-		$application->setApplicantSalutation( $applicant->getName()->getSalutation() );
102
-		$application->setApplicantTitle( $applicant->getName()->getTitle() );
103
-		$application->setCompany( $applicant->getName()->getCompanyName() );
98
+	private function setApplicantFields(DoctrineApplication $application, Applicant $applicant): void {
99
+		$application->setApplicantFirstName($applicant->getName()->getFirstName());
100
+		$application->setApplicantLastName($applicant->getName()->getLastName());
101
+		$application->setApplicantSalutation($applicant->getName()->getSalutation());
102
+		$application->setApplicantTitle($applicant->getName()->getTitle());
103
+		$application->setCompany($applicant->getName()->getCompanyName());
104 104
 
105
-		$application->setApplicantDateOfBirth( $applicant->getDateOfBirth() );
105
+		$application->setApplicantDateOfBirth($applicant->getDateOfBirth());
106 106
 
107
-		$application->setApplicantEmailAddress( $applicant->getEmailAddress()->getFullAddress() );
108
-		$application->setApplicantPhoneNumber( $applicant->getPhoneNumber()->__toString() );
107
+		$application->setApplicantEmailAddress($applicant->getEmailAddress()->getFullAddress());
108
+		$application->setApplicantPhoneNumber($applicant->getPhoneNumber()->__toString());
109 109
 
110 110
 		$address = $applicant->getPhysicalAddress();
111 111
 
112
-		$application->setCity( $address->getCity() );
113
-		$application->setCountry( $address->getCountryCode() );
114
-		$application->setPostcode( $address->getPostalCode() );
115
-		$application->setAddress( $address->getStreetAddress() );
112
+		$application->setCity($address->getCity());
113
+		$application->setCountry($address->getCountryCode());
114
+		$application->setPostcode($address->getPostalCode());
115
+		$application->setAddress($address->getStreetAddress());
116 116
 	}
117 117
 
118
-	private function setPaymentFields( DoctrineApplication $application, Payment $payment ): void {
119
-		$application->setPaymentIntervalInMonths( $payment->getIntervalInMonths() );
120
-		$application->setPaymentAmount( (int)$payment->getAmount()->getEuroFloat() );
118
+	private function setPaymentFields(DoctrineApplication $application, Payment $payment): void {
119
+		$application->setPaymentIntervalInMonths($payment->getIntervalInMonths());
120
+		$application->setPaymentAmount((int)$payment->getAmount()->getEuroFloat());
121 121
 		$paymentMethod = $payment->getPaymentMethod();
122 122
 
123
-		$application->setPaymentType( $paymentMethod->getType() );
124
-		if ( $paymentMethod instanceof DirectDebitPayment ) {
125
-			$this->setBankDataFields( $application, $paymentMethod->getBankData() );
126
-		} elseif ( $paymentMethod instanceof PayPalPayment && $paymentMethod->getPayPalData() != new PayPalData() ) {
127
-			$this->setPayPalDataFields( $application, $paymentMethod->getPayPalData() );
123
+		$application->setPaymentType($paymentMethod->getType());
124
+		if ($paymentMethod instanceof DirectDebitPayment) {
125
+			$this->setBankDataFields($application, $paymentMethod->getBankData());
126
+		} elseif ($paymentMethod instanceof PayPalPayment && $paymentMethod->getPayPalData() != new PayPalData()) {
127
+			$this->setPayPalDataFields($application, $paymentMethod->getPayPalData());
128 128
 		}
129 129
 	}
130 130
 
131
-	private function setBankDataFields( DoctrineApplication $application, BankData $bankData ): void {
132
-		$application->setPaymentBankAccount( $bankData->getAccount() );
133
-		$application->setPaymentBankCode( $bankData->getBankCode() );
134
-		$application->setPaymentBankName( $bankData->getBankName() );
135
-		$application->setPaymentBic( $bankData->getBic() );
136
-		$application->setPaymentIban( $bankData->getIban()->toString() );
131
+	private function setBankDataFields(DoctrineApplication $application, BankData $bankData): void {
132
+		$application->setPaymentBankAccount($bankData->getAccount());
133
+		$application->setPaymentBankCode($bankData->getBankCode());
134
+		$application->setPaymentBankName($bankData->getBankName());
135
+		$application->setPaymentBic($bankData->getBic());
136
+		$application->setPaymentIban($bankData->getIban()->toString());
137 137
 	}
138 138
 
139
-	private function setPayPalDataFields( DoctrineApplication $application, PayPalData $payPalData ): void {
140
-		$application->encodeAndSetData( array_merge(
139
+	private function setPayPalDataFields(DoctrineApplication $application, PayPalData $payPalData): void {
140
+		$application->encodeAndSetData(array_merge(
141 141
 			$application->getDecodedData(),
142 142
 			[
143 143
 				'paypal_payer_id' => $payPalData->getPayerId(),
@@ -159,43 +159,43 @@  discard block
 block discarded – undo
159 159
 				'ext_payment_timestamp' => $payPalData->getPaymentTimestamp(),
160 160
 				'first_payment_date' => $payPalData->getFirstPaymentDate()
161 161
 			]
162
-		) );
162
+		));
163 163
 	}
164 164
 
165
-	private function getDoctrineStatus( Application $application ): int {
165
+	private function getDoctrineStatus(Application $application): int {
166 166
 		$status = DoctrineApplication::STATUS_NEUTRAL;
167 167
 
168
-		if ( $application->needsModeration() ) {
168
+		if ($application->needsModeration()) {
169 169
 			$status += DoctrineApplication::STATUS_MODERATION;
170 170
 		}
171 171
 
172
-		if ( $application->isCancelled() ) {
172
+		if ($application->isCancelled()) {
173 173
 			$status += DoctrineApplication::STATUS_CANCELED;
174 174
 		}
175 175
 
176
-		if ( $application->isDeleted() ) {
176
+		if ($application->isDeleted()) {
177 177
 			$status += DoctrineApplication::STATUS_DELETED;
178 178
 		}
179 179
 
180
-		if ( $application->isConfirmed() || $this->isAutoConfirmed( $status, $application ) ) {
180
+		if ($application->isConfirmed() || $this->isAutoConfirmed($status, $application)) {
181 181
 			$status += DoctrineApplication::STATUS_CONFIRMED;
182 182
 		}
183 183
 
184 184
 		return $status;
185 185
 	}
186 186
 
187
-	private function isAutoConfirmed( int $status, Application $application ): bool {
188
-		return $status === DoctrineApplication::STATUS_NEUTRAL && $this->isDirectDebitPayment( $application );
187
+	private function isAutoConfirmed(int $status, Application $application): bool {
188
+		return $status === DoctrineApplication::STATUS_NEUTRAL && $this->isDirectDebitPayment($application);
189 189
 	}
190 190
 
191
-	private function isDirectDebitPayment( Application $application ): bool {
191
+	private function isDirectDebitPayment(Application $application): bool {
192 192
 		return $application->getPayment()->getPaymentMethod()->getType() === PaymentType::DIRECT_DEBIT;
193 193
 	}
194 194
 
195
-	private function preserveDoctrineStatus( DoctrineApplication $doctrineApplication, int $doctrineStatus ): void {
196
-		if ( $doctrineStatus < DoctrineApplication::STATUS_CONFIRMED ) {
197
-			$doctrineApplication->modifyDataObject( function ( MembershipApplicationData $data ): void {
198
-				$data->setPreservedStatus( DoctrineApplication::STATUS_CONFIRMED );
195
+	private function preserveDoctrineStatus(DoctrineApplication $doctrineApplication, int $doctrineStatus): void {
196
+		if ($doctrineStatus < DoctrineApplication::STATUS_CONFIRMED) {
197
+			$doctrineApplication->modifyDataObject(function(MembershipApplicationData $data): void {
198
+				$data->setPreservedStatus(DoctrineApplication::STATUS_CONFIRMED);
199 199
 			} );
200 200
 		}
201 201
 	}
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 	 * @return Application|null
207 207
 	 * @throws GetMembershipApplicationException
208 208
 	 */
209
-	public function getApplicationById( int $id ): ?Application {
209
+	public function getApplicationById(int $id): ?Application {
210 210
 		try {
211
-			$application = $this->getDoctrineApplicationById( $id );
211
+			$application = $this->getDoctrineApplicationById($id);
212 212
 		}
213
-		catch ( ORMException $ex ) {
214
-			throw new GetMembershipApplicationException( null, $ex );
213
+		catch (ORMException $ex) {
214
+			throw new GetMembershipApplicationException(null, $ex);
215 215
 		}
216 216
 
217
-		if ( $application === null ) {
217
+		if ($application === null) {
218 218
 			return null;
219 219
 		}
220 220
 
@@ -231,25 +231,25 @@  discard block
 block discarded – undo
231 231
 	 * @return DoctrineApplication|null
232 232
 	 * @throws ORMException
233 233
 	 */
234
-	public function getDoctrineApplicationById( int $id ): ?DoctrineApplication {
235
-		return $this->entityManager->find( DoctrineApplication::class, $id );
234
+	public function getDoctrineApplicationById(int $id): ?DoctrineApplication {
235
+		return $this->entityManager->find(DoctrineApplication::class, $id);
236 236
 	}
237 237
 
238
-	private function newApplicationDomainEntity( DoctrineApplication $application ): Application {
238
+	private function newApplicationDomainEntity(DoctrineApplication $application): Application {
239 239
 		return new Application(
240 240
 			$application->getId(),
241 241
 			$application->getMembershipType(),
242 242
 			new Applicant(
243
-				$this->newPersonName( $application ),
244
-				$this->newAddress( $application ),
245
-				new EmailAddress( $application->getApplicantEmailAddress() ),
246
-				new PhoneNumber( $application->getApplicantPhoneNumber() ),
243
+				$this->newPersonName($application),
244
+				$this->newAddress($application),
245
+				new EmailAddress($application->getApplicantEmailAddress()),
246
+				new PhoneNumber($application->getApplicantPhoneNumber()),
247 247
 				$application->getApplicantDateOfBirth()
248 248
 			),
249 249
 			new Payment(
250 250
 				$application->getPaymentIntervalInMonths(),
251
-				Euro::newFromFloat( $application->getPaymentAmount() ),
252
-				$this->newPaymentMethod( $application )
251
+				Euro::newFromFloat($application->getPaymentAmount()),
252
+				$this->newPaymentMethod($application)
253 253
 			),
254 254
 			$application->needsModeration(),
255 255
 			$application->isCancelled(),
@@ -259,77 +259,77 @@  discard block
 block discarded – undo
259 259
 		);
260 260
 	}
261 261
 
262
-	private function newPersonName( DoctrineApplication $application ): ApplicantName {
263
-		if ( empty( $application->getCompany() ) ) {
262
+	private function newPersonName(DoctrineApplication $application): ApplicantName {
263
+		if (empty($application->getCompany())) {
264 264
 			$personName = ApplicantName::newPrivatePersonName();
265
-			$personName->setFirstName( $application->getApplicantFirstName() );
266
-			$personName->setLastName( $application->getApplicantLastName() );
267
-			$personName->setSalutation( $application->getApplicantSalutation() );
268
-			$personName->setTitle( $application->getApplicantTitle() );
265
+			$personName->setFirstName($application->getApplicantFirstName());
266
+			$personName->setLastName($application->getApplicantLastName());
267
+			$personName->setSalutation($application->getApplicantSalutation());
268
+			$personName->setTitle($application->getApplicantTitle());
269 269
 		} else {
270 270
 			$personName = ApplicantName::newCompanyName();
271
-			$personName->setCompanyName( $application->getCompany() );
272
-			$personName->setSalutation( $application->getApplicantSalutation() );
271
+			$personName->setCompanyName($application->getCompany());
272
+			$personName->setSalutation($application->getApplicantSalutation());
273 273
 		}
274 274
 
275 275
 		return $personName->freeze()->assertNoNullFields();
276 276
 	}
277 277
 
278
-	private function newAddress( DoctrineApplication $application ): ApplicantAddress {
278
+	private function newAddress(DoctrineApplication $application): ApplicantAddress {
279 279
 		$address = new ApplicantAddress();
280 280
 
281
-		$address->setCity( $application->getCity() );
282
-		$address->setCountryCode( $application->getCountry() );
283
-		$address->setPostalCode( $application->getPostcode() );
284
-		$address->setStreetAddress( $application->getAddress() );
281
+		$address->setCity($application->getCity());
282
+		$address->setCountryCode($application->getCountry());
283
+		$address->setPostalCode($application->getPostcode());
284
+		$address->setStreetAddress($application->getAddress());
285 285
 
286 286
 		return $address->freeze()->assertNoNullFields();
287 287
 	}
288 288
 
289
-	private function newPaymentMethod( DoctrineApplication $application ): PaymentMethod {
290
-		if ( $application->getPaymentType() === PaymentType::DIRECT_DEBIT ) {
291
-			return new DirectDebitPayment( $this->newBankData( $application ) );
289
+	private function newPaymentMethod(DoctrineApplication $application): PaymentMethod {
290
+		if ($application->getPaymentType() === PaymentType::DIRECT_DEBIT) {
291
+			return new DirectDebitPayment($this->newBankData($application));
292 292
 		}
293 293
 
294
-		if ( $application->getPaymentType() === PaymentType::PAYPAL ) {
295
-			return new PayPalPayment( $this->newPayPalData( $application ) );
294
+		if ($application->getPaymentType() === PaymentType::PAYPAL) {
295
+			return new PayPalPayment($this->newPayPalData($application));
296 296
 		}
297 297
 
298
-		throw new \RuntimeException( 'Unsupported payment type' );
298
+		throw new \RuntimeException('Unsupported payment type');
299 299
 	}
300 300
 
301
-	private function newBankData( DoctrineApplication $application ): BankData {
301
+	private function newBankData(DoctrineApplication $application): BankData {
302 302
 		$bankData = new BankData();
303 303
 
304
-		$bankData->setAccount( $application->getPaymentBankAccount() );
305
-		$bankData->setBankCode( $application->getPaymentBankCode() );
306
-		$bankData->setBankName( $application->getPaymentBankName() );
307
-		$bankData->setBic( $application->getPaymentBic() );
308
-		$bankData->setIban( new Iban( $application->getPaymentIban() ) );
304
+		$bankData->setAccount($application->getPaymentBankAccount());
305
+		$bankData->setBankCode($application->getPaymentBankCode());
306
+		$bankData->setBankName($application->getPaymentBankName());
307
+		$bankData->setBic($application->getPaymentBic());
308
+		$bankData->setIban(new Iban($application->getPaymentIban()));
309 309
 
310 310
 		return $bankData->freeze()->assertNoNullFields();
311 311
 	}
312 312
 
313
-	private function newPayPalData( DoctrineApplication $application ): ?PayPalData {
313
+	private function newPayPalData(DoctrineApplication $application): ?PayPalData {
314 314
 		$data = $application->getDecodedData();
315 315
 
316
-		return ( new PayPalData() )
317
-			->setPayerId( $data['paypal_payer_id'] ?? '' )
318
-			->setSubscriberId( $data['paypal_subscr_id'] ?? '' )
319
-			->setPayerStatus( $data['paypal_payer_status'] ?? '' )
320
-			->setAddressStatus( $data['paypal_address_status'] ?? '' )
321
-			->setAmount( Euro::newFromString( $data['paypal_mc_gross'] ?? '0' ) )
322
-			->setCurrencyCode( $data['paypal_mc_currency'] ?? '' )
323
-			->setFee( Euro::newFromString( $data['paypal_mc_fee'] ?? '0' ) )
324
-			->setSettleAmount( Euro::newFromString( $data['paypal_settle_amount'] ?? '0' ) )
325
-			->setFirstName( $data['paypal_first_name'] ?? '' )
326
-			->setLastName( $data['paypal_last_name'] ?? '' )
327
-			->setAddressName( $data['paypal_address_name'] ?? '' )
328
-			->setPaymentId( $data['ext_payment_id'] ?? '' )
329
-			->setPaymentType( $data['ext_payment_type'] ?? '' )
330
-			->setPaymentStatus( $data['ext_payment_status'] ?? '' )
331
-			->setPaymentTimestamp( $data['ext_payment_timestamp'] ?? '' )
332
-			->setFirstPaymentDate( $data['first_payment_date'] ?? '' )
316
+		return (new PayPalData())
317
+			->setPayerId($data['paypal_payer_id'] ?? '')
318
+			->setSubscriberId($data['paypal_subscr_id'] ?? '')
319
+			->setPayerStatus($data['paypal_payer_status'] ?? '')
320
+			->setAddressStatus($data['paypal_address_status'] ?? '')
321
+			->setAmount(Euro::newFromString($data['paypal_mc_gross'] ?? '0'))
322
+			->setCurrencyCode($data['paypal_mc_currency'] ?? '')
323
+			->setFee(Euro::newFromString($data['paypal_mc_fee'] ?? '0'))
324
+			->setSettleAmount(Euro::newFromString($data['paypal_settle_amount'] ?? '0'))
325
+			->setFirstName($data['paypal_first_name'] ?? '')
326
+			->setLastName($data['paypal_last_name'] ?? '')
327
+			->setAddressName($data['paypal_address_name'] ?? '')
328
+			->setPaymentId($data['ext_payment_id'] ?? '')
329
+			->setPaymentType($data['ext_payment_type'] ?? '')
330
+			->setPaymentStatus($data['ext_payment_status'] ?? '')
331
+			->setPaymentTimestamp($data['ext_payment_timestamp'] ?? '')
332
+			->setFirstPaymentDate($data['first_payment_date'] ?? '')
333 333
 			->freeze()->assertNoNullFields();
334 334
 	}
335 335
 
Please login to merge, or discard this patch.
Presenters/MembershipApplicationConfirmationHtmlPresenterTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\Tests\Integration\Presentation\Presenters;
6 6
 
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	private const STATUS_UNCONFIRMED = 'status-unconfirmed';
22 22
 
23 23
 	/** @dataProvider applicationStatusProvider */
24
-	public function testWhenPresenterPresents_itPassesParametersToTemplate( bool $isConfirmed, string $expectedMappedStatus ): void {
25
-		$twig = $this->getMockBuilder( TwigTemplate::class )->disableOriginalConstructor()->getMock();
26
-		$twig->expects( $this->once() )
27
-			->method( 'render' )
28
-			->with( $this->getExpectedRenderParams( $expectedMappedStatus ) );
24
+	public function testWhenPresenterPresents_itPassesParametersToTemplate(bool $isConfirmed, string $expectedMappedStatus): void {
25
+		$twig = $this->getMockBuilder(TwigTemplate::class)->disableOriginalConstructor()->getMock();
26
+		$twig->expects($this->once())
27
+			->method('render')
28
+			->with($this->getExpectedRenderParams($expectedMappedStatus));
29 29
 
30 30
 		$membershipApplication = ValidMembershipApplication::newDomainEntityUsingPayPal();
31
-		if ( $isConfirmed === true ) {
31
+		if ($isConfirmed === true) {
32 32
 			$membershipApplication->confirm();
33 33
 		}
34 34
 
35
-		$presenter = new MembershipApplicationConfirmationHtmlPresenter( $twig );
35
+		$presenter = new MembershipApplicationConfirmationHtmlPresenter($twig);
36 36
 		$presenter->present(
37 37
 			ShowApplicationConfirmationResponse::newValidResponse(
38 38
 				$membershipApplication,
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 
44 44
 	public function applicationStatusProvider(): array {
45 45
 		return [
46
-			[ true, self::STATUS_BOOKED ],
47
-			[ false, self::STATUS_UNCONFIRMED ]
46
+			[true, self::STATUS_BOOKED],
47
+			[false, self::STATUS_UNCONFIRMED]
48 48
 		];
49 49
 	}
50 50
 
51
-	private function getExpectedRenderParams( string $mappedStatus ): array {
51
+	private function getExpectedRenderParams(string $mappedStatus): array {
52 52
 		return [
53 53
 			'membershipApplication' => [
54 54
 				'id' => null,
Please login to merge, or discard this patch.
src/Factories/FunFunFactory.php 1 patch
Spacing   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\Factories;
6 6
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	private $profiler = null;
192 192
 
193
-	public function __construct( array $config ) {
193
+	public function __construct(array $config) {
194 194
 		$this->config = $config;
195 195
 		$this->pimple = $this->newPimple();
196 196
 	}
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 		};
216 216
 
217 217
 		$pimple['dbal_connection'] = function() {
218
-			return DriverManager::getConnection( $this->config['db'] );
218
+			return DriverManager::getConnection($this->config['db']);
219 219
 		};
220 220
 
221 221
 		$pimple['entity_manager'] = function() {
222
-			$entityManager = ( new StoreFactory( $this->getConnection(), $this->getVarPath() . '/doctrine_proxies' ) )
222
+			$entityManager = (new StoreFactory($this->getConnection(), $this->getVarPath() . '/doctrine_proxies'))
223 223
 				->getEntityManager();
224
-			if ( $this->addDoctrineSubscribers ) {
225
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() );
226
-				$entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineMembershipApplicationPrePersistSubscriber() );
224
+			if ($this->addDoctrineSubscribers) {
225
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineDonationPrePersistSubscriber());
226
+				$entityManager->getEventManager()->addEventSubscriber($this->newDoctrineMembershipApplicationPrePersistSubscriber());
227 227
 			}
228 228
 
229 229
 			return $entityManager;
@@ -231,53 +231,53 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$pimple['subscription_repository'] = function() {
233 233
 			return new LoggingSubscriptionRepository(
234
-				new DoctrineSubscriptionRepository( $this->getEntityManager() ),
234
+				new DoctrineSubscriptionRepository($this->getEntityManager()),
235 235
 				$this->getLogger()
236 236
 			);
237 237
 		};
238 238
 
239 239
 		$pimple['donation_repository'] = function() {
240 240
 			return new LoggingDonationRepository(
241
-				new DoctrineDonationRepository( $this->getEntityManager() ),
241
+				new DoctrineDonationRepository($this->getEntityManager()),
242 242
 				$this->getLogger()
243 243
 			);
244 244
 		};
245 245
 
246 246
 		$pimple['membership_application_repository'] = function() {
247 247
 			return new LoggingApplicationRepository(
248
-				new DoctrineApplicationRepository( $this->getEntityManager() ),
248
+				new DoctrineApplicationRepository($this->getEntityManager()),
249 249
 				$this->getLogger()
250 250
 			);
251 251
 		};
252 252
 
253 253
 		$pimple['comment_repository'] = function() {
254 254
 			$finder = new LoggingCommentFinder(
255
-				new DoctrineCommentFinder( $this->getEntityManager() ),
255
+				new DoctrineCommentFinder($this->getEntityManager()),
256 256
 				$this->getLogger()
257 257
 			);
258 258
 
259
-			return $this->addProfilingDecorator( $finder, 'CommentFinder' );
259
+			return $this->addProfilingDecorator($finder, 'CommentFinder');
260 260
 		};
261 261
 
262 262
 		$pimple['mail_validator'] = function() {
263
-			return new EmailValidator( new InternetDomainNameValidator() );
263
+			return new EmailValidator(new InternetDomainNameValidator());
264 264
 		};
265 265
 
266 266
 		$pimple['subscription_validator'] = function() {
267 267
 			return new SubscriptionValidator(
268 268
 				$this->getEmailValidator(),
269
-				$this->newTextPolicyValidator( 'fields' ),
269
+				$this->newTextPolicyValidator('fields'),
270 270
 				$this->newSubscriptionDuplicateValidator(),
271 271
 				$this->newHonorificValidator()
272 272
 			);
273 273
 		};
274 274
 
275 275
 		$pimple['template_name_validator'] = function() {
276
-			return new TemplateNameValidator( $this->getSkinTwig() );
276
+			return new TemplateNameValidator($this->getSkinTwig());
277 277
 		};
278 278
 
279 279
 		$pimple['contact_validator'] = function() {
280
-			return new GetInTouchValidator( $this->getEmailValidator() );
280
+			return new GetInTouchValidator($this->getEmailValidator());
281 281
 		};
282 282
 
283 283
 		$pimple['greeting_generator'] = function() {
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 			];
292 292
 			$locale = $this->config['locale'];
293 293
 			$messagesPath = $this->getI18nDirectory() . $this->config['translation']['message-dir'];
294
-			$translator = $translationFactory->create( $loaders, $locale );
294
+			$translator = $translationFactory->create($loaders, $locale);
295 295
 			foreach ($this->config['translation']['files'] as $domain => $file) {
296
-				$translator->addResource( 'json', $messagesPath . '/' . $file, $locale, $domain );
296
+				$translator->addResource('json', $messagesPath . '/' . $file, $locale, $domain);
297 297
 			}
298 298
 
299 299
 			return $translator;
@@ -301,27 +301,27 @@  discard block
 block discarded – undo
301 301
 
302 302
 		// In the future, this could be locale-specific or filled from a DB table
303 303
 		$pimple['honorifics'] = function() {
304
-			return new Honorifics( [
304
+			return new Honorifics([
305 305
 				'' => 'Kein Titel',
306 306
 				'Dr.' => 'Dr.',
307 307
 				'Prof.' => 'Prof.',
308 308
 				'Prof. Dr.' => 'Prof. Dr.'
309
-			] );
309
+			]);
310 310
 		};
311 311
 
312 312
 		$pimple['twig'] = function() {
313 313
 			$config = $this->config['twig'];
314 314
 			$config['loaders']['filesystem']['template-dir'] = 'skins/' . $this->getSkinSettings()->getSkin() . '/templates';
315 315
 
316
-			$twigFactory = $this->newTwigFactory( $config );
316
+			$twigFactory = $this->newTwigFactory($config);
317 317
 			$configurator = $twigFactory->newTwigEnvironmentConfigurator();
318 318
 
319
-			$loaders = array_filter( [
319
+			$loaders = array_filter([
320 320
 				$twigFactory->newFileSystemLoader(),
321 321
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
322
-			] );
322
+			]);
323 323
 			$extensions = [
324
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
324
+				$twigFactory->newTranslationExtension($this->getTranslator()),
325 325
 				new Twig_Extensions_Extension_Intl()
326 326
 			];
327 327
 			$filters = [
@@ -332,48 +332,48 @@  discard block
 block discarded – undo
332 332
 			$functions = [
333 333
 				new Twig_SimpleFunction(
334 334
 					'web_content',
335
-					function( string $name, array $context = [] ): string {
336
-						return $this->getContentProvider()->getWeb( $name, $context );
335
+					function(string $name, array $context = []): string {
336
+						return $this->getContentProvider()->getWeb($name, $context);
337 337
 					},
338
-					[ 'is_safe' => [ 'html' ] ]
338
+					['is_safe' => ['html']]
339 339
 				),
340 340
 			];
341 341
 
342
-			return $configurator->getEnvironment( $this->pimple['skin_twig_environment'], $loaders, $extensions, $filters, $functions );
342
+			return $configurator->getEnvironment($this->pimple['skin_twig_environment'], $loaders, $extensions, $filters, $functions);
343 343
 		};
344 344
 
345 345
 		$pimple['mailer_twig'] = function() {
346
-			$twigFactory = $this->newTwigFactory( $this->config['mailer-twig'] );
346
+			$twigFactory = $this->newTwigFactory($this->config['mailer-twig']);
347 347
 			$configurator = $twigFactory->newTwigEnvironmentConfigurator();
348 348
 
349
-			$loaders = array_filter( [
349
+			$loaders = array_filter([
350 350
 				$twigFactory->newFileSystemLoader(),
351 351
 				$twigFactory->newArrayLoader(), // This is just a fallback for testing
352
-			] );
352
+			]);
353 353
 			$extensions = [
354
-				$twigFactory->newTranslationExtension( $this->getTranslator() ),
354
+				$twigFactory->newTranslationExtension($this->getTranslator()),
355 355
 				new Twig_Extensions_Extension_Intl(),
356 356
 			];
357 357
 			$filters = [];
358 358
 			$functions = [
359 359
 				new Twig_SimpleFunction(
360 360
 					'mail_content',
361
-					function( string $name, array $context = [] ): string {
362
-						return $this->getContentProvider()->getMail( $name, $context );
361
+					function(string $name, array $context = []): string {
362
+						return $this->getContentProvider()->getMail($name, $context);
363 363
 					},
364
-					[ 'is_safe' => [ 'all' ] ]
364
+					['is_safe' => ['all']]
365 365
 				),
366 366
 				new Twig_SimpleFunction(
367 367
 					'url',
368
-					function( string $name, array $parameters = [] ): string {
369
-						return $this->getUrlGenerator()->generateUrl( $name, $parameters );
368
+					function(string $name, array $parameters = []): string {
369
+						return $this->getUrlGenerator()->generateUrl($name, $parameters);
370 370
 					}
371 371
 				)
372 372
 			];
373 373
 
374 374
 			$twigEnvironment = new Twig_Environment();
375 375
 
376
-			return $configurator->getEnvironment( $twigEnvironment, $loaders, $extensions, $filters, $functions );
376
+			return $configurator->getEnvironment($twigEnvironment, $loaders, $extensions, $filters, $functions);
377 377
 		};
378 378
 
379 379
 		$pimple['messenger_suborganization'] = function() {
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 		};
394 394
 
395 395
 		$pimple['confirmation-page-selector'] = function() {
396
-			return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] );
396
+			return new DonationConfirmationPageSelector($this->config['confirmation-pages']);
397 397
 		};
398 398
 
399 399
 		$pimple['paypal-payment-notification-verifier'] = function() {
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
 		$pimple['donation_token_generator'] = function() {
433 433
 			return new RandomTokenGenerator(
434 434
 				$this->config['token-length'],
435
-				new \DateInterval( $this->config['token-validity-timestamp'] )
435
+				new \DateInterval($this->config['token-validity-timestamp'])
436 436
 			);
437 437
 		};
438 438
 
439 439
 		$pimple['membership_token_generator'] = function() {
440 440
 			return new RandomMembershipTokenGenerator(
441 441
 				$this->config['token-length'],
442
-				new \DateInterval( $this->config['token-validity-timestamp'] )
442
+				new \DateInterval($this->config['token-validity-timestamp'])
443 443
 			);
444 444
 		};
445 445
 
@@ -451,41 +451,41 @@  discard block
 block discarded – undo
451 451
 			return new VoidCache();
452 452
 		};
453 453
 
454
-		$pimple['page_view_tracker'] = function () {
455
-			return new PageViewTracker( $this->newServerSideTracker(), $this->config['piwik']['siteUrlBase'] );
454
+		$pimple['page_view_tracker'] = function() {
455
+			return new PageViewTracker($this->newServerSideTracker(), $this->config['piwik']['siteUrlBase']);
456 456
 		};
457 457
 
458
-		$pimple['cachebusting_fileprefixer'] = function () {
459
-			return new FilePrefixer( $this->getFilePrefix() );
458
+		$pimple['cachebusting_fileprefixer'] = function() {
459
+			return new FilePrefixer($this->getFilePrefix());
460 460
 		};
461 461
 
462
-		$pimple['content_page_selector'] = function () {
463
-			$json = (new SimpleFileFetcher())->fetchFile( $this->getI18nDirectory() . '/data/pages.json' );
464
-			$config = json_decode( $json, true ) ?? [];
462
+		$pimple['content_page_selector'] = function() {
463
+			$json = (new SimpleFileFetcher())->fetchFile($this->getI18nDirectory() . '/data/pages.json');
464
+			$config = json_decode($json, true) ?? [];
465 465
 
466
-			return new PageSelector( $config );
466
+			return new PageSelector($config);
467 467
 		};
468 468
 
469
-		$pimple['content_provider'] = function () {
470
-			return new ContentProvider( [
469
+		$pimple['content_provider'] = function() {
470
+			return new ContentProvider([
471 471
 				'content_path' => $this->getI18nDirectory(),
472 472
 				'cache' => $this->config['twig']['enable-cache'] ? $this->getCachePath() . '/content' : false,
473 473
 				'globals' => [
474 474
 					'basepath' => $this->config['web-basepath']
475 475
 				]
476
-			] );
476
+			]);
477 477
 		};
478 478
 
479 479
 		$pimple['payment-delay-calculator'] = function() {
480
-			return new DefaultPaymentDelayCalculator( $this->getPaymentDelayInDays() );
480
+			return new DefaultPaymentDelayCalculator($this->getPaymentDelayInDays());
481 481
 		};
482 482
 
483
-		$pimple['sofort-client'] = function () {
483
+		$pimple['sofort-client'] = function() {
484 484
 			$config = $this->config['sofort'];
485
-			return new SofortClient( $config['config-key'] );
485
+			return new SofortClient($config['config-key']);
486 486
 		};
487 487
 
488
-		$pimple['cookie-builder'] = function (): CookieBuilder {
488
+		$pimple['cookie-builder'] = function(): CookieBuilder {
489 489
 			return new CookieBuilder(
490 490
 				$this->config['cookie']['expiration'],
491 491
 				$this->config['cookie']['path'],
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 			);
498 498
 		};
499 499
 
500
-		$pimple['skin-settings'] = function (): SkinSettings {
500
+		$pimple['skin-settings'] = function(): SkinSettings {
501 501
 			$config = $this->config['skin'];
502
-			return new SkinSettings( $config['options'], $config['default'], $config['cookie-lifetime'] );
502
+			return new SkinSettings($config['options'], $config['default'], $config['cookie-lifetime']);
503 503
 		};
504 504
 
505
-		$pimple['payment-types-settings'] = function (): PaymentTypesSettings {
506
-			return new PaymentTypesSettings( $this->config['payment-types'] );
505
+		$pimple['payment-types-settings'] = function(): PaymentTypesSettings {
506
+			return new PaymentTypesSettings($this->config['payment-types']);
507 507
 		};
508 508
 
509 509
 		return $pimple;
@@ -519,17 +519,17 @@  discard block
 block discarded – undo
519 519
 
520 520
 	private function newDonationEventLogger(): DonationEventLogger {
521 521
 		return new BestEffortDonationEventLogger(
522
-			new DoctrineDonationEventLogger( $this->getEntityManager() ),
522
+			new DoctrineDonationEventLogger($this->getEntityManager()),
523 523
 			$this->getLogger()
524 524
 		);
525 525
 	}
526 526
 
527 527
 	public function newInstaller(): Installer {
528
-		return ( new StoreFactory( $this->getConnection() ) )->newInstaller();
528
+		return (new StoreFactory($this->getConnection()))->newInstaller();
529 529
 	}
530 530
 
531 531
 	public function newListCommentsUseCase(): ListCommentsUseCase {
532
-		return new ListCommentsUseCase( $this->getCommentFinder() );
532
+		return new ListCommentsUseCase($this->getCommentFinder());
533 533
 	}
534 534
 
535 535
 	public function newCommentListJsonPresenter(): CommentListJsonPresenter {
@@ -537,14 +537,14 @@  discard block
 block discarded – undo
537 537
 	}
538 538
 
539 539
 	public function newCommentListRssPresenter(): CommentListRssPresenter {
540
-		return new CommentListRssPresenter( new TwigTemplate(
540
+		return new CommentListRssPresenter(new TwigTemplate(
541 541
 			$this->getSkinTwig(),
542 542
 			'Comment_List.rss.twig'
543
-		) );
543
+		));
544 544
 	}
545 545
 
546 546
 	public function newCommentListHtmlPresenter(): CommentListHtmlPresenter {
547
-		return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'Comment_List.html.twig', [ 'piwikGoals' => [ 1 ] ] ) );
547
+		return new CommentListHtmlPresenter($this->getLayoutTemplate('Comment_List.html.twig', ['piwikGoals' => [1]]));
548 548
 	}
549 549
 
550 550
 	private function getCommentFinder(): CommentFinder {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		return $this->pimple['subscription_repository'];
556 556
 	}
557 557
 
558
-	public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ): void {
558
+	public function setSubscriptionRepository(SubscriptionRepository $subscriptionRepository): void {
559 559
 		$this->pimple['subscription_repository'] = $subscriptionRepository;
560 560
 	}
561 561
 
@@ -572,25 +572,25 @@  discard block
 block discarded – undo
572 572
 	}
573 573
 
574 574
 	public function newAddSubscriptionHtmlPresenter(): AddSubscriptionHtmlPresenter {
575
-		return new AddSubscriptionHtmlPresenter( $this->getLayoutTemplate( 'Subscription_Form.html.twig' ), $this->getTranslator() );
575
+		return new AddSubscriptionHtmlPresenter($this->getLayoutTemplate('Subscription_Form.html.twig'), $this->getTranslator());
576 576
 	}
577 577
 
578 578
 	public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter {
579 579
 		return new ConfirmSubscriptionHtmlPresenter(
580
-			$this->getLayoutTemplate( 'Confirm_Subscription.twig' ),
580
+			$this->getLayoutTemplate('Confirm_Subscription.twig'),
581 581
 			$this->getTranslator()
582 582
 		);
583 583
 	}
584 584
 
585 585
 	public function newAddSubscriptionJsonPresenter(): AddSubscriptionJsonPresenter {
586
-		return new AddSubscriptionJsonPresenter( $this->getTranslator() );
586
+		return new AddSubscriptionJsonPresenter($this->getTranslator());
587 587
 	}
588 588
 
589 589
 	public function newGetInTouchHtmlPresenter(): GetInTouchHtmlPresenter {
590
-		return new GetInTouchHtmlPresenter( $this->getLayoutTemplate( 'contact_form.html.twig' ), $this->getTranslator() );
590
+		return new GetInTouchHtmlPresenter($this->getLayoutTemplate('contact_form.html.twig'), $this->getTranslator());
591 591
 	}
592 592
 
593
-	public function setSkinTwigEnvironment( Twig_Environment $twig ): void {
593
+	public function setSkinTwigEnvironment(Twig_Environment $twig): void {
594 594
 		$this->pimple['skin_twig_environment'] = $twig;
595 595
 	}
596 596
 
@@ -609,19 +609,19 @@  discard block
 block discarded – undo
609 609
 	 * @param array $context Additional variables for the template
610 610
 	 * @return TwigTemplate
611 611
 	 */
612
-	public function getLayoutTemplate( string $templateName, array $context = [] ): TwigTemplate {
612
+	public function getLayoutTemplate(string $templateName, array $context = []): TwigTemplate {
613 613
 		 return new TwigTemplate(
614 614
 			$this->getSkinTwig(),
615 615
 			$templateName,
616
-			array_merge( $this->getDefaultTwigVariables(), $context )
616
+			array_merge($this->getDefaultTwigVariables(), $context)
617 617
 		);
618 618
 	}
619 619
 
620
-	public function getMailerTemplate( string $templateName, array $context = [] ): TwigTemplate {
620
+	public function getMailerTemplate(string $templateName, array $context = []): TwigTemplate {
621 621
 		return new TwigTemplate(
622 622
 			$this->getMailerTwig(),
623 623
 			$templateName,
624
-			array_merge( $this->getDefaultTwigVariables(), $context )
624
+			array_merge($this->getDefaultTwigVariables(), $context)
625 625
 		);
626 626
 	}
627 627
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 			new TwigTemplate(
703 703
 					$this->getMailerTwig(),
704 704
 					'Subscription_Confirmation.txt.twig',
705
-					[ 'greeting_generator' => $this->getGreetingGenerator() ]
705
+					['greeting_generator' => $this->getGreetingGenerator()]
706 706
 			),
707 707
 			'mail_subject_subscription_confirmed'
708 708
 		);
@@ -714,16 +714,16 @@  discard block
 block discarded – undo
714 714
 	 * So much decoration going on that explicitly hinting what we return (Robustness principle) would be confusing
715 715
 	 * (you'd expect a TemplateBasedMailer, not a LoggingMailer), so we hint the interface instead.
716 716
 	 */
717
-	private function newTemplateMailer( Messenger $messenger, TwigTemplate $template, string $messageKey ): TemplateMailerInterface {
717
+	private function newTemplateMailer(Messenger $messenger, TwigTemplate $template, string $messageKey): TemplateMailerInterface {
718 718
 		$mailer = new TemplateBasedMailer(
719 719
 			$messenger,
720 720
 			$template,
721
-			$this->getTranslator()->trans( $messageKey )
721
+			$this->getTranslator()->trans($messageKey)
722 722
 		);
723 723
 
724
-		$mailer = new LoggingMailer( $mailer, $this->getLogger() );
724
+		$mailer = new LoggingMailer($mailer, $this->getLogger());
725 725
 
726
-		return $this->addProfilingDecorator( $mailer, 'Mailer' );
726
+		return $this->addProfilingDecorator($mailer, 'Mailer');
727 727
 	}
728 728
 
729 729
 	public function getGreetingGenerator(): GreetingGenerator {
@@ -731,11 +731,11 @@  discard block
 block discarded – undo
731 731
 	}
732 732
 
733 733
 	public function newCheckIbanUseCase(): CheckIbanUseCase {
734
-		return new CheckIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
734
+		return new CheckIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
735 735
 	}
736 736
 
737 737
 	public function newGenerateIbanUseCase(): GenerateIbanUseCase {
738
-		return new GenerateIbanUseCase( $this->newBankDataConverter(), $this->newIbanValidator() );
738
+		return new GenerateIbanUseCase($this->newBankDataConverter(), $this->newIbanValidator());
739 739
 	}
740 740
 
741 741
 	public function newIbanPresenter(): IbanPresenter {
@@ -743,10 +743,10 @@  discard block
 block discarded – undo
743 743
 	}
744 744
 
745 745
 	public function newBankDataConverter(): BankDataConverter {
746
-		return new BankDataConverter( $this->config['bank-data-file'] );
746
+		return new BankDataConverter($this->config['bank-data-file']);
747 747
 	}
748 748
 
749
-	public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ): void {
749
+	public function setSubscriptionValidator(SubscriptionValidator $subscriptionValidator): void {
750 750
 		$this->pimple['subscription_validator'] = $subscriptionValidator;
751 751
 	}
752 752
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	private function newContactUserMailer(): TemplateMailerInterface {
762 762
 		return $this->newTemplateMailer(
763 763
 			$this->getSuborganizationMessenger(),
764
-			new TwigTemplate( $this->getMailerTwig(), 'Contact_Confirm_to_User.txt.twig' ),
764
+			new TwigTemplate($this->getMailerTwig(), 'Contact_Confirm_to_User.txt.twig'),
765 765
 			'mail_subject_getintouch'
766 766
 		);
767 767
 	}
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 	private function newContactOperatorMailer(): OperatorMailer {
770 770
 		return new OperatorMailer(
771 771
 			$this->getSuborganizationMessenger(),
772
-			new TwigTemplate( $this->getMailerTwig(), 'Contact_Forward_to_Operator.txt.twig' ),
773
-			$this->getTranslator()->trans( 'mail_subject_getintouch_forward' )
772
+			new TwigTemplate($this->getMailerTwig(), 'Contact_Forward_to_Operator.txt.twig'),
773
+			$this->getTranslator()->trans('mail_subject_getintouch_forward')
774 774
 		);
775 775
 	}
776 776
 
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
 
788 788
 	private function newSubscriptionDuplicateCutoffDate(): \DateTime {
789 789
 		$cutoffDateTime = new \DateTime();
790
-		$cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) );
790
+		$cutoffDateTime->sub(new \DateInterval($this->config['subscription-interval']));
791 791
 		return $cutoffDateTime;
792 792
 	}
793 793
 
794 794
 	private function newHonorificValidator(): AllowedValuesValidator {
795
-		return new AllowedValuesValidator( $this->getHonorifics()->getKeys() );
795
+		return new AllowedValuesValidator($this->getHonorifics()->getKeys());
796 796
 	}
797 797
 
798 798
 	private function getHonorifics(): Honorifics {
@@ -801,20 +801,20 @@  discard block
 block discarded – undo
801 801
 
802 802
 	public function newAuthorizedCachePurger(): AuthorizedCachePurger {
803 803
 		return new AuthorizedCachePurger(
804
-			new AllOfTheCachePurger( $this->getSkinTwig(), $this->getPageCache(), $this->getRenderedPageCache() ),
804
+			new AllOfTheCachePurger($this->getSkinTwig(), $this->getPageCache(), $this->getRenderedPageCache()),
805 805
 			$this->config['purging-secret']
806 806
 		);
807 807
 	}
808 808
 
809 809
 	private function newBankDataValidator(): BankDataValidator {
810
-		return new BankDataValidator( $this->newIbanValidator() );
810
+		return new BankDataValidator($this->newIbanValidator());
811 811
 	}
812 812
 
813 813
 	private function getSuborganizationMessenger(): Messenger {
814 814
 		return $this->pimple['messenger_suborganization'];
815 815
 	}
816 816
 
817
-	public function setSuborganizationMessenger( Messenger $messenger ): void {
817
+	public function setSuborganizationMessenger(Messenger $messenger): void {
818 818
 		$this->pimple['messenger_suborganization'] = $messenger;
819 819
 	}
820 820
 
@@ -822,57 +822,57 @@  discard block
 block discarded – undo
822 822
 		return $this->pimple['messenger_organization'];
823 823
 	}
824 824
 
825
-	public function setOrganizationMessenger( Messenger $messenger ): void {
825
+	public function setOrganizationMessenger(Messenger $messenger): void {
826 826
 		$this->pimple['messenger_organization'] = $messenger;
827 827
 	}
828 828
 
829 829
 	public function setNullMessenger(): void {
830
-		$this->setSuborganizationMessenger( new Messenger(
830
+		$this->setSuborganizationMessenger(new Messenger(
831 831
 			Swift_NullTransport::newInstance(),
832 832
 			$this->getSubOrganizationEmailAddress()
833
-		) );
834
-		$this->setOrganizationMessenger( new Messenger(
833
+		));
834
+		$this->setOrganizationMessenger(new Messenger(
835 835
 			Swift_NullTransport::newInstance(),
836 836
 			$this->getOrganizationEmailAddress()
837
-		) );
837
+		));
838 838
 	}
839 839
 
840 840
 	public function getSubOrganizationEmailAddress(): EmailAddress {
841
-		return new EmailAddress( $this->config['contact-info']['suborganization']['email'] );
841
+		return new EmailAddress($this->config['contact-info']['suborganization']['email']);
842 842
 	}
843 843
 
844 844
 	public function getOrganizationEmailAddress(): EmailAddress {
845
-		return new EmailAddress( $this->config['contact-info']['organization']['email'] );
845
+		return new EmailAddress($this->config['contact-info']['organization']['email']);
846 846
 	}
847 847
 
848 848
 	public function newInternalErrorHtmlPresenter(): InternalErrorHtmlPresenter {
849
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Error_Page.html.twig' ) );
849
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Error_Page.html.twig'));
850 850
 	}
851 851
 
852 852
 	public function newAccessDeniedHtmlPresenter(): InternalErrorHtmlPresenter {
853
-		return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Access_Denied.twig' ) );
853
+		return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Access_Denied.twig'));
854 854
 	}
855 855
 
856 856
 	public function getTranslator(): TranslatorInterface {
857 857
 		return $this->pimple['translator'];
858 858
 	}
859 859
 
860
-	public function setTranslator( TranslatorInterface $translator ): void {
860
+	public function setTranslator(TranslatorInterface $translator): void {
861 861
 		$this->pimple['translator'] = $translator;
862 862
 	}
863 863
 
864
-	private function newTwigFactory( array $twigConfig ): TwigFactory {
864
+	private function newTwigFactory(array $twigConfig): TwigFactory {
865 865
 		return new TwigFactory(
866 866
 			array_merge_recursive(
867 867
 				$twigConfig,
868
-				[ 'web-basepath' => $this->config['web-basepath'] ]
868
+				['web-basepath' => $this->config['web-basepath']]
869 869
 			),
870 870
 			$this->getCachePath() . '/twig',
871 871
 			$this->config['locale']
872 872
 		);
873 873
 	}
874 874
 
875
-	private function newTextPolicyValidator( string $policyName ): TextPolicyValidator {
875
+	private function newTextPolicyValidator(string $policyName): TextPolicyValidator {
876 876
 		$fetcher = new ErrorLoggingFileFetcher(
877 877
 			new SimpleFileFetcher(),
878 878
 			$this->getLogger()
@@ -881,24 +881,24 @@  discard block
 block discarded – undo
881 881
 		return new TextPolicyValidator(
882 882
 			new WordListFileReader(
883 883
 				$fetcher,
884
-				$textPolicyConfig['badwords'] ? $this->getAbsolutePath( $textPolicyConfig['badwords'] ) : ''
884
+				$textPolicyConfig['badwords'] ? $this->getAbsolutePath($textPolicyConfig['badwords']) : ''
885 885
 			),
886 886
 			new WordListFileReader(
887 887
 				$fetcher,
888
-				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath( $textPolicyConfig['whitewords'] ) : ''
888
+				$textPolicyConfig['whitewords'] ? $this->getAbsolutePath($textPolicyConfig['whitewords']) : ''
889 889
 			)
890 890
 		);
891 891
 	}
892 892
 
893 893
 	private function newCommentPolicyValidator(): TextPolicyValidator {
894
-		return $this->newTextPolicyValidator( 'comment' );
894
+		return $this->newTextPolicyValidator('comment');
895 895
 	}
896 896
 
897
-	public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase {
897
+	public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase {
898 898
 		return new CancelDonationUseCase(
899 899
 			$this->getDonationRepository(),
900 900
 			$this->newCancelDonationMailer(),
901
-			$this->newDonationAuthorizer( $updateToken ),
901
+			$this->newDonationAuthorizer($updateToken),
902 902
 			$this->newDonationEventLogger()
903 903
 		);
904 904
 	}
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 			new TwigTemplate(
910 910
 				$this->getMailerTwig(),
911 911
 				'Donation_Cancellation_Confirmation.txt.twig',
912
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
912
+				['greeting_generator' => $this->getGreetingGenerator()]
913 913
 			),
914 914
 			'mail_subject_confirm_cancellation'
915 915
 		);
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 	public function newPayPalUrlGeneratorForDonations(): PayPalUrlGenerator {
969 969
 		return new PayPalUrlGenerator(
970 970
 			$this->getPayPalUrlConfigForDonations(),
971
-			$this->getTranslator()->trans( 'item_name_donation' )
971
+			$this->getTranslator()->trans('item_name_donation')
972 972
 		);
973 973
 	}
974 974
 
975 975
 	public function newPayPalUrlGeneratorForMembershipApplications(): PayPalUrlGenerator {
976 976
 		return new PayPalUrlGenerator(
977 977
 			$this->getPayPalUrlConfigForMembershipApplications(),
978
-			$this->getTranslator()->trans( 'item_name_membership' )
978
+			$this->getTranslator()->trans('item_name_membership')
979 979
 		);
980 980
 	}
981 981
 
982 982
 	private function getPayPalUrlConfigForDonations(): PayPalConfig {
983
-		return PayPalConfig::newFromConfig( $this->config['paypal-donation'] );
983
+		return PayPalConfig::newFromConfig($this->config['paypal-donation']);
984 984
 	}
985 985
 
986 986
 	private function getPayPalUrlConfigForMembershipApplications(): PayPalConfig {
987
-		return PayPalConfig::newFromConfig( $this->config['paypal-membership'] );
987
+		return PayPalConfig::newFromConfig($this->config['paypal-membership']);
988 988
 	}
989 989
 
990 990
 	public function newSofortUrlGeneratorForDonations(): SofortUrlGenerator {
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 		return new SofortUrlGenerator(
994 994
 			new SofortConfig(
995
-				$this->getTranslator()->trans( 'item_name_donation', [], 'messages' ),
995
+				$this->getTranslator()->trans('item_name_donation', [], 'messages'),
996 996
 				$config['return-url'],
997 997
 				$config['cancel-url'],
998 998
 				$config['notification-url']
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		);
1002 1002
 	}
1003 1003
 
1004
-	public function setSofortClient( SofortClient $client ): void {
1004
+	public function setSofortClient(SofortClient $client): void {
1005 1005
 		$this->pimple['sofort-client'] = $client;
1006 1006
 	}
1007 1007
 
@@ -1010,11 +1010,11 @@  discard block
 block discarded – undo
1010 1010
 	}
1011 1011
 
1012 1012
 	private function newCreditCardUrlGenerator(): CreditCardUrlGenerator {
1013
-		return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() );
1013
+		return new CreditCardUrlGenerator($this->newCreditCardUrlConfig());
1014 1014
 	}
1015 1015
 
1016 1016
 	private function newCreditCardUrlConfig(): CreditCardConfig {
1017
-		return CreditCardConfig::newFromConfig( $this->config['creditcard'] );
1017
+		return CreditCardConfig::newFromConfig($this->config['creditcard']);
1018 1018
 	}
1019 1019
 
1020 1020
 	public function getDonationRepository(): DonationRepository {
@@ -1030,23 +1030,23 @@  discard block
 block discarded – undo
1030 1030
 	}
1031 1031
 
1032 1032
 	private function newAmountFormatter(): AmountFormatter {
1033
-		return new AmountFormatter( $this->config['locale'] );
1033
+		return new AmountFormatter($this->config['locale']);
1034 1034
 	}
1035 1035
 
1036 1036
 	public function newDecimalNumberFormatter(): NumberFormatter {
1037
-		return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL );
1037
+		return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL);
1038 1038
 	}
1039 1039
 
1040
-	public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase {
1040
+	public function newAddCommentUseCase(string $updateToken): AddCommentUseCase {
1041 1041
 		return new AddCommentUseCase(
1042 1042
 			$this->getDonationRepository(),
1043
-			$this->newDonationAuthorizer( $updateToken ),
1043
+			$this->newDonationAuthorizer($updateToken),
1044 1044
 			$this->newCommentPolicyValidator(),
1045 1045
 			$this->newAddCommentValidator()
1046 1046
 		);
1047 1047
 	}
1048 1048
 
1049
-	private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer {
1049
+	private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer {
1050 1050
 		return new DoctrineDonationAuthorizer(
1051 1051
 			$this->getEntityManager(),
1052 1052
 			$updateToken,
@@ -1062,12 +1062,12 @@  discard block
 block discarded – undo
1062 1062
 		return $this->pimple['membership_token_generator'];
1063 1063
 	}
1064 1064
 
1065
-	public function newDonationConfirmationPresenter( string $templateName = 'Donation_Confirmation.html.twig' ): DonationConfirmationHtmlPresenter {
1065
+	public function newDonationConfirmationPresenter(string $templateName = 'Donation_Confirmation.html.twig'): DonationConfirmationHtmlPresenter {
1066 1066
 		return new DonationConfirmationHtmlPresenter(
1067 1067
 			$this->getLayoutTemplate(
1068 1068
 				$templateName,
1069 1069
 				[
1070
-					'piwikGoals' => [ 3 ],
1070
+					'piwikGoals' => [3],
1071 1071
 					'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForMembershipApplication()
1072 1072
 				]
1073 1073
 			),
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 	public function newCancelDonationHtmlPresenter(): CancelDonationHtmlPresenter {
1086 1086
 		return new CancelDonationHtmlPresenter(
1087
-			$this->getLayoutTemplate( 'Donation_Cancellation_Confirmation.html.twig' )
1087
+			$this->getLayoutTemplate('Donation_Cancellation_Confirmation.html.twig')
1088 1088
 		);
1089 1089
 	}
1090 1090
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 			new TwigTemplate(
1108 1108
 				$this->getMailerTwig(),
1109 1109
 				'Membership_Application_Confirmation.txt.twig',
1110
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1110
+				['greeting_generator' => $this->getGreetingGenerator()]
1111 1111
 			),
1112 1112
 			'mail_subject_confirm_membership_application'
1113 1113
 		);
@@ -1122,11 +1122,11 @@  discard block
 block discarded – undo
1122 1122
 	}
1123 1123
 
1124 1124
 	private function newMembershipApplicationTracker(): ApplicationTracker {
1125
-		return new DoctrineApplicationTracker( $this->getEntityManager() );
1125
+		return new DoctrineApplicationTracker($this->getEntityManager());
1126 1126
 	}
1127 1127
 
1128 1128
 	private function newMembershipApplicationPiwikTracker(): ApplicationPiwikTracker {
1129
-		return new DoctrineApplicationPiwikTracker( $this->getEntityManager() );
1129
+		return new DoctrineApplicationPiwikTracker($this->getEntityManager());
1130 1130
 	}
1131 1131
 
1132 1132
 	private function getPaymentDelayCalculator(): PaymentDelayCalculator {
@@ -1137,20 +1137,20 @@  discard block
 block discarded – undo
1137 1137
 		return $this->getPayPalUrlConfigForMembershipApplications()->getDelayInDays();
1138 1138
 	}
1139 1139
 
1140
-	public function setPaymentDelayCalculator( PaymentDelayCalculator $paymentDelayCalculator ): void {
1140
+	public function setPaymentDelayCalculator(PaymentDelayCalculator $paymentDelayCalculator): void {
1141 1141
 		$this->pimple['payment-delay-calculator'] = $paymentDelayCalculator;
1142 1142
 	}
1143 1143
 
1144 1144
 	private function newApplyForMembershipPolicyValidator(): ApplyForMembershipPolicyValidator {
1145 1145
 		return new ApplyForMembershipPolicyValidator(
1146
-			$this->newTextPolicyValidator( 'fields' ),
1146
+			$this->newTextPolicyValidator('fields'),
1147 1147
 			$this->config['email-address-blacklist']
1148 1148
 		);
1149 1149
 	}
1150 1150
 
1151
-	public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase {
1151
+	public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase {
1152 1152
 		return new CancelMembershipApplicationUseCase(
1153
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1153
+			$this->newMembershipApplicationAuthorizer($updateToken),
1154 1154
 			$this->getMembershipApplicationRepository(),
1155 1155
 			$this->newCancelMembershipApplicationMailer()
1156 1156
 		);
@@ -1176,29 +1176,29 @@  discard block
 block discarded – undo
1176 1176
 			new TwigTemplate(
1177 1177
 				$this->getMailerTwig(),
1178 1178
 				'Membership_Application_Cancellation_Confirmation.txt.twig',
1179
-				[ 'greeting_generator' => $this->getGreetingGenerator() ]
1179
+				['greeting_generator' => $this->getGreetingGenerator()]
1180 1180
 			),
1181 1181
 			'mail_subject_confirm_membership_application_cancellation'
1182 1182
 		);
1183 1183
 	}
1184 1184
 
1185
-	public function newMembershipApplicationConfirmationUseCase( string $accessToken ): ShowApplicationConfirmationUseCase {
1185
+	public function newMembershipApplicationConfirmationUseCase(string $accessToken): ShowApplicationConfirmationUseCase {
1186 1186
 		return new ShowApplicationConfirmationUseCase(
1187
-			$this->newMembershipApplicationAuthorizer( null, $accessToken ),
1187
+			$this->newMembershipApplicationAuthorizer(null, $accessToken),
1188 1188
 			$this->getMembershipApplicationRepository(),
1189 1189
 			$this->newMembershipApplicationTokenFetcher()
1190 1190
 		);
1191 1191
 	}
1192 1192
 
1193
-	public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase {
1193
+	public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase {
1194 1194
 		return new ShowDonationConfirmationUseCase(
1195
-			$this->newDonationAuthorizer( null, $accessToken ),
1195
+			$this->newDonationAuthorizer(null, $accessToken),
1196 1196
 			$this->newDonationTokenFetcher(),
1197 1197
 			$this->getDonationRepository()
1198 1198
 		);
1199 1199
 	}
1200 1200
 
1201
-	public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ): void {
1201
+	public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector): void {
1202 1202
 		$this->pimple['confirmation-page-selector'] = $selector;
1203 1203
 	}
1204 1204
 
@@ -1207,57 +1207,57 @@  discard block
 block discarded – undo
1207 1207
 	}
1208 1208
 
1209 1209
 	public function newDonationFormViolationPresenter(): DonationFormViolationPresenter {
1210
-		return new DonationFormViolationPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1210
+		return new DonationFormViolationPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1211 1211
 	}
1212 1212
 
1213 1213
 	public function newDonationFormPresenter(): DonationFormPresenter {
1214
-		return new DonationFormPresenter( $this->getDonationFormTemplate(), $this->newAmountFormatter() );
1214
+		return new DonationFormPresenter($this->getDonationFormTemplate(), $this->newAmountFormatter());
1215 1215
 	}
1216 1216
 
1217 1217
 	private function getDonationFormTemplate(): TwigTemplate {
1218 1218
 		// TODO make the template name dependent on the 'form' value from the HTTP POST request
1219 1219
 		// (we need different form pages for A/B testing)
1220
-		return $this->getLayoutTemplate( 'Donation_Form.html.twig', [
1220
+		return $this->getLayoutTemplate('Donation_Form.html.twig', [
1221 1221
 			'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForDonation()
1222
-		] );
1222
+		]);
1223 1223
 	}
1224 1224
 
1225 1225
 	public function getMembershipApplicationFormTemplate(): TwigTemplate {
1226
-		return $this->getLayoutTemplate( 'Membership_Application.html.twig', [
1226
+		return $this->getLayoutTemplate('Membership_Application.html.twig', [
1227 1227
 			'paymentTypes' => $this->getPaymentTypesSettings()->getEnabledForMembershipApplication()
1228
-		] );
1228
+		]);
1229 1229
 	}
1230 1230
 
1231
-	public function newHandleSofortPaymentNotificationUseCase( string $updateToken ): SofortPaymentNotificationUseCase {
1231
+	public function newHandleSofortPaymentNotificationUseCase(string $updateToken): SofortPaymentNotificationUseCase {
1232 1232
 		return new SofortPaymentNotificationUseCase(
1233 1233
 			$this->getDonationRepository(),
1234
-			$this->newDonationAuthorizer( $updateToken ),
1234
+			$this->newDonationAuthorizer($updateToken),
1235 1235
 			$this->newDonationConfirmationMailer()
1236 1236
 		);
1237 1237
 	}
1238 1238
 
1239
-	public function newHandlePayPalPaymentCompletionNotificationUseCase( string $updateToken ): HandlePayPalPaymentCompletionNotificationUseCase {
1239
+	public function newHandlePayPalPaymentCompletionNotificationUseCase(string $updateToken): HandlePayPalPaymentCompletionNotificationUseCase {
1240 1240
 		return new HandlePayPalPaymentCompletionNotificationUseCase(
1241 1241
 			$this->getDonationRepository(),
1242
-			$this->newDonationAuthorizer( $updateToken ),
1242
+			$this->newDonationAuthorizer($updateToken),
1243 1243
 			$this->newDonationConfirmationMailer(),
1244 1244
 			$this->newDonationEventLogger()
1245 1245
 		);
1246 1246
 	}
1247 1247
 
1248
-	public function newMembershipApplicationSubscriptionSignupNotificationUseCase( string $updateToken ): HandleSubscriptionSignupNotificationUseCase {
1248
+	public function newMembershipApplicationSubscriptionSignupNotificationUseCase(string $updateToken): HandleSubscriptionSignupNotificationUseCase {
1249 1249
 		return new HandleSubscriptionSignupNotificationUseCase(
1250 1250
 			$this->getMembershipApplicationRepository(),
1251
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1251
+			$this->newMembershipApplicationAuthorizer($updateToken),
1252 1252
 			$this->newApplyForMembershipMailer(),
1253 1253
 			$this->getLogger()
1254 1254
 		);
1255 1255
 	}
1256 1256
 
1257
-	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase( string $updateToken ): HandleSubscriptionPaymentNotificationUseCase {
1257
+	public function newMembershipApplicationSubscriptionPaymentNotificationUseCase(string $updateToken): HandleSubscriptionPaymentNotificationUseCase {
1258 1258
 		return new HandleSubscriptionPaymentNotificationUseCase(
1259 1259
 			$this->getMembershipApplicationRepository(),
1260
-			$this->newMembershipApplicationAuthorizer( $updateToken ),
1260
+			$this->newMembershipApplicationAuthorizer($updateToken),
1261 1261
 			$this->newApplyForMembershipMailer(),
1262 1262
 			$this->getLogger()
1263 1263
 		);
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 		return $this->pimple['paypal-payment-notification-verifier'];
1268 1268
 	}
1269 1269
 
1270
-	public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ): void {
1270
+	public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier): void {
1271 1271
 		$this->pimple['paypal-payment-notification-verifier'] = $verifier;
1272 1272
 	}
1273 1273
 
@@ -1275,14 +1275,14 @@  discard block
 block discarded – undo
1275 1275
 		return $this->pimple['paypal-membership-fee-notification-verifier'];
1276 1276
 	}
1277 1277
 
1278
-	public function setPayPalMembershipFeeNotificationVerifier( PaymentNotificationVerifier $verifier ): void {
1278
+	public function setPayPalMembershipFeeNotificationVerifier(PaymentNotificationVerifier $verifier): void {
1279 1279
 		$this->pimple['paypal-membership-fee-notification-verifier'] = $verifier;
1280 1280
 	}
1281 1281
 
1282
-	public function newCreditCardNotificationUseCase( string $updateToken ): CreditCardNotificationUseCase {
1282
+	public function newCreditCardNotificationUseCase(string $updateToken): CreditCardNotificationUseCase {
1283 1283
 		return new CreditCardNotificationUseCase(
1284 1284
 			$this->getDonationRepository(),
1285
-			$this->newDonationAuthorizer( $updateToken ),
1285
+			$this->newDonationAuthorizer($updateToken),
1286 1286
 			$this->getCreditCardService(),
1287 1287
 			$this->newDonationConfirmationMailer(),
1288 1288
 			$this->getLogger(),
@@ -1292,13 +1292,13 @@  discard block
 block discarded – undo
1292 1292
 
1293 1293
 	public function newCancelMembershipApplicationHtmlPresenter(): CancelMembershipApplicationHtmlPresenter {
1294 1294
 		return new CancelMembershipApplicationHtmlPresenter(
1295
-			$this->getLayoutTemplate( 'Membership_Application_Cancellation_Confirmation.html.twig' )
1295
+			$this->getLayoutTemplate('Membership_Application_Cancellation_Confirmation.html.twig')
1296 1296
 		);
1297 1297
 	}
1298 1298
 
1299 1299
 	public function newMembershipApplicationConfirmationHtmlPresenter(): MembershipApplicationConfirmationHtmlPresenter {
1300 1300
 		return new MembershipApplicationConfirmationHtmlPresenter(
1301
-			$this->getLayoutTemplate( 'Membership_Application_Confirmation.html.twig' )
1301
+			$this->getLayoutTemplate('Membership_Application_Confirmation.html.twig')
1302 1302
 		);
1303 1303
 	}
1304 1304
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 		);
1309 1309
 	}
1310 1310
 
1311
-	public function setCreditCardService( CreditCardService $ccService ): void {
1311
+	public function setCreditCardService(CreditCardService $ccService): void {
1312 1312
 		$this->pimple['credit-card-api-service'] = $ccService;
1313 1313
 	}
1314 1314
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 			new TwigTemplate(
1322 1322
 				$this->getSkinTwig(),
1323 1323
 				'Credit_Card_Payment_Notification.txt.twig',
1324
-				[ 'returnUrl' => $this->config['creditcard']['return-url'] ]
1324
+				['returnUrl' => $this->config['creditcard']['return-url']]
1325 1325
 			)
1326 1326
 		);
1327 1327
 	}
@@ -1340,11 +1340,11 @@  discard block
 block discarded – undo
1340 1340
 		);
1341 1341
 	}
1342 1342
 
1343
-	public function setDonationTokenGenerator( TokenGenerator $tokenGenerator ): void {
1343
+	public function setDonationTokenGenerator(TokenGenerator $tokenGenerator): void {
1344 1344
 		$this->pimple['donation_token_generator'] = $tokenGenerator;
1345 1345
 	}
1346 1346
 
1347
-	public function setMembershipTokenGenerator( MembershipTokenGenerator $tokenGenerator ): void {
1347
+	public function setMembershipTokenGenerator(MembershipTokenGenerator $tokenGenerator): void {
1348 1348
 		$this->pimple['membership_token_generator'] = $tokenGenerator;
1349 1349
 	}
1350 1350
 
@@ -1367,23 +1367,23 @@  discard block
 block discarded – undo
1367 1367
 	private function newDonationPolicyValidator(): AddDonationPolicyValidator {
1368 1368
 		return new AddDonationPolicyValidator(
1369 1369
 			$this->newDonationAmountPolicyValidator(),
1370
-			$this->newTextPolicyValidator( 'fields' ),
1370
+			$this->newTextPolicyValidator('fields'),
1371 1371
 			$this->config['email-address-blacklist']
1372 1372
 		);
1373 1373
 	}
1374 1374
 
1375 1375
 	private function newDonationAmountPolicyValidator(): AmountPolicyValidator {
1376 1376
 		// in the future, this might come from the configuration
1377
-		return new AmountPolicyValidator( 1000, 1000 );
1377
+		return new AmountPolicyValidator(1000, 1000);
1378 1378
 	}
1379 1379
 
1380 1380
 	public function getDonationTimeframeLimit(): string {
1381 1381
 		return $this->config['donation-timeframe-limit'];
1382 1382
 	}
1383 1383
 
1384
-	public function newSystemMessageResponse( string $message ): string {
1385
-		return $this->getLayoutTemplate( 'System_Message.html.twig' )
1386
-			->render( [ 'message' => $message ] );
1384
+	public function newSystemMessageResponse(string $message): string {
1385
+		return $this->getLayoutTemplate('System_Message.html.twig')
1386
+			->render(['message' => $message]);
1387 1387
 	}
1388 1388
 
1389 1389
 	public function getMembershipApplicationTimeframeLimit(): string {
@@ -1404,41 +1404,41 @@  discard block
 block discarded – undo
1404 1404
 
1405 1405
 	public function enablePageCache(): void {
1406 1406
 		$this->pimple['page_cache'] = function() {
1407
-			return new FilesystemCache( $this->getCachePath() . '/pages/raw' );
1407
+			return new FilesystemCache($this->getCachePath() . '/pages/raw');
1408 1408
 		};
1409 1409
 
1410 1410
 		$this->pimple['rendered_page_cache'] = function() {
1411
-			return new FilesystemCache( $this->getCachePath() . '/pages/rendered' );
1411
+			return new FilesystemCache($this->getCachePath() . '/pages/rendered');
1412 1412
 		};
1413 1413
 	}
1414 1414
 
1415
-	private function addProfilingDecorator( $objectToDecorate, string $profilingLabel ) {	// @codingStandardsIgnoreLine
1416
-		if ( $this->profiler === null ) {
1415
+	private function addProfilingDecorator($objectToDecorate, string $profilingLabel) {	// @codingStandardsIgnoreLine
1416
+		if ($this->profiler === null) {
1417 1417
 			return $objectToDecorate;
1418 1418
 		}
1419 1419
 
1420
-		$builder = new ProfilingDecoratorBuilder( $this->profiler, $this->getProfilerDataCollector() );
1420
+		$builder = new ProfilingDecoratorBuilder($this->profiler, $this->getProfilerDataCollector());
1421 1421
 
1422
-		return $builder->decorate( $objectToDecorate, $profilingLabel );
1422
+		return $builder->decorate($objectToDecorate, $profilingLabel);
1423 1423
 	}
1424 1424
 
1425
-	public function setProfiler( Stopwatch $profiler ): void {
1425
+	public function setProfiler(Stopwatch $profiler): void {
1426 1426
 		$this->profiler = $profiler;
1427 1427
 	}
1428 1428
 
1429
-	public function setEmailValidator( EmailValidator $validator ): void {
1429
+	public function setEmailValidator(EmailValidator $validator): void {
1430 1430
 		$this->pimple['mail_validator'] = $validator;
1431 1431
 	}
1432 1432
 
1433
-	public function setLogger( LoggerInterface $logger ): void {
1433
+	public function setLogger(LoggerInterface $logger): void {
1434 1434
 		$this->pimple['logger'] = $logger;
1435 1435
 	}
1436 1436
 
1437
-	public function setPaypalLogger( LoggerInterface $logger ): void {
1437
+	public function setPaypalLogger(LoggerInterface $logger): void {
1438 1438
 		$this->pimple['paypal_logger'] = $logger;
1439 1439
 	}
1440 1440
 
1441
-	public function setSofortLogger( LoggerInterface $logger ): void {
1441
+	public function setSofortLogger(LoggerInterface $logger): void {
1442 1442
 		$this->pimple['sofort_logger'] = $logger;
1443 1443
 	}
1444 1444
 
@@ -1447,10 +1447,10 @@  discard block
 block discarded – undo
1447 1447
 	}
1448 1448
 
1449 1449
 	private function newIbanValidator(): KontoCheckIbanValidator {
1450
-		return new KontoCheckIbanValidator( $this->newBankDataConverter(), $this->config['banned-ibans'] );
1450
+		return new KontoCheckIbanValidator($this->newBankDataConverter(), $this->config['banned-ibans']);
1451 1451
 	}
1452 1452
 
1453
-	public function setFilePrefixer( FilePrefixer $prefixer ): void {
1453
+	public function setFilePrefixer(FilePrefixer $prefixer): void {
1454 1454
 		$this->pimple['cachebusting_fileprefixer'] = $prefixer;
1455 1455
 	}
1456 1456
 
@@ -1460,26 +1460,26 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 	private function getFilePrefix(): string {
1462 1462
 		$prefixContentFile = $this->getVarPath() . '/file_prefix.txt';
1463
-		if ( !file_exists( $prefixContentFile ) ) {
1463
+		if (!file_exists($prefixContentFile)) {
1464 1464
 			return '';
1465 1465
 		}
1466
-		return $prefix = preg_replace( '/[^0-9a-f]/', '', file_get_contents( $prefixContentFile ) );
1466
+		return $prefix = preg_replace('/[^0-9a-f]/', '', file_get_contents($prefixContentFile));
1467 1467
 	}
1468 1468
 
1469
-	public function newDonationAcceptedEventHandler( string $updateToken ): DonationAcceptedEventHandler {
1469
+	public function newDonationAcceptedEventHandler(string $updateToken): DonationAcceptedEventHandler {
1470 1470
 		return new DonationAcceptedEventHandler(
1471
-			$this->newDonationAuthorizer( $updateToken ),
1471
+			$this->newDonationAuthorizer($updateToken),
1472 1472
 			$this->getDonationRepository(),
1473 1473
 			$this->newDonationConfirmationMailer()
1474 1474
 		);
1475 1475
 	}
1476 1476
 
1477 1477
 	public function newPageNotFoundHtmlPresenter(): PageNotFoundPresenter {
1478
-		return new PageNotFoundPresenter( $this->getLayoutTemplate( 'Page_not_found.html.twig' ) );
1478
+		return new PageNotFoundPresenter($this->getLayoutTemplate('Page_not_found.html.twig'));
1479 1479
 	}
1480 1480
 
1481
-	public function setPageViewTracker( PageViewTracker $tracker ): void {
1482
-		$this->pimple['page_view_tracker'] = function () use ( $tracker )  {
1481
+	public function setPageViewTracker(PageViewTracker $tracker): void {
1482
+		$this->pimple['page_view_tracker'] = function() use ($tracker)  {
1483 1483
 			return $tracker;
1484 1484
 		};
1485 1485
 	}
@@ -1492,25 +1492,25 @@  discard block
 block discarded – undo
1492 1492
 		// the "https:" prefix does NOT get any slashes because baseURL is stored in a protocol-agnostic way
1493 1493
 		// (e.g. "//tracking.wikimedia.de" )
1494 1494
 		return new PiwikServerSideTracker(
1495
-			new \PiwikTracker( $this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'] )
1495
+			new \PiwikTracker($this->config['piwik']['siteId'], 'https:' . $this->config['piwik']['baseUrl'])
1496 1496
 		);
1497 1497
 	}
1498 1498
 
1499 1499
 	public function getI18nDirectory(): string {
1500
-		return $this->getAbsolutePath( $this->config['i18n-base-path'] ) . '/' . $this->config['locale'];
1500
+		return $this->getAbsolutePath($this->config['i18n-base-path']) . '/' . $this->config['locale'];
1501 1501
 	}
1502 1502
 
1503 1503
 	/**
1504 1504
 	 * If the pathname does not start with a slash, make the path absolute to root dir of application
1505 1505
 	 */
1506
-	private function getAbsolutePath( string $path ): string {
1507
-		if ( $path[0] === '/' ) {
1506
+	private function getAbsolutePath(string $path): string {
1507
+		if ($path[0] === '/') {
1508 1508
 			return $path;
1509 1509
 		}
1510 1510
 		return __DIR__ . '/../../' . $path;
1511 1511
 	}
1512 1512
 
1513
-	public function setContentPagePageSelector( PageSelector $pageSelector ): void {
1513
+	public function setContentPagePageSelector(PageSelector $pageSelector): void {
1514 1514
 		$this->pimple['content_page_selector'] = $pageSelector;
1515 1515
 	}
1516 1516
 
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 		return $this->pimple['content_page_selector'];
1519 1519
 	}
1520 1520
 
1521
-	public function setContentProvider( ContentProvider $contentProvider ): void {
1521
+	public function setContentProvider(ContentProvider $contentProvider): void {
1522 1522
 		$this->pimple['content_provider'] = $contentProvider;
1523 1523
 	}
1524 1524
 
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 		return $this->pimple['url_generator'];
1537 1537
 	}
1538 1538
 
1539
-	public function setUrlGenerator( UrlGenerator $urlGenerator ): void {
1539
+	public function setUrlGenerator(UrlGenerator $urlGenerator): void {
1540 1540
 		$this->pimple['url_generator'] = $urlGenerator;
1541 1541
 	}
1542 1542
 
@@ -1553,12 +1553,12 @@  discard block
 block discarded – undo
1553 1553
 	}
1554 1554
 
1555 1555
 	public function newDonationAmountConstraint(): ValidatorConstraint {
1556
-		return new RequiredConstraint( [
1557
-			new TypeConstraint( [ 'type' => 'digit' ] ),
1558
-			new RangeConstraint( [
1559
-				'min' => Euro::newFromInt( $this->config['donation-minimum-amount'] )->getEuroCents(),
1560
-				'max' => Euro::newFromInt( $this->config['donation-maximum-amount'] )->getEuroCents()
1561
-			] )
1562
-		] );
1556
+		return new RequiredConstraint([
1557
+			new TypeConstraint(['type' => 'digit']),
1558
+			new RangeConstraint([
1559
+				'min' => Euro::newFromInt($this->config['donation-minimum-amount'])->getEuroCents(),
1560
+				'max' => Euro::newFromInt($this->config['donation-maximum-amount'])->getEuroCents()
1561
+			])
1562
+		]);
1563 1563
 	}
1564 1564
 }
Please login to merge, or discard this patch.
Presentation/Presenters/MembershipApplicationConfirmationHtmlPresenter.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\Presentation\Presenters;
6 6
 
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
 	private $template;
25 25
 
26
-	public function __construct( TwigTemplate $template ) {
26
+	public function __construct(TwigTemplate $template) {
27 27
 		$this->template = $template;
28 28
 	}
29 29
 
30
-	public function present( ShowApplicationConfirmationResponse $response ): string {
30
+	public function present(ShowApplicationConfirmationResponse $response): string {
31 31
 		return $this->template->render(
32 32
 			$this->getConfirmationPageArguments(
33 33
 				$response->getApplication(),
@@ -36,30 +36,30 @@  discard block
 block discarded – undo
36 36
 		);
37 37
 	}
38 38
 
39
-	private function getConfirmationPageArguments( Application $membershipApplication, string $updateToken ): array {
39
+	private function getConfirmationPageArguments(Application $membershipApplication, string $updateToken): array {
40 40
 		return [
41
-			'membershipApplication' => $this->getApplicationArguments( $membershipApplication, $updateToken ),
42
-			'person' => $this->getPersonArguments( $membershipApplication->getApplicant() ),
43
-			'bankData' => $this->getBankDataArguments( $membershipApplication->getPayment()->getPaymentMethod() ),
41
+			'membershipApplication' => $this->getApplicationArguments($membershipApplication, $updateToken),
42
+			'person' => $this->getPersonArguments($membershipApplication->getApplicant()),
43
+			'bankData' => $this->getBankDataArguments($membershipApplication->getPayment()->getPaymentMethod()),
44 44
 			'payPalData' => $this->getPayPalDataArguments(
45 45
 				$membershipApplication->getPayment()->getPaymentMethod()
46 46
 			)
47 47
 		];
48 48
 	}
49 49
 
50
-	private function getApplicationArguments( Application $membershipApplication, string $updateToken ): array {
50
+	private function getApplicationArguments(Application $membershipApplication, string $updateToken): array {
51 51
 		return [
52 52
 			'id' => $membershipApplication->getId(),
53 53
 			'membershipType' => $membershipApplication->getType(),
54 54
 			'paymentType' => $membershipApplication->getPayment()->getPaymentMethod()->getType(),
55
-			'status' => $this->mapStatus( $membershipApplication->isConfirmed() ),
55
+			'status' => $this->mapStatus($membershipApplication->isConfirmed()),
56 56
 			'membershipFee' => $membershipApplication->getPayment()->getAmount()->getEuroString(),
57 57
 			'paymentIntervalInMonths' => $membershipApplication->getPayment()->getIntervalInMonths(),
58 58
 			'updateToken' => $updateToken
59 59
 		];
60 60
 	}
61 61
 
62
-	private function getPersonArguments( Applicant $applicant ): array {
62
+	private function getPersonArguments(Applicant $applicant): array {
63 63
 		return [
64 64
 			'salutation' => $applicant->getName()->getSalutation(),
65 65
 			'title' => $applicant->getName()->getTitle(),
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 		];
72 72
 	}
73 73
 
74
-	private function getBankDataArguments( PaymentMethod $payment ): array {
75
-		if ( $payment instanceof DirectDebitPayment ) {
74
+	private function getBankDataArguments(PaymentMethod $payment): array {
75
+		if ($payment instanceof DirectDebitPayment) {
76 76
 			return [
77 77
 				'iban' => $payment->getBankData()->getIban()->toString(),
78 78
 				'bic' => $payment->getBankData()->getBic(),
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		return [];
84 84
 	}
85 85
 
86
-	private function getPayPalDataArguments( PaymentMethod $payment ): array {
87
-		if ( $payment instanceof PayPalPayment ) {
86
+	private function getPayPalDataArguments(PaymentMethod $payment): array {
87
+		if ($payment instanceof PayPalPayment) {
88 88
 			return [
89
-				'firstPaymentDate' => ( new DateTime( $payment->getPayPalData()->getFirstPaymentDate() ) )->format( 'd.m.Y' )
89
+				'firstPaymentDate' => (new DateTime($payment->getPayPalData()->getFirstPaymentDate()))->format('d.m.Y')
90 90
 			];
91 91
 		}
92 92
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param bool $isConfirmed
100 100
 	 * @return string
101 101
 	 */
102
-	private function mapStatus( bool $isConfirmed ): string {
102
+	private function mapStatus(bool $isConfirmed): string {
103 103
 		return $isConfirmed ? 'status-booked' : 'status-unconfirmed';
104 104
 	}
105 105
 
Please login to merge, or discard this patch.
ShowApplicationConfirmationUseCase.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\MembershipContext\UseCases\ShowMembershipApplicationConfirmation;
6 6
 
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
 	private $repository;
21 21
 	private $tokenFetcher;
22 22
 
23
-	public function __construct( ApplicationAuthorizer $authorizer, ApplicationRepository $repository,
24
-								 ApplicationTokenFetcher $tokenFetcher ) {
23
+	public function __construct(ApplicationAuthorizer $authorizer, ApplicationRepository $repository,
24
+								 ApplicationTokenFetcher $tokenFetcher) {
25 25
 		$this->authorizer = $authorizer;
26 26
 		$this->repository = $repository;
27 27
 		$this->tokenFetcher = $tokenFetcher;
28 28
 	}
29 29
 
30
-	public function showConfirmation( ShowAppConfirmationRequest $request ): ShowApplicationConfirmationResponse {
31
-		if ( !$this->authorizer->canAccessApplication( $request->getApplicationId() ) ) {
30
+	public function showConfirmation(ShowAppConfirmationRequest $request): ShowApplicationConfirmationResponse {
31
+		if (!$this->authorizer->canAccessApplication($request->getApplicationId())) {
32 32
 			return ShowApplicationConfirmationResponse::newNotAllowedResponse();
33 33
 		}
34 34
 
35 35
 		try {
36
-			$application = $this->repository->getApplicationById( $request->getApplicationId() );
36
+			$application = $this->repository->getApplicationById($request->getApplicationId());
37 37
 		}
38
-		catch ( ApplicationPurgedException $ex ) {
38
+		catch (ApplicationPurgedException $ex) {
39 39
 			// TODO: success response without the Application
40 40
 			return ShowApplicationConfirmationResponse::newNotAllowedResponse();
41 41
 		}
42
-		catch ( GetMembershipApplicationException $ex ) {
42
+		catch (GetMembershipApplicationException $ex) {
43 43
 			return ShowApplicationConfirmationResponse::newNotAllowedResponse();
44 44
 		}
45 45
 
46 46
 		return ShowApplicationConfirmationResponse::newValidResponse(
47 47
 			$application, // TODO: use DTO instead of Entity (currently violates the architecture)
48
-			$this->tokenFetcher->getTokens( $request->getApplicationId() )->getUpdateToken()
48
+			$this->tokenFetcher->getTokens($request->getApplicationId())->getUpdateToken()
49 49
 		);
50 50
 	}
51 51
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,12 +34,10 @@
 block discarded – undo
34 34
 
35 35
 		try {
36 36
 			$application = $this->repository->getApplicationById( $request->getApplicationId() );
37
-		}
38
-		catch ( ApplicationPurgedException $ex ) {
37
+		} catch ( ApplicationPurgedException $ex ) {
39 38
 			// TODO: success response without the Application
40 39
 			return ShowApplicationConfirmationResponse::newNotAllowedResponse();
41
-		}
42
-		catch ( GetMembershipApplicationException $ex ) {
40
+		} catch ( GetMembershipApplicationException $ex ) {
43 41
 			return ShowApplicationConfirmationResponse::newNotAllowedResponse();
44 42
 		}
45 43
 
Please login to merge, or discard this patch.
app/routes.php 1 patch
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @var \WMDE\Fundraising\Frontend\Factories\FunFunFactory $ffFactory
8 8
  */
9 9
 
10
-declare( strict_types = 1 );
10
+declare(strict_types = 1);
11 11
 
12 12
 use Silex\Application;
13 13
 use Symfony\Component\HttpFoundation\Request;
@@ -49,96 +49,96 @@  discard block
 block discarded – undo
49 49
 
50 50
 $app->post(
51 51
 	'validate-email',
52
-	function( Request $request ) use ( $app, $ffFactory ) {
53
-		$validationResult = $ffFactory->getEmailValidator()->validate( $request->request->get( 'email', '' ) );
54
-		return $app->json( [ 'status' => $validationResult->isSuccessful() ? 'OK' : 'ERR' ] );
52
+	function(Request $request) use ($app, $ffFactory) {
53
+		$validationResult = $ffFactory->getEmailValidator()->validate($request->request->get('email', ''));
54
+		return $app->json(['status' => $validationResult->isSuccessful() ? 'OK' : 'ERR']);
55 55
 	}
56 56
 );
57 57
 
58 58
 $app->post(
59 59
 	'validate-payment-data',
60
-	function( Request $request ) use ( $app, $ffFactory ) {
60
+	function(Request $request) use ($app, $ffFactory) {
61 61
 
62
-		$amount = (float) $ffFactory->newDecimalNumberFormatter()->parse( $request->get( 'amount', '0' ) );
62
+		$amount = (float)$ffFactory->newDecimalNumberFormatter()->parse($request->get('amount', '0'));
63 63
 		$validator = $ffFactory->newPaymentDataValidator();
64
-		$validationResult = $validator->validate( $amount, (string) $request->get( 'paymentType', '' ) );
64
+		$validationResult = $validator->validate($amount, (string)$request->get('paymentType', ''));
65 65
 
66
-		if ( $validationResult->isSuccessful() ) {
67
-			return $app->json( [ 'status' => 'OK' ] );
66
+		if ($validationResult->isSuccessful()) {
67
+			return $app->json(['status' => 'OK']);
68 68
 		} else {
69 69
 			$errors = [];
70
-			foreach( $validationResult->getViolations() as $violation ) {
71
-				$errors[ $violation->getSource() ] = $ffFactory->getTranslator()->trans( $violation->getMessageIdentifier() );
70
+			foreach ($validationResult->getViolations() as $violation) {
71
+				$errors[$violation->getSource()] = $ffFactory->getTranslator()->trans($violation->getMessageIdentifier());
72 72
 			}
73
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
73
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
74 74
 		}
75 75
 	}
76 76
 );
77 77
 
78 78
 $app->post(
79 79
 	'validate-address', // Validates donor information. This route is named badly.
80
-	function( Request $request ) use ( $app, $ffFactory ) {
81
-		return ( new ValidateDonorHandler( $ffFactory, $app ) )->handle( $request );
80
+	function(Request $request) use ($app, $ffFactory) {
81
+		return (new ValidateDonorHandler($ffFactory, $app))->handle($request);
82 82
 	}
83 83
 );
84 84
 
85 85
 $app->post(
86 86
 	'validate-donation-amount',
87
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
87
+	function(Request $httpRequest) use ($app, $ffFactory) {
88 88
 
89
-		$constraint = new Collection( [
89
+		$constraint = new Collection([
90 90
 			'allowExtraFields' => false,
91 91
 			'fields' => [
92 92
 				'amount' => $ffFactory->newDonationAmountConstraint()
93 93
 			]
94
-		] );
94
+		]);
95 95
 
96
-		$violations = Validation::createValidator()->validate( $httpRequest->request->all(), $constraint );
96
+		$violations = Validation::createValidator()->validate($httpRequest->request->all(), $constraint);
97 97
 
98
-		if ( $violations->count() > 0 ) {
98
+		if ($violations->count() > 0) {
99 99
 			$mapper = new ConstraintViolationListMapper();
100
-			return $app->json( [ 'status' => 'ERR', 'messages' => $mapper->map( $violations ) ] );
100
+			return $app->json(['status' => 'ERR', 'messages' => $mapper->map($violations)]);
101 101
 		}
102 102
 
103
-		return $app->json( [ 'status' => 'OK' ] );
103
+		return $app->json(['status' => 'OK']);
104 104
 	}
105 105
 );
106 106
 
107 107
 $app->post(
108 108
 	'validate-fee',
109
-	function( Request $httpRequest ) use ( $app, $ffFactory ) {
109
+	function(Request $httpRequest) use ($app, $ffFactory) {
110 110
 		$validator = new MembershipFeeValidator();
111 111
 		$result = $validator->validate(
112
-			str_replace( ',', '.', $httpRequest->request->get( 'amount', '' ) ),
113
-			(int) $httpRequest->request->get( 'paymentIntervalInMonths', '0' ),
114
-			$httpRequest->request->get( 'addressType', '' )
112
+			str_replace(',', '.', $httpRequest->request->get('amount', '')),
113
+			(int)$httpRequest->request->get('paymentIntervalInMonths', '0'),
114
+			$httpRequest->request->get('addressType', '')
115 115
 		);
116 116
 
117
-		if ( $result->isSuccessful() ) {
118
-			return $app->json( [ 'status' => 'OK' ] );
117
+		if ($result->isSuccessful()) {
118
+			return $app->json(['status' => 'OK']);
119 119
 		} else {
120 120
 			$errors = $result->getViolations();
121
-			return $app->json( [ 'status' => 'ERR', 'messages' => $errors ] );
121
+			return $app->json(['status' => 'ERR', 'messages' => $errors]);
122 122
 		}
123 123
 	}
124 124
 );
125 125
 
126 126
 $app->get(
127 127
 	'list-comments.json',
128
-	function( Request $request ) use ( $app, $ffFactory ) {
128
+	function(Request $request) use ($app, $ffFactory) {
129 129
 		$response = $app->json(
130 130
 			$ffFactory->newCommentListJsonPresenter()->present(
131 131
 				$ffFactory->newListCommentsUseCase()->listComments(
132 132
 					new CommentListingRequest(
133
-						(int)$request->query->get( 'n', '10' ),
134
-						(int)$request->query->get( 'page', '1' )
133
+						(int)$request->query->get('n', '10'),
134
+						(int)$request->query->get('page', '1')
135 135
 					)
136 136
 				)
137 137
 			)
138 138
 		);
139 139
 
140
-		if ( $request->query->get( 'f' ) ) {
141
-			$response->setCallback( $request->query->get( 'f' ) );
140
+		if ($request->query->get('f')) {
141
+			$response->setCallback($request->query->get('f'));
142 142
 		}
143 143
 
144 144
 		return $response;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 
148 148
 $app->get(
149 149
 	'list-comments.rss',
150
-	function() use ( $app, $ffFactory ) {
150
+	function() use ($app, $ffFactory) {
151 151
 		$rss = $ffFactory->newCommentListRssPresenter()->present(
152 152
 			$ffFactory->newListCommentsUseCase()->listComments(
153
-				new CommentListingRequest( 100, CommentListingRequest::FIRST_PAGE )
153
+				new CommentListingRequest(100, CommentListingRequest::FIRST_PAGE)
154 154
 			)
155 155
 		);
156 156
 
@@ -163,101 +163,101 @@  discard block
 block discarded – undo
163 163
 			]
164 164
 		);
165 165
 	}
166
-)->bind( 'list-comments.rss' );
166
+)->bind('list-comments.rss');
167 167
 
168 168
 $app->get(
169 169
 	'list-comments.html',
170
-	function( Request $request ) use ( $app, $ffFactory ) {
170
+	function(Request $request) use ($app, $ffFactory) {
171 171
 		return new Response(
172 172
 			$ffFactory->newCommentListHtmlPresenter()->present(
173 173
 				$ffFactory->newListCommentsUseCase()->listComments(
174 174
 					new CommentListingRequest(
175 175
 						10,
176
-						(int)$request->query->get( 'page', '1' )
176
+						(int)$request->query->get('page', '1')
177 177
 					)
178 178
 				),
179
-				(int)$request->query->get( 'page', '1' )
179
+				(int)$request->query->get('page', '1')
180 180
 			)
181 181
 		);
182 182
 	}
183
-)->bind( 'list-comments.html' );
183
+)->bind('list-comments.html');
184 184
 
185 185
 $app->get(
186 186
 	'page/{pageName}',
187
-	function( $pageName ) use ( $ffFactory ) {
187
+	function($pageName) use ($ffFactory) {
188 188
 		$pageSelector = $ffFactory->getContentPagePageSelector();
189 189
 
190 190
 		try {
191
-			$pageId = $pageSelector->getPageId( $pageName );
192
-		} catch ( PageNotFoundException $exception ) {
193
-			throw new NotFoundHttpException( "Page page name '$pageName' not found." );
191
+			$pageId = $pageSelector->getPageId($pageName);
192
+		} catch (PageNotFoundException $exception) {
193
+			throw new NotFoundHttpException("Page page name '$pageName' not found.");
194 194
 		}
195 195
 
196 196
 		try {
197
-			return $ffFactory->getLayoutTemplate( 'Display_Page_Layout.twig' )->render( [
197
+			return $ffFactory->getLayoutTemplate('Display_Page_Layout.twig')->render([
198 198
 				'page_id' => $pageId
199
-			] );
200
-		} catch ( Twig_Error_Runtime $exception ) {
199
+			]);
200
+		} catch (Twig_Error_Runtime $exception) {
201 201
 			if ($exception->getPrevious() instanceof ContentNotFoundException) {
202
-				throw new NotFoundHttpException( "Content for page id '$pageId' not found." );
202
+				throw new NotFoundHttpException("Content for page id '$pageId' not found.");
203 203
 			}
204 204
 
205 205
 			throw $exception;
206 206
 		}
207 207
 	}
208 208
 )
209
-->bind( 'page' );
209
+->bind('page');
210 210
 
211 211
 // Form for this is provided by route page/Subscription_Form
212 212
 $app->match(
213 213
 	'contact/subscribe',
214
-	function( Application $app, Request $request ) use ( $ffFactory ) {
215
-		return ( new AddSubscriptionHandler( $ffFactory, $app ) )
216
-			->handle( $request );
214
+	function(Application $app, Request $request) use ($ffFactory) {
215
+		return (new AddSubscriptionHandler($ffFactory, $app))
216
+			->handle($request);
217 217
 	}
218 218
 )
219
-->method( 'GET|POST' )
220
-->bind( 'subscribe' );
219
+->method('GET|POST')
220
+->bind('subscribe');
221 221
 
222
-$app->get( 'contact/confirm-subscription/{confirmationCode}', function ( $confirmationCode ) use ( $ffFactory ) {
222
+$app->get('contact/confirm-subscription/{confirmationCode}', function($confirmationCode) use ($ffFactory) {
223 223
 	$useCase = $ffFactory->newConfirmSubscriptionUseCase();
224
-	$response = $useCase->confirmSubscription( $confirmationCode );
225
-	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present( $response );
224
+	$response = $useCase->confirmSubscription($confirmationCode);
225
+	return $ffFactory->newConfirmSubscriptionHtmlPresenter()->present($response);
226 226
 } )
227
-->assert( 'confirmationCode', '^[0-9a-f]+$' )
228
-->bind( 'confirm-subscription' );
227
+->assert('confirmationCode', '^[0-9a-f]+$')
228
+->bind('confirm-subscription');
229 229
 
230 230
 $app->get(
231 231
 	'check-iban',
232
-	function( Request $request ) use ( $app, $ffFactory ) {
232
+	function(Request $request) use ($app, $ffFactory) {
233 233
 		$useCase = $ffFactory->newCheckIbanUseCase();
234
-		$checkIbanResponse = $useCase->checkIban( new Iban( $request->query->get( 'iban', '' ) ) );
235
-		return $app->json( $ffFactory->newIbanPresenter()->present( $checkIbanResponse ) );
234
+		$checkIbanResponse = $useCase->checkIban(new Iban($request->query->get('iban', '')));
235
+		return $app->json($ffFactory->newIbanPresenter()->present($checkIbanResponse));
236 236
 	}
237 237
 );
238 238
 
239 239
 $app->get(
240 240
 	'generate-iban',
241
-	function( Request $request ) use ( $app, $ffFactory ) {
241
+	function(Request $request) use ($app, $ffFactory) {
242 242
 		$generateIbanRequest = new GenerateIbanRequest(
243
-			$request->query->get( 'accountNumber', '' ),
244
-			$request->query->get( 'bankCode', '' )
243
+			$request->query->get('accountNumber', ''),
244
+			$request->query->get('bankCode', '')
245 245
 		);
246 246
 
247
-		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban( $generateIbanRequest );
248
-		return $app->json( $ffFactory->newIbanPresenter()->present( $generateIbanResponse ) );
247
+		$generateIbanResponse = $ffFactory->newGenerateIbanUseCase()->generateIban($generateIbanRequest);
248
+		return $app->json($ffFactory->newIbanPresenter()->present($generateIbanResponse));
249 249
 	}
250 250
 );
251 251
 
252 252
 $app->post(
253 253
 	'add-comment',
254
-	function( Request $request ) use ( $app, $ffFactory ) {
254
+	function(Request $request) use ($app, $ffFactory) {
255 255
 		$addCommentRequest = new AddCommentRequest();
256
-		$addCommentRequest->setCommentText( trim( $request->request->get( 'comment', '' ) ) );
257
-		$addCommentRequest->setIsPublic( $request->request->get( 'public', '0' ) === '1' );
258
-		$addCommentRequest->setDonationId( (int)$request->request->get( 'donationId', '' ) );
256
+		$addCommentRequest->setCommentText(trim($request->request->get('comment', '')));
257
+		$addCommentRequest->setIsPublic($request->request->get('public', '0') === '1');
258
+		$addCommentRequest->setDonationId((int)$request->request->get('donationId', ''));
259 259
 
260
-		if ( $request->request->get( 'isAnonymous', '0' ) === '1' ) {
260
+		if ($request->request->get('isAnonymous', '0') === '1') {
261 261
 			$addCommentRequest->setIsAnonymous();
262 262
 		}
263 263
 		else {
@@ -266,34 +266,34 @@  discard block
 block discarded – undo
266 266
 
267 267
 		$addCommentRequest->freeze()->assertNoNullFields();
268 268
 
269
-		$updateToken = $request->request->get( 'updateToken', '' );
269
+		$updateToken = $request->request->get('updateToken', '');
270 270
 
271
-		if ( $updateToken === '' ) {
272
-			return $app->json( [
271
+		if ($updateToken === '') {
272
+			return $app->json([
273 273
 				'status' => 'ERR',
274
-				'message' => $ffFactory->getTranslator()->trans( 'comment_failure_access_denied' ),
275
-			] );
274
+				'message' => $ffFactory->getTranslator()->trans('comment_failure_access_denied'),
275
+			]);
276 276
 		}
277 277
 
278
-		$response = $ffFactory->newAddCommentUseCase( $updateToken )->addComment( $addCommentRequest );
278
+		$response = $ffFactory->newAddCommentUseCase($updateToken)->addComment($addCommentRequest);
279 279
 
280
-		if ( $response->isSuccessful() ) {
281
-			return $app->json( [
280
+		if ($response->isSuccessful()) {
281
+			return $app->json([
282 282
 				'status' => 'OK',
283
-				'message' => $ffFactory->getTranslator()->trans( $response->getSuccessMessage() ),
284
-			] );
283
+				'message' => $ffFactory->getTranslator()->trans($response->getSuccessMessage()),
284
+			]);
285 285
 		}
286 286
 
287
-		return $app->json( [
287
+		return $app->json([
288 288
 			'status' => 'ERR',
289
-			'message' => $ffFactory->getTranslator()->trans( $response->getErrorMessage() ),
290
-		] );
289
+			'message' => $ffFactory->getTranslator()->trans($response->getErrorMessage()),
290
+		]);
291 291
 	}
292
-)->bind( 'PostComment' );
292
+)->bind('PostComment');
293 293
 
294 294
 $app->get(
295 295
 	'add-comment',
296
-	function( Request $request ) use ( $app, $ffFactory ) {
296
+	function(Request $request) use ($app, $ffFactory) {
297 297
 		$template = $ffFactory->getLayoutTemplate(
298 298
 			'Donation_Comment.html.twig'
299 299
 		);
@@ -301,61 +301,61 @@  discard block
 block discarded – undo
301 301
 		return new Response(
302 302
 			$template->render(
303 303
 				[
304
-					'donationId' => (int)$request->query->get( 'donationId', '' ),
305
-					'updateToken' => $request->query->get( 'updateToken', '' ),
304
+					'donationId' => (int)$request->query->get('donationId', ''),
305
+					'updateToken' => $request->query->get('updateToken', ''),
306 306
 					'cancelUrl' => $app['url_generator']->generate(
307 307
 						'show-donation-confirmation',
308 308
 						[
309
-							'id' => (int)$request->query->get( 'donationId', '' ),
310
-							'accessToken' => $request->query->get( 'accessToken', '' )
309
+							'id' => (int)$request->query->get('donationId', ''),
310
+							'accessToken' => $request->query->get('accessToken', '')
311 311
 						]
312 312
 					)
313 313
 				]
314 314
 			)
315 315
 		);
316 316
 	}
317
-)->bind( 'AddCommentPage' );
317
+)->bind('AddCommentPage');
318 318
 
319 319
 $app->post(
320 320
 	'contact/get-in-touch',
321
-	function( Request $request ) use ( $app, $ffFactory ) {
321
+	function(Request $request) use ($app, $ffFactory) {
322 322
 		$contactFormRequest = new GetInTouchRequest(
323
-			$request->get( 'firstname', '' ),
324
-			$request->get( 'lastname', '' ),
325
-			$request->get( 'email', '' ),
326
-			$request->get( 'subject', '' ),
327
-			$request->get( 'messageBody', '' )
323
+			$request->get('firstname', ''),
324
+			$request->get('lastname', ''),
325
+			$request->get('email', ''),
326
+			$request->get('subject', ''),
327
+			$request->get('messageBody', '')
328 328
 		);
329 329
 
330
-		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest( $contactFormRequest );
331
-		if ( $contactFormResponse->isSuccessful() ) {
332
-			return $app->redirect( $app['url_generator']->generate( 'page', [ 'pageName' => 'Kontakt_Bestaetigung' ] ) );
330
+		$contactFormResponse = $ffFactory->newGetInTouchUseCase()->processContactRequest($contactFormRequest);
331
+		if ($contactFormResponse->isSuccessful()) {
332
+			return $app->redirect($app['url_generator']->generate('page', ['pageName' => 'Kontakt_Bestaetigung']));
333 333
 		}
334 334
 
335
-		return $ffFactory->newGetInTouchHtmlPresenter()->present( $contactFormResponse, $request->request->all() );
335
+		return $ffFactory->newGetInTouchHtmlPresenter()->present($contactFormResponse, $request->request->all());
336 336
 	}
337 337
 );
338 338
 
339 339
 $app->get(
340 340
 	'contact/get-in-touch',
341
-	function() use ( $app, $ffFactory ) {
342
-		return $ffFactory->getLayoutTemplate( 'contact_form.html.twig' )->render( [ ] );
341
+	function() use ($app, $ffFactory) {
342
+		return $ffFactory->getLayoutTemplate('contact_form.html.twig')->render([]);
343 343
 	}
344 344
 )->bind('contact');
345 345
 
346 346
 $app->post(
347 347
 	'donation/cancel',
348
-	function( Request $request ) use ( $app, $ffFactory ) {
348
+	function(Request $request) use ($app, $ffFactory) {
349 349
 		$cancellationRequest = new CancelDonationRequest(
350
-			(int)$request->request->get( 'sid', '' )
350
+			(int)$request->request->get('sid', '')
351 351
 		);
352 352
 
353
-		$responseModel = $ffFactory->newCancelDonationUseCase( $request->request->get( 'utoken', '' ) )
354
-			->cancelDonation( $cancellationRequest );
353
+		$responseModel = $ffFactory->newCancelDonationUseCase($request->request->get('utoken', ''))
354
+			->cancelDonation($cancellationRequest);
355 355
 
356
-		$httpResponse = new Response( $ffFactory->newCancelDonationHtmlPresenter()->present( $responseModel ) );
357
-		if ( $responseModel->cancellationSucceeded() ) {
358
-			$httpResponse->headers->clearCookie( 'donation_timestamp' );
356
+		$httpResponse = new Response($ffFactory->newCancelDonationHtmlPresenter()->present($responseModel));
357
+		if ($responseModel->cancellationSucceeded()) {
358
+			$httpResponse->headers->clearCookie('donation_timestamp');
359 359
 		}
360 360
 
361 361
 		return $httpResponse;
@@ -364,184 +364,184 @@  discard block
 block discarded – undo
364 364
 
365 365
 $app->post(
366 366
 	'donation/add',
367
-	function( Application $app, Request $request ) use ( $ffFactory ) {
368
-		return ( new AddDonationHandler( $ffFactory, $app ) )
369
-			->handle( $request );
367
+	function(Application $app, Request $request) use ($ffFactory) {
368
+		return (new AddDonationHandler($ffFactory, $app))
369
+			->handle($request);
370 370
 	}
371 371
 );
372 372
 
373 373
 // Show a donation form with pre-filled payment values, e.g. when coming from a banner
374
-$app->get( 'donation/new', function ( Request $request ) use ( $ffFactory ) {
374
+$app->get('donation/new', function(Request $request) use ($ffFactory) {
375 375
 	try {
376
-		$amount = Euro::newFromFloat( ( new AmountParser( 'en_EN' ) )->parseAsFloat(
377
-			$request->get( 'betrag_auswahl', $request->get( 'amountGiven', '' ) ) )
376
+		$amount = Euro::newFromFloat((new AmountParser('en_EN'))->parseAsFloat(
377
+			$request->get('betrag_auswahl', $request->get('amountGiven', '')) )
378 378
 		);
379
-	} catch ( \InvalidArgumentException $ex ) {
380
-		$amount = Euro::newFromCents( 0 );
379
+	} catch (\InvalidArgumentException $ex) {
380
+		$amount = Euro::newFromCents(0);
381 381
 	}
382
-	$validationResult = $ffFactory->newPaymentDataValidator()->validate( $amount, (string) $request->get( 'zahlweise', '' ) );
382
+	$validationResult = $ffFactory->newPaymentDataValidator()->validate($amount, (string)$request->get('zahlweise', ''));
383 383
 
384 384
 	$trackingInfo = new DonationTrackingInfo();
385
-	$trackingInfo->setTotalImpressionCount( intval( $request->get( 'impCount' ) ) );
386
-	$trackingInfo->setSingleBannerImpressionCount( intval( $request->get( 'bImpCount' ) ) );
385
+	$trackingInfo->setTotalImpressionCount(intval($request->get('impCount')));
386
+	$trackingInfo->setSingleBannerImpressionCount(intval($request->get('bImpCount')));
387 387
 
388 388
 	// TODO: don't we want to use newDonationFormViolationPresenter when !$validationResult->isSuccessful()?
389 389
 
390 390
 	return new Response(
391 391
 		$ffFactory->newDonationFormPresenter()->present(
392 392
 			$amount,
393
-			$request->get( 'zahlweise', '' ),
394
-			intval( $request->get( 'periode', 0 ) ),
393
+			$request->get('zahlweise', ''),
394
+			intval($request->get('periode', 0)),
395 395
 			$validationResult->isSuccessful(),
396 396
 			$trackingInfo,
397
-			$request->get( 'addressType', 'person' )
397
+			$request->get('addressType', 'person')
398 398
 		)
399 399
 	);
400
-} )->method( 'POST|GET' );
400
+} )->method('POST|GET');
401 401
 
402 402
 $app->post(
403 403
 	'apply-for-membership',
404
-	function( Application $app, Request $httpRequest ) use ( $ffFactory ) {
405
-		return ( new ApplyForMembershipHandler( $ffFactory, $app ) )->handle( $httpRequest );
404
+	function(Application $app, Request $httpRequest) use ($ffFactory) {
405
+		return (new ApplyForMembershipHandler($ffFactory, $app))->handle($httpRequest);
406 406
 	}
407 407
 );
408 408
 
409 409
 $app->get(
410 410
 	'apply-for-membership',
411
-	function( Request $request ) use ( $ffFactory ) {
411
+	function(Request $request) use ($ffFactory) {
412 412
 		$params = [];
413 413
 
414
-		if ( $request->query->get('type' ) === 'sustaining' ) {
415
-			$params['showMembershipTypeOption'] = false ;
414
+		if ($request->query->get('type') === 'sustaining') {
415
+			$params['showMembershipTypeOption'] = false;
416 416
 		}
417 417
 
418 418
 		try {
419
-			$useCase = $ffFactory->newShowDonationConfirmationUseCase( $request->query->get( 'donationAccessToken', '' ) );
420
-			$responseModel = $useCase->showConfirmation( new ShowDonationConfirmationRequest(
421
-				$request->query->getInt( 'donationId' )
422
-			) );
419
+			$useCase = $ffFactory->newShowDonationConfirmationUseCase($request->query->get('donationAccessToken', ''));
420
+			$responseModel = $useCase->showConfirmation(new ShowDonationConfirmationRequest(
421
+				$request->query->getInt('donationId')
422
+			));
423 423
 
424
-			if ( $responseModel->accessIsPermitted() ) {
424
+			if ($responseModel->accessIsPermitted()) {
425 425
 				$adapter = new DonationMembershipApplicationAdapter();
426
-				$params['initialFormValues'] = $adapter->getInitialMembershipFormValues( $responseModel->getDonation() );
426
+				$params['initialFormValues'] = $adapter->getInitialMembershipFormValues($responseModel->getDonation());
427 427
 			}
428
-		} catch ( Exception $e ) {
428
+		} catch (Exception $e) {
429 429
 		}
430 430
 
431
-		return $ffFactory->getMembershipApplicationFormTemplate()->render( $params );
431
+		return $ffFactory->getMembershipApplicationFormTemplate()->render($params);
432 432
 	}
433 433
 );
434 434
 
435 435
 $app->get(
436 436
 	'show-membership-confirmation',
437
-	function( Request $request ) use ( $ffFactory ) {
438
-		$confirmationRequest = new ShowAppConfirmationRequest( (int)$request->query->get( 'id', 0 ) );
437
+	function(Request $request) use ($ffFactory) {
438
+		$confirmationRequest = new ShowAppConfirmationRequest((int)$request->query->get('id', 0));
439 439
 
440 440
 		return $ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present(
441
-			$ffFactory->newMembershipApplicationConfirmationUseCase( $request->query->get( 'accessToken', '' ) )
442
-				->showConfirmation( $confirmationRequest )
441
+			$ffFactory->newMembershipApplicationConfirmationUseCase($request->query->get('accessToken', ''))
442
+				->showConfirmation($confirmationRequest)
443 443
 		);
444 444
 	}
445
-)->bind( 'show-membership-confirmation' );
445
+)->bind('show-membership-confirmation');
446 446
 
447 447
 $app->get(
448 448
 	'cancel-membership-application',
449
-	function( Request $request ) use ( $ffFactory ) {
449
+	function(Request $request) use ($ffFactory) {
450 450
 		$cancellationRequest = new CancellationRequest(
451
-			(int)$request->query->get( 'id', '' )
451
+			(int)$request->query->get('id', '')
452 452
 		);
453 453
 
454 454
 		return $ffFactory->newCancelMembershipApplicationHtmlPresenter()->present(
455
-			$ffFactory->newCancelMembershipApplicationUseCase( $request->query->get( 'updateToken', '' ) )
456
-				->cancelApplication( $cancellationRequest )
455
+			$ffFactory->newCancelMembershipApplicationUseCase($request->query->get('updateToken', ''))
456
+				->cancelApplication($cancellationRequest)
457 457
 		);
458 458
 	}
459 459
 );
460 460
 
461 461
 $app->match(
462 462
 	'show-donation-confirmation',
463
-	function( Application $app, Request $request ) use ( $ffFactory ) {
464
-		return ( new ShowDonationConfirmationHandler( $ffFactory ) )->handle(
463
+	function(Application $app, Request $request) use ($ffFactory) {
464
+		return (new ShowDonationConfirmationHandler($ffFactory))->handle(
465 465
 			$request,
466
-			$app['session']->get( 'piwikTracking', [] )
466
+			$app['session']->get('piwikTracking', [])
467 467
 		);
468 468
 	}
469
-)->bind( 'show-donation-confirmation' )
470
-->method( 'GET|POST' );
469
+)->bind('show-donation-confirmation')
470
+->method('GET|POST');
471 471
 
472 472
 $app->post(
473 473
 	'handle-paypal-payment-notification',
474
-	function ( Request $request ) use ( $ffFactory ) {
475
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
474
+	function(Request $request) use ($ffFactory) {
475
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
476 476
 	}
477 477
 );
478 478
 
479 479
 $app->post(
480 480
 	'sofort-payment-notification',
481
-	function ( Request $request ) use ( $ffFactory ) {
482
-		return ( new SofortNotificationHandler( $ffFactory ) )->handle( $request );
481
+	function(Request $request) use ($ffFactory) {
482
+		return (new SofortNotificationHandler($ffFactory))->handle($request);
483 483
 	}
484 484
 );
485 485
 
486 486
 $app->get(
487 487
 	'handle-creditcard-payment-notification',
488
-	function ( Request $request ) use ( $ffFactory ) {
488
+	function(Request $request) use ($ffFactory) {
489 489
 		try {
490
-			$ffFactory->newCreditCardNotificationUseCase( $request->query->get( 'utoken', '' ) )
490
+			$ffFactory->newCreditCardNotificationUseCase($request->query->get('utoken', ''))
491 491
 				->handleNotification(
492
-					( new CreditCardPaymentNotificationRequest() )
493
-						->setTransactionId( $request->query->get( 'transactionId', '' ) )
494
-						->setDonationId( (int)$request->query->get( 'donation_id', '' ) )
495
-						->setAmount( Euro::newFromCents( (int)$request->query->get( 'amount' ) ) )
496
-						->setCustomerId( $request->query->get( 'customerId', '' ) )
497
-						->setSessionId( $request->query->get( 'sessionId', '' ) )
498
-						->setAuthId( $request->query->get(  'auth', '' ) )
499
-						->setTitle( $request->query->get( 'title', '' ) )
500
-						->setCountry( $request->query->get( 'country', '' ) )
501
-						->setCurrency( $request->query->get( 'currency', '' ) )
492
+					(new CreditCardPaymentNotificationRequest())
493
+						->setTransactionId($request->query->get('transactionId', ''))
494
+						->setDonationId((int)$request->query->get('donation_id', ''))
495
+						->setAmount(Euro::newFromCents((int)$request->query->get('amount')))
496
+						->setCustomerId($request->query->get('customerId', ''))
497
+						->setSessionId($request->query->get('sessionId', ''))
498
+						->setAuthId($request->query->get('auth', ''))
499
+						->setTitle($request->query->get('title', ''))
500
+						->setCountry($request->query->get('country', ''))
501
+						->setCurrency($request->query->get('currency', ''))
502 502
 				);
503 503
 
504 504
 			$response = CreditCardNotificationResponse::newSuccessResponse(
505
-				(int)$request->query->get( 'donation_id', '' ),
506
-				$request->query->get( 'token', '' )
505
+				(int)$request->query->get('donation_id', ''),
506
+				$request->query->get('token', '')
507 507
  			);
508
-		} catch ( CreditCardPaymentHandlerException $e ) {
509
-			$response = CreditCardNotificationResponse::newFailureResponse( $e->getMessage() );
508
+		} catch (CreditCardPaymentHandlerException $e) {
509
+			$response = CreditCardNotificationResponse::newFailureResponse($e->getMessage());
510 510
 		}
511 511
 
512
-		return new Response( $ffFactory->newCreditCardNotificationPresenter()->present( $response ) );
512
+		return new Response($ffFactory->newCreditCardNotificationPresenter()->present($response));
513 513
 	}
514 514
 );
515 515
 
516 516
 $app->get(
517 517
 	'donation-accepted',
518
-	function( Request $request ) use ( $app, $ffFactory ) {
518
+	function(Request $request) use ($app, $ffFactory) {
519 519
 
520
-		$eventHandler = $ffFactory->newDonationAcceptedEventHandler( $request->query->get( 'update_token', '' ) );
521
-		$result = $eventHandler->onDonationAccepted( (int)$request->query->get( 'donation_id', '' ) );
520
+		$eventHandler = $ffFactory->newDonationAcceptedEventHandler($request->query->get('update_token', ''));
521
+		$result = $eventHandler->onDonationAccepted((int)$request->query->get('donation_id', ''));
522 522
 
523 523
 		return $app->json(
524
-			$result === null ? [ 'status' => 'OK' ] : [ 'status' => 'ERR', 'message' => $result ]
524
+			$result === null ? ['status' => 'OK'] : ['status' => 'ERR', 'message' => $result]
525 525
 		);
526 526
 	}
527 527
 );
528 528
 
529 529
 $app->post(
530 530
 	'handle-paypal-membership-fee-payments',
531
-	function ( Request $request ) use ( $ffFactory ) {
532
-		return ( new PayPalNotificationHandlerForMembershipFee( $ffFactory ) )->handle( $request->request );
531
+	function(Request $request) use ($ffFactory) {
532
+		return (new PayPalNotificationHandlerForMembershipFee($ffFactory))->handle($request->request);
533 533
 	}
534 534
 );
535 535
 
536
-$app->get( '/', function ( Application $app, Request $request ) {
537
-	$app['session']->set( 'piwikTracking', array_filter(
536
+$app->get('/', function(Application $app, Request $request) {
537
+	$app['session']->set('piwikTracking', array_filter(
538 538
 			[
539
-				'paymentType' => $request->get( 'zahlweise', '' ),
540
-				'paymentAmount' => $request->get( 'betrag', '' ),
541
-				'paymentInterval' => $request->get( 'periode', '' )
539
+				'paymentType' => $request->get('zahlweise', ''),
540
+				'paymentAmount' => $request->get('betrag', ''),
541
+				'paymentInterval' => $request->get('periode', '')
542 542
 			],
543
-			function ( string $value ) {
544
-				return $value !== '' && strlen( $value ) < 20;
543
+			function(string $value) {
544
+				return $value !== '' && strlen($value) < 20;
545 545
 			} )
546 546
 	);
547 547
 
@@ -556,43 +556,43 @@  discard block
 block discarded – undo
556 556
 		),
557 557
 		HttpKernelInterface::SUB_REQUEST
558 558
 	);
559
-} )->bind( '/' );
559
+} )->bind('/');
560 560
 
561 561
 // TODO Figure out how to rewrite with Nginx
562 562
 // See https://serverfault.com/questions/805881/nginx-populate-request-uri-with-rewritten-url
563 563
 $app->post(
564 564
 	'/spenden/paypal_handler.php',
565
-	function ( Request $request ) use ( $ffFactory ) {
566
-		return ( new PayPalNotificationHandler( $ffFactory ) )->handle( $request );
565
+	function(Request $request) use ($ffFactory) {
566
+		return (new PayPalNotificationHandler($ffFactory))->handle($request);
567 567
 	}
568 568
 );
569 569
 
570 570
 // redirect display page requests from old URLs
571
-$app->get( '/spenden/{page}', function( Application $app, Request $request, string $page ) {
571
+$app->get('/spenden/{page}', function(Application $app, Request $request, string $page) {
572 572
 	// Poor man's rewrite until someone has figured out how to do this with Nginx without breaking REQUEST_URI
573 573
 	// See https://serverfault.com/questions/805881/nginx-populate-request-uri-with-rewritten-url
574
-	switch ( $page ) {
574
+	switch ($page) {
575 575
 		case 'Mitgliedschaft':
576
-			return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/Membership_Application' );
576
+			return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/Membership_Application');
577 577
 		default:
578
-			return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/page/' . $page );
578
+			return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/page/' . $page);
579 579
 	}
580
-} )->assert( 'page', '[a-zA-Z_\-\s\x7f-\xff]+' );
580
+} )->assert('page', '[a-zA-Z_\-\s\x7f-\xff]+');
581 581
 
582 582
 // redirect different formats of comment lists
583
-$app->get( '/spenden/{outputFormat}.php', function( Application $app, Request $request, string $outputFormat ) {
584
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle(
585
-		'/list-comments.' . ( $outputFormat === 'list' ? 'html' : $outputFormat )
583
+$app->get('/spenden/{outputFormat}.php', function(Application $app, Request $request, string $outputFormat) {
584
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle(
585
+		'/list-comments.' . ($outputFormat === 'list' ? 'html' : $outputFormat)
586 586
 	);
587
-} )->assert( 'outputFormat', 'list|rss|json' );
587
+} )->assert('outputFormat', 'list|rss|json');
588 588
 
589 589
 // redirect all other calls to default route
590
-$app->get( '/spenden{page}', function( Application $app, Request $request ) {
591
-	return ( new RouteRedirectionHandler( $app, $request->getQueryString() ) )->handle( '/' );
592
-} )->assert( 'page', '/?([a-z]+\.php)?' );
590
+$app->get('/spenden{page}', function(Application $app, Request $request) {
591
+	return (new RouteRedirectionHandler($app, $request->getQueryString()))->handle('/');
592
+} )->assert('page', '/?([a-z]+\.php)?');
593 593
 
594
-$app->get( '/purge-cache', function( Request $request ) use ( $ffFactory ) {
595
-	$response = $ffFactory->newAuthorizedCachePurger()->purgeCache( $request->query->get( 'secret', '' ) );
594
+$app->get('/purge-cache', function(Request $request) use ($ffFactory) {
595
+	$response = $ffFactory->newAuthorizedCachePurger()->purgeCache($request->query->get('secret', ''));
596 596
 
597 597
 	return new Response(
598 598
 		[
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 	);
604 604
 } );
605 605
 
606
-$app->get( 'status', function() {
606
+$app->get('status', function() {
607 607
 	return 'Status: OK (Online)';
608 608
 } );
609 609
 
Please login to merge, or discard this patch.
app/RouteHandlers/ShowMembershipConfirmationHandler.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare( strict_types = 1 );
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace WMDE\Fundraising\Frontend\App\RouteHandlers;
6 6
 
@@ -22,33 +22,33 @@  discard block
 block discarded – undo
22 22
 
23 23
 	private $ffFactory;
24 24
 
25
-	public function __construct( FunFunFactory $ffFactory ) {
25
+	public function __construct(FunFunFactory $ffFactory) {
26 26
 		$this->ffFactory = $ffFactory;
27 27
 	}
28 28
 
29
-	public function handle( Request $request ): Response {
30
-		$useCase = $this->ffFactory->newMembershipApplicationConfirmationUseCase( $request->get( 'accessToken', '' ) );
29
+	public function handle(Request $request): Response {
30
+		$useCase = $this->ffFactory->newMembershipApplicationConfirmationUseCase($request->get('accessToken', ''));
31 31
 
32
-		$responseModel = $useCase->showConfirmation( new ShowAppConfirmationRequest(
33
-			(int)$request->get( 'id', '' )
34
-		) );
32
+		$responseModel = $useCase->showConfirmation(new ShowAppConfirmationRequest(
33
+			(int)$request->get('id', '')
34
+		));
35 35
 
36
-		if ( $responseModel->accessIsPermitted() ) {
36
+		if ($responseModel->accessIsPermitted()) {
37 37
 			$httpResponse = new Response(
38
-				$this->ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present( $responseModel )
38
+				$this->ffFactory->newMembershipApplicationConfirmationHtmlPresenter()->present($responseModel)
39 39
 			);
40 40
 
41
-			if ( $request->cookies->get( self::SUBMISSION_COOKIE_NAME ) ) {
41
+			if ($request->cookies->get(self::SUBMISSION_COOKIE_NAME)) {
42 42
 				$cookie = $this->ffFactory->getCookieBuilder();
43 43
 				$httpResponse->headers->setCookie(
44
-					$cookie->newCookie( self::SUBMISSION_COOKIE_NAME, date( self::TIMESTAMP_FORMAT ) )
44
+					$cookie->newCookie(self::SUBMISSION_COOKIE_NAME, date(self::TIMESTAMP_FORMAT))
45 45
 				);
46 46
 			}
47 47
 
48 48
 			return $httpResponse;
49 49
 		}
50 50
 
51
-		throw new AccessDeniedException( 'access_denied_donation_confirmation' );
51
+		throw new AccessDeniedException('access_denied_donation_confirmation');
52 52
 	}
53 53
 
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.