@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\Infrastructure; |
| 6 | 6 | |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | class CreditCardExpiryFetchingException extends \RuntimeException { |
| 12 | 12 | |
| 13 | - public function __construct( string $message, \Exception $previous = null ) { |
|
| 14 | - parent::__construct( $message, 0, $previous ); |
|
| 13 | + public function __construct(string $message, \Exception $previous = null) { |
|
| 14 | + parent::__construct($message, 0, $previous); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\Infrastructure; |
| 6 | 6 | |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | private $accessToken; |
| 14 | 14 | private $updateToken; |
| 15 | 15 | |
| 16 | - public function __construct( string $accessToken, string $updateToken ) { |
|
| 17 | - if ( $accessToken === '' ) { |
|
| 18 | - throw new \InvalidArgumentException( 'Access token cannot be empty' ); |
|
| 16 | + public function __construct(string $accessToken, string $updateToken) { |
|
| 17 | + if ($accessToken === '') { |
|
| 18 | + throw new \InvalidArgumentException('Access token cannot be empty'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if ( $updateToken === '' ) { |
|
| 22 | - throw new \InvalidArgumentException( 'Update token cannot be empty' ); |
|
| 21 | + if ($updateToken === '') { |
|
| 22 | + throw new \InvalidArgumentException('Update token cannot be empty'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $this->accessToken = $accessToken; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\Infrastructure; |
| 6 | 6 | |
@@ -16,6 +16,6 @@ discard block |
||
| 16 | 16 | * @return DonationTokens |
| 17 | 17 | * @throws DonationTokenFetchingException |
| 18 | 18 | */ |
| 19 | - public function getTokens( int $donationId ): DonationTokens; |
|
| 19 | + public function getTokens(int $donationId): DonationTokens; |
|
| 20 | 20 | |
| 21 | 21 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\DataAccess; |
| 6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | private $entityManager; |
| 20 | 20 | |
| 21 | - public function __construct( EntityManager $entityManager ) { |
|
| 21 | + public function __construct(EntityManager $entityManager) { |
|
| 22 | 22 | $this->entityManager = $entityManager; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * @return DonationTokens |
| 29 | 29 | * @throws DonationTokenFetchingException |
| 30 | 30 | */ |
| 31 | - public function getTokens( int $donationId ): DonationTokens { |
|
| 32 | - $donation = $this->getDonationById( $donationId ); |
|
| 31 | + public function getTokens(int $donationId): DonationTokens { |
|
| 32 | + $donation = $this->getDonationById($donationId); |
|
| 33 | 33 | |
| 34 | 34 | return new DonationTokens( |
| 35 | 35 | $donation->getDataObject()->getAccessToken(), |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return Donation|null |
| 44 | 44 | */ |
| 45 | - private function getDonationById( int $donationId ) { |
|
| 46 | - return $this->entityManager->find( Donation::class, $donationId ); |
|
| 45 | + private function getDonationById(int $donationId) { |
|
| 46 | + return $this->entityManager->find(Donation::class, $donationId); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\DataAccess; |
| 6 | 6 | |
@@ -24,37 +24,37 @@ discard block |
||
| 24 | 24 | private $updateTokenGenerator; |
| 25 | 25 | private $accessTokenGenerator; |
| 26 | 26 | |
| 27 | - public function __construct( TokenGenerator $updateTokenGenerator, TokenGenerator $accessTokenGenerator ) { |
|
| 27 | + public function __construct(TokenGenerator $updateTokenGenerator, TokenGenerator $accessTokenGenerator) { |
|
| 28 | 28 | $this->updateTokenGenerator = $updateTokenGenerator; |
| 29 | 29 | $this->accessTokenGenerator = $accessTokenGenerator; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function getSubscribedEvents(): array { |
| 33 | - return [ Events::prePersist ]; |
|
| 33 | + return [Events::prePersist]; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function prePersist( LifecycleEventArgs $args ) { |
|
| 36 | + public function prePersist(LifecycleEventArgs $args) { |
|
| 37 | 37 | $entity = $args->getObject(); |
| 38 | 38 | |
| 39 | - if ( $entity instanceof Donation ) { |
|
| 40 | - $entity->modifyDataObject( function ( DonationData $data ) { |
|
| 41 | - if ( $this->isEmpty( $data->getAccessToken() ) ) { |
|
| 42 | - $data->setAccessToken( $this->accessTokenGenerator->generateToken() ); |
|
| 39 | + if ($entity instanceof Donation) { |
|
| 40 | + $entity->modifyDataObject(function(DonationData $data) { |
|
| 41 | + if ($this->isEmpty($data->getAccessToken())) { |
|
| 42 | + $data->setAccessToken($this->accessTokenGenerator->generateToken()); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ( $this->isEmpty( $data->getUpdateToken() ) ) { |
|
| 46 | - $data->setUpdateToken( $this->updateTokenGenerator->generateToken() ); |
|
| 45 | + if ($this->isEmpty($data->getUpdateToken())) { |
|
| 46 | + $data->setUpdateToken($this->updateTokenGenerator->generateToken()); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ( $this->isEmpty( $data->getUpdateTokenExpiry() ) ) { |
|
| 49 | + if ($this->isEmpty($data->getUpdateTokenExpiry())) { |
|
| 50 | 50 | $expiry = $this->updateTokenGenerator->generateTokenExpiry(); |
| 51 | - $data->setUpdateTokenExpiry( $expiry->format( self::DATE_TIME_FORMAT ) ); |
|
| 51 | + $data->setUpdateTokenExpiry($expiry->format(self::DATE_TIME_FORMAT)); |
|
| 52 | 52 | } |
| 53 | 53 | } ); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - private function isEmpty( $stringOrNull ): bool { |
|
| 57 | + private function isEmpty($stringOrNull): bool { |
|
| 58 | 58 | return $stringOrNull === null || $stringOrNull === ''; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\DataAccess; |
| 6 | 6 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | private $updateToken; |
| 20 | 20 | private $accessToken; |
| 21 | 21 | |
| 22 | - public function __construct( EntityManager $entityManager, string $updateToken = null, string $accessToken = null ) { |
|
| 22 | + public function __construct(EntityManager $entityManager, string $updateToken = null, string $accessToken = null) { |
|
| 23 | 23 | $this->entityManager = $entityManager; |
| 24 | 24 | $this->updateToken = $updateToken; |
| 25 | 25 | $this->accessToken = $accessToken; |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | * @param int $donationId |
| 31 | 31 | * @return bool |
| 32 | 32 | */ |
| 33 | - public function userCanModifyDonation( int $donationId ): bool { |
|
| 33 | + public function userCanModifyDonation(int $donationId): bool { |
|
| 34 | 34 | try { |
| 35 | - $donation = $this->getDonationById( $donationId ); |
|
| 35 | + $donation = $this->getDonationById($donationId); |
|
| 36 | 36 | } |
| 37 | - catch ( ORMException $ex ) { |
|
| 37 | + catch (ORMException $ex) { |
|
| 38 | 38 | // TODO: might want to log failure here |
| 39 | 39 | return false; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $donation !== null |
| 43 | - && $this->updateTokenMatches( $donation ) |
|
| 44 | - && $this->tokenHasNotExpired( $donation ); |
|
| 43 | + && $this->updateTokenMatches($donation) |
|
| 44 | + && $this->tokenHasNotExpired($donation); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | * @param int $donationId |
| 50 | 50 | * @return bool |
| 51 | 51 | */ |
| 52 | - public function systemCanModifyDonation( int $donationId ): bool { |
|
| 52 | + public function systemCanModifyDonation(int $donationId): bool { |
|
| 53 | 53 | try { |
| 54 | - $donation = $this->getDonationById( $donationId ); |
|
| 54 | + $donation = $this->getDonationById($donationId); |
|
| 55 | 55 | } |
| 56 | - catch ( ORMException $ex ) { |
|
| 56 | + catch (ORMException $ex) { |
|
| 57 | 57 | // TODO: might want to log failure here |
| 58 | 58 | return false; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | return $donation !== null |
| 62 | - && $this->updateTokenMatches( $donation ); |
|
| 62 | + && $this->updateTokenMatches($donation); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -67,33 +67,33 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return Donation|null |
| 69 | 69 | */ |
| 70 | - private function getDonationById( int $donationId ) { |
|
| 71 | - return $this->entityManager->find( Donation::class, $donationId ); |
|
| 70 | + private function getDonationById(int $donationId) { |
|
| 71 | + return $this->entityManager->find(Donation::class, $donationId); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - private function updateTokenMatches( Donation $donation ): bool { |
|
| 74 | + private function updateTokenMatches(Donation $donation): bool { |
|
| 75 | 75 | return $donation->getDataObject()->getUpdateToken() === $this->updateToken; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - private function tokenHasNotExpired( Donation $donation ): bool { |
|
| 78 | + private function tokenHasNotExpired(Donation $donation): bool { |
|
| 79 | 79 | $expiryTime = $donation->getDataObject()->getUpdateTokenExpiry(); |
| 80 | - return $expiryTime !== null && strtotime( $expiryTime ) >= time(); |
|
| 80 | + return $expiryTime !== null && strtotime($expiryTime) >= time(); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function canAccessDonation( int $donationId ): bool { |
|
| 83 | + public function canAccessDonation(int $donationId): bool { |
|
| 84 | 84 | try { |
| 85 | - $donation = $this->getDonationById( $donationId ); |
|
| 85 | + $donation = $this->getDonationById($donationId); |
|
| 86 | 86 | } |
| 87 | - catch ( ORMException $ex ) { |
|
| 87 | + catch (ORMException $ex) { |
|
| 88 | 88 | // TODO: might want to log failure here |
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $donation !== null |
| 93 | - && $this->accessTokenMatches( $donation ); |
|
| 93 | + && $this->accessTokenMatches($donation); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - private function accessTokenMatches( Donation $donation ): bool { |
|
| 96 | + private function accessTokenMatches(Donation $donation): bool { |
|
| 97 | 97 | return $donation->getDataObject()->getAccessToken() === $this->accessToken; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Fundraising\Frontend\UseCases\AddDonation; |
| 6 | 6 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | private $bankDataConverter; |
| 40 | 40 | private $tokenFetcher; |
| 41 | 41 | |
| 42 | - public function __construct( DonationRepository $donationRepository, DonationValidator $donationValidator, |
|
| 42 | + public function __construct(DonationRepository $donationRepository, DonationValidator $donationValidator, |
|
| 43 | 43 | ReferrerGeneralizer $referrerGeneralizer, DonationConfirmationMailer $mailer, |
| 44 | 44 | TransferCodeGenerator $transferCodeGenerator, BankDataConverter $bankDataConverter, |
| 45 | - DonationTokenFetcher $tokenFetcher ) { |
|
| 45 | + DonationTokenFetcher $tokenFetcher) { |
|
| 46 | 46 | |
| 47 | 47 | $this->donationRepository = $donationRepository; |
| 48 | 48 | $this->donationValidator = $donationValidator; |
@@ -53,28 +53,28 @@ discard block |
||
| 53 | 53 | $this->tokenFetcher = $tokenFetcher; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - public function addDonation( AddDonationRequest $donationRequest ): AddDonationResponse { |
|
| 57 | - $donation = $this->newDonationFromRequest( $donationRequest ); |
|
| 56 | + public function addDonation(AddDonationRequest $donationRequest): AddDonationResponse { |
|
| 57 | + $donation = $this->newDonationFromRequest($donationRequest); |
|
| 58 | 58 | |
| 59 | - $validationResult = $this->donationValidator->validate( $donation ); |
|
| 59 | + $validationResult = $this->donationValidator->validate($donation); |
|
| 60 | 60 | |
| 61 | - if ( $validationResult->hasViolations() ) { |
|
| 62 | - return AddDonationResponse::newFailureResponse( $validationResult->getViolations() ); |
|
| 61 | + if ($validationResult->hasViolations()) { |
|
| 62 | + return AddDonationResponse::newFailureResponse($validationResult->getViolations()); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $needsModeration = $this->donationValidator->needsModeration( $donation ); |
|
| 65 | + $needsModeration = $this->donationValidator->needsModeration($donation); |
|
| 66 | 66 | |
| 67 | - if ( $needsModeration ) { |
|
| 67 | + if ($needsModeration) { |
|
| 68 | 68 | $donation->markForModeration(); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // TODO: handle exceptions |
| 72 | - $this->donationRepository->storeDonation( $donation ); |
|
| 72 | + $this->donationRepository->storeDonation($donation); |
|
| 73 | 73 | |
| 74 | 74 | // TODO: handle exceptions |
| 75 | - $tokens = $this->tokenFetcher->getTokens( $donation->getId() ); |
|
| 75 | + $tokens = $this->tokenFetcher->getTokens($donation->getId()); |
|
| 76 | 76 | |
| 77 | - $this->sendDonationConfirmationEmail( $donation ); |
|
| 77 | + $this->sendDonationConfirmationEmail($donation); |
|
| 78 | 78 | |
| 79 | 79 | return AddDonationResponse::newSuccessResponse( |
| 80 | 80 | $donation, |
@@ -83,93 +83,93 @@ discard block |
||
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - private function newDonationFromRequest( AddDonationRequest $donationRequest ): Donation { |
|
| 86 | + private function newDonationFromRequest(AddDonationRequest $donationRequest): Donation { |
|
| 87 | 87 | return new Donation( |
| 88 | 88 | null, |
| 89 | - $this->getInitialDonationStatus( $donationRequest->getPaymentType() ), |
|
| 89 | + $this->getInitialDonationStatus($donationRequest->getPaymentType()), |
|
| 90 | 90 | $donationRequest->getDonor(), |
| 91 | - $this->getPaymentFromRequest( $donationRequest ), |
|
| 91 | + $this->getPaymentFromRequest($donationRequest), |
|
| 92 | 92 | $donationRequest->getOptIn() === '1', |
| 93 | - $this->newTrackingInfoFromRequest( $donationRequest ) |
|
| 93 | + $this->newTrackingInfoFromRequest($donationRequest) |
|
| 94 | 94 | ); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - private function getInitialDonationStatus( string $paymentType ): string { |
|
| 98 | - if ( $paymentType === PaymentType::DIRECT_DEBIT ) { |
|
| 97 | + private function getInitialDonationStatus(string $paymentType): string { |
|
| 98 | + if ($paymentType === PaymentType::DIRECT_DEBIT) { |
|
| 99 | 99 | return Donation::STATUS_NEW; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if ( $paymentType === PaymentType::BANK_TRANSFER ) { |
|
| 102 | + if ($paymentType === PaymentType::BANK_TRANSFER) { |
|
| 103 | 103 | return Donation::STATUS_PROMISE; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return Donation::STATUS_EXTERNAL_INCOMPLETE; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - private function getPaymentFromRequest( AddDonationRequest $donationRequest ): DonationPayment { |
|
| 109 | + private function getPaymentFromRequest(AddDonationRequest $donationRequest): DonationPayment { |
|
| 110 | 110 | return new DonationPayment( |
| 111 | 111 | $donationRequest->getAmount(), |
| 112 | 112 | $donationRequest->getInterval(), |
| 113 | - $this->getPaymentMethodFromRequest( $donationRequest ) |
|
| 113 | + $this->getPaymentMethodFromRequest($donationRequest) |
|
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - private function getPaymentMethodFromRequest( AddDonationRequest $donationRequest ): PaymentMethod { |
|
| 118 | - if ( $donationRequest->getPaymentType() === PaymentType::BANK_TRANSFER ) { |
|
| 119 | - return new BankTransferPayment( $this->transferCodeGenerator->generateTransferCode() ); |
|
| 117 | + private function getPaymentMethodFromRequest(AddDonationRequest $donationRequest): PaymentMethod { |
|
| 118 | + if ($donationRequest->getPaymentType() === PaymentType::BANK_TRANSFER) { |
|
| 119 | + return new BankTransferPayment($this->transferCodeGenerator->generateTransferCode()); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( $donationRequest->getPaymentType() === PaymentType::DIRECT_DEBIT ) { |
|
| 123 | - return new DirectDebitPayment( $this->newBankDataFromRequest( $donationRequest ) ); |
|
| 122 | + if ($donationRequest->getPaymentType() === PaymentType::DIRECT_DEBIT) { |
|
| 123 | + return new DirectDebitPayment($this->newBankDataFromRequest($donationRequest)); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ( $donationRequest->getPaymentType() === PaymentType::PAYPAL ) { |
|
| 127 | - return new PayPalPayment( new PayPalData() ); |
|
| 126 | + if ($donationRequest->getPaymentType() === PaymentType::PAYPAL) { |
|
| 127 | + return new PayPalPayment(new PayPalData()); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - return new PaymentWithoutAssociatedData( $donationRequest->getPaymentType() ); |
|
| 130 | + return new PaymentWithoutAssociatedData($donationRequest->getPaymentType()); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - private function newBankDataFromRequest( AddDonationRequest $request ): BankData { |
|
| 133 | + private function newBankDataFromRequest(AddDonationRequest $request): BankData { |
|
| 134 | 134 | $bankData = new BankData(); |
| 135 | 135 | |
| 136 | - $bankData->setIban( new Iban( $request->getIban() ) ) |
|
| 137 | - ->setBic( $request->getBic() ) |
|
| 138 | - ->setAccount( $request->getBankAccount() ) |
|
| 139 | - ->setBankCode( $request->getBankCode() ) |
|
| 140 | - ->setBankName( $request->getBankName() ); |
|
| 136 | + $bankData->setIban(new Iban($request->getIban())) |
|
| 137 | + ->setBic($request->getBic()) |
|
| 138 | + ->setAccount($request->getBankAccount()) |
|
| 139 | + ->setBankCode($request->getBankCode()) |
|
| 140 | + ->setBankName($request->getBankName()); |
|
| 141 | 141 | |
| 142 | - if ( $bankData->hasIban() && !$bankData->hasCompleteLegacyBankData() ) { |
|
| 143 | - $bankData = $this->newBankDataFromIban( $bankData->getIban() ); |
|
| 142 | + if ($bankData->hasIban() && !$bankData->hasCompleteLegacyBankData()) { |
|
| 143 | + $bankData = $this->newBankDataFromIban($bankData->getIban()); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - if ( $bankData->hasCompleteLegacyBankData() && !$bankData->hasIban() ) { |
|
| 147 | - $bankData = $this->newBankDataFromAccountAndBankCode( $bankData->getAccount(), $bankData->getBankCode() ); |
|
| 146 | + if ($bankData->hasCompleteLegacyBankData() && !$bankData->hasIban()) { |
|
| 147 | + $bankData = $this->newBankDataFromAccountAndBankCode($bankData->getAccount(), $bankData->getBankCode()); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return $bankData->freeze()->assertNoNullFields(); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - private function newBankDataFromIban( Iban $iban ): BankData { |
|
| 154 | - $bankData = $this->bankDataConverter->getBankDataFromIban( $iban ); |
|
| 153 | + private function newBankDataFromIban(Iban $iban): BankData { |
|
| 154 | + $bankData = $this->bankDataConverter->getBankDataFromIban($iban); |
|
| 155 | 155 | return $bankData->freeze()->assertNoNullFields(); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - private function newBankDataFromAccountAndBankCode( string $account, string $bankCode ): BankData { |
|
| 159 | - $bankData = $this->bankDataConverter->getBankDataFromAccountData( $account, $bankCode ); |
|
| 158 | + private function newBankDataFromAccountAndBankCode(string $account, string $bankCode): BankData { |
|
| 159 | + $bankData = $this->bankDataConverter->getBankDataFromAccountData($account, $bankCode); |
|
| 160 | 160 | return $bankData->freeze()->assertNoNullFields(); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - private function newTrackingInfoFromRequest( AddDonationRequest $request ): DonationTrackingInfo { |
|
| 163 | + private function newTrackingInfoFromRequest(AddDonationRequest $request): DonationTrackingInfo { |
|
| 164 | 164 | $trackingInfo = new DonationTrackingInfo(); |
| 165 | 165 | |
| 166 | - $trackingInfo->setTracking( $request->getTracking() ); |
|
| 167 | - $trackingInfo->setSource( $this->referrerGeneralizer->generalize( $request->getSource() ) ); |
|
| 168 | - $trackingInfo->setTotalImpressionCount( $request->getTotalImpressionCount() ); |
|
| 169 | - $trackingInfo->setSingleBannerImpressionCount( $request->getSingleBannerImpressionCount() ); |
|
| 170 | - $trackingInfo->setColor( $request->getColor() ); |
|
| 171 | - $trackingInfo->setSkin( $request->getSkin() ); |
|
| 172 | - $trackingInfo->setLayout( $request->getLayout() ); |
|
| 166 | + $trackingInfo->setTracking($request->getTracking()); |
|
| 167 | + $trackingInfo->setSource($this->referrerGeneralizer->generalize($request->getSource())); |
|
| 168 | + $trackingInfo->setTotalImpressionCount($request->getTotalImpressionCount()); |
|
| 169 | + $trackingInfo->setSingleBannerImpressionCount($request->getSingleBannerImpressionCount()); |
|
| 170 | + $trackingInfo->setColor($request->getColor()); |
|
| 171 | + $trackingInfo->setSkin($request->getSkin()); |
|
| 172 | + $trackingInfo->setLayout($request->getLayout()); |
|
| 173 | 173 | |
| 174 | 174 | return $trackingInfo->freeze()->assertNoNullFields(); |
| 175 | 175 | } |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | * @throws \RuntimeException |
| 181 | 181 | * TODO: handle exception |
| 182 | 182 | */ |
| 183 | - private function sendDonationConfirmationEmail( Donation $donation ) { |
|
| 184 | - if ( $donation->getDonor() !== null && !$donation->hasExternalPayment() ) { |
|
| 185 | - $this->mailer->sendConfirmationMailFor( $donation ); |
|
| 183 | + private function sendDonationConfirmationEmail(Donation $donation) { |
|
| 184 | + if ($donation->getDonor() !== null && !$donation->hasExternalPayment()) { |
|
| 185 | + $this->mailer->sendConfirmationMailFor($donation); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
| 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 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | private $tokenGenerator; |
| 154 | 154 | private $addDoctrineSubscribers = true; |
| 155 | 155 | |
| 156 | - public function __construct( array $config ) { |
|
| 156 | + public function __construct(array $config) { |
|
| 157 | 157 | $this->config = $config; |
| 158 | 158 | $this->pimple = $this->newPimple(); |
| 159 | 159 | } |
@@ -161,101 +161,101 @@ discard block |
||
| 161 | 161 | private function newPimple(): \Pimple { |
| 162 | 162 | $pimple = new \Pimple(); |
| 163 | 163 | |
| 164 | - $pimple['dbal_connection'] = $pimple->share( function() { |
|
| 165 | - return DriverManager::getConnection( $this->config['db'] ); |
|
| 164 | + $pimple['dbal_connection'] = $pimple->share(function() { |
|
| 165 | + return DriverManager::getConnection($this->config['db']); |
|
| 166 | 166 | } ); |
| 167 | 167 | |
| 168 | - $pimple['entity_manager'] = $pimple->share( function() { |
|
| 169 | - $entityManager = ( new StoreFactory( $this->getConnection() ) )->getEntityManager(); |
|
| 170 | - if ( $this->addDoctrineSubscribers ) { |
|
| 171 | - $entityManager->getEventManager()->addEventSubscriber( $this->newDoctrineDonationPrePersistSubscriber() ); |
|
| 168 | + $pimple['entity_manager'] = $pimple->share(function() { |
|
| 169 | + $entityManager = (new StoreFactory($this->getConnection()))->getEntityManager(); |
|
| 170 | + if ($this->addDoctrineSubscribers) { |
|
| 171 | + $entityManager->getEventManager()->addEventSubscriber($this->newDoctrineDonationPrePersistSubscriber()); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | return $entityManager; |
| 175 | 175 | } ); |
| 176 | 176 | |
| 177 | - $pimple['subscription_repository'] = $pimple->share( function() { |
|
| 177 | + $pimple['subscription_repository'] = $pimple->share(function() { |
|
| 178 | 178 | return new LoggingSubscriptionRepository( |
| 179 | - new DoctrineSubscriptionRepository( $this->getEntityManager() ), |
|
| 179 | + new DoctrineSubscriptionRepository($this->getEntityManager()), |
|
| 180 | 180 | $this->getLogger() |
| 181 | 181 | ); |
| 182 | 182 | } ); |
| 183 | 183 | |
| 184 | - $pimple['donation_repository'] = $pimple->share( function() { |
|
| 184 | + $pimple['donation_repository'] = $pimple->share(function() { |
|
| 185 | 185 | return new LoggingDonationRepository( |
| 186 | - new DoctrineDonationRepository( $this->getEntityManager() ), |
|
| 186 | + new DoctrineDonationRepository($this->getEntityManager()), |
|
| 187 | 187 | $this->getLogger() |
| 188 | 188 | ); |
| 189 | 189 | } ); |
| 190 | 190 | |
| 191 | - $pimple['membership_application_repository'] = $pimple->share( function() { |
|
| 191 | + $pimple['membership_application_repository'] = $pimple->share(function() { |
|
| 192 | 192 | return new LoggingMembershipApplicationRepository( |
| 193 | - new DoctrineMembershipApplicationRepository( $this->getEntityManager() ), |
|
| 193 | + new DoctrineMembershipApplicationRepository($this->getEntityManager()), |
|
| 194 | 194 | $this->getLogger() |
| 195 | 195 | ); |
| 196 | 196 | } ); |
| 197 | 197 | |
| 198 | - $pimple['comment_repository'] = $pimple->share( function() { |
|
| 198 | + $pimple['comment_repository'] = $pimple->share(function() { |
|
| 199 | 199 | return new LoggingCommentFinder( |
| 200 | - new DoctrineCommentFinder( $this->getEntityManager() ), |
|
| 200 | + new DoctrineCommentFinder($this->getEntityManager()), |
|
| 201 | 201 | $this->getLogger() |
| 202 | 202 | ); |
| 203 | 203 | } ); |
| 204 | 204 | |
| 205 | - $pimple['mail_validator'] = $pimple->share( function() { |
|
| 206 | - return new EmailValidator( new InternetDomainNameValidator() ); |
|
| 205 | + $pimple['mail_validator'] = $pimple->share(function() { |
|
| 206 | + return new EmailValidator(new InternetDomainNameValidator()); |
|
| 207 | 207 | } ); |
| 208 | 208 | |
| 209 | - $pimple['subscription_validator'] = $pimple->share( function() { |
|
| 209 | + $pimple['subscription_validator'] = $pimple->share(function() { |
|
| 210 | 210 | return new SubscriptionValidator( |
| 211 | 211 | $this->getEmailValidator(), |
| 212 | - $this->getTextPolicyValidator( 'fields' ), |
|
| 212 | + $this->getTextPolicyValidator('fields'), |
|
| 213 | 213 | $this->newSubscriptionDuplicateValidator(), |
| 214 | 214 | $this->newHonorificValidator() |
| 215 | 215 | ); |
| 216 | 216 | } ); |
| 217 | 217 | |
| 218 | - $pimple['template_name_validator'] = $pimple->share( function() { |
|
| 219 | - return new TemplateNameValidator( $this->getTwig() ); |
|
| 218 | + $pimple['template_name_validator'] = $pimple->share(function() { |
|
| 219 | + return new TemplateNameValidator($this->getTwig()); |
|
| 220 | 220 | } ); |
| 221 | 221 | |
| 222 | - $pimple['contact_validator'] = $pimple->share( function() { |
|
| 223 | - return new GetInTouchValidator( $this->getEmailValidator() ); |
|
| 222 | + $pimple['contact_validator'] = $pimple->share(function() { |
|
| 223 | + return new GetInTouchValidator($this->getEmailValidator()); |
|
| 224 | 224 | } ); |
| 225 | 225 | |
| 226 | - $pimple['greeting_generator'] = $pimple->share( function() { |
|
| 226 | + $pimple['greeting_generator'] = $pimple->share(function() { |
|
| 227 | 227 | return new GreetingGenerator(); |
| 228 | 228 | } ); |
| 229 | 229 | |
| 230 | - $pimple['mw_api'] = $pimple->share( function() { |
|
| 230 | + $pimple['mw_api'] = $pimple->share(function() { |
|
| 231 | 231 | return new MediawikiApi( |
| 232 | 232 | $this->config['cms-wiki-api-url'], |
| 233 | 233 | $this->getGuzzleClient() |
| 234 | 234 | ); |
| 235 | 235 | } ); |
| 236 | 236 | |
| 237 | - $pimple['guzzle_client'] = $pimple->share( function() { |
|
| 237 | + $pimple['guzzle_client'] = $pimple->share(function() { |
|
| 238 | 238 | $middlewareFactory = new MiddlewareFactory(); |
| 239 | - $middlewareFactory->setLogger( $this->getLogger() ); |
|
| 239 | + $middlewareFactory->setLogger($this->getLogger()); |
|
| 240 | 240 | |
| 241 | - $handlerStack = HandlerStack::create( new CurlHandler() ); |
|
| 242 | - $handlerStack->push( $middlewareFactory->retry() ); |
|
| 241 | + $handlerStack = HandlerStack::create(new CurlHandler()); |
|
| 242 | + $handlerStack->push($middlewareFactory->retry()); |
|
| 243 | 243 | |
| 244 | - return new Client( [ |
|
| 244 | + return new Client([ |
|
| 245 | 245 | 'cookies' => true, |
| 246 | 246 | 'handler' => $handlerStack, |
| 247 | - 'headers' => [ 'User-Agent' => 'WMDE Fundraising Frontend' ], |
|
| 248 | - ] ); |
|
| 247 | + 'headers' => ['User-Agent' => 'WMDE Fundraising Frontend'], |
|
| 248 | + ]); |
|
| 249 | 249 | } ); |
| 250 | 250 | |
| 251 | - $pimple['translator'] = $pimple->share( function() { |
|
| 251 | + $pimple['translator'] = $pimple->share(function() { |
|
| 252 | 252 | $translationFactory = new TranslationFactory(); |
| 253 | 253 | $loaders = [ |
| 254 | 254 | 'json' => $translationFactory->newJsonLoader() |
| 255 | 255 | ]; |
| 256 | 256 | $locale = $this->config['locale']; |
| 257 | - $translator = $translationFactory->create( $loaders, $locale ); |
|
| 258 | - $translator->addResource( 'json', __DIR__ . '/../../app/translations/messages.' . $locale . '.json', $locale ); |
|
| 257 | + $translator = $translationFactory->create($loaders, $locale); |
|
| 258 | + $translator->addResource('json', __DIR__ . '/../../app/translations/messages.' . $locale . '.json', $locale); |
|
| 259 | 259 | $translator->addResource( |
| 260 | 260 | 'json', |
| 261 | 261 | __DIR__ . '/../../app/translations/paymentTypes.' . $locale . '.json', |
@@ -268,55 +268,55 @@ discard block |
||
| 268 | 268 | $locale, |
| 269 | 269 | 'paymentIntervals' |
| 270 | 270 | ); |
| 271 | - $translator->addResource( 'json', __DIR__ . '/../../app/translations/validations.' . $locale . '.json', $locale, |
|
| 272 | - 'validations' ); |
|
| 271 | + $translator->addResource('json', __DIR__ . '/../../app/translations/validations.' . $locale . '.json', $locale, |
|
| 272 | + 'validations'); |
|
| 273 | 273 | return $translator; |
| 274 | 274 | } ); |
| 275 | 275 | |
| 276 | 276 | // In the future, this could be locale-specific or filled from a DB table |
| 277 | - $pimple['honorifics'] = $pimple->share( function() { |
|
| 278 | - return new Honorifics( [ |
|
| 277 | + $pimple['honorifics'] = $pimple->share(function() { |
|
| 278 | + return new Honorifics([ |
|
| 279 | 279 | '' => 'Kein Titel', |
| 280 | 280 | 'Dr.' => 'Dr.', |
| 281 | 281 | 'Prof.' => 'Prof.', |
| 282 | 282 | 'Prof. Dr.' => 'Prof. Dr.' |
| 283 | - ] ); |
|
| 283 | + ]); |
|
| 284 | 284 | } ); |
| 285 | 285 | |
| 286 | - $pimple['twig_factory'] = $pimple->share( function () { |
|
| 287 | - return new TwigFactory( $this->config['twig'] ); |
|
| 286 | + $pimple['twig_factory'] = $pimple->share(function() { |
|
| 287 | + return new TwigFactory($this->config['twig']); |
|
| 288 | 288 | } ); |
| 289 | 289 | |
| 290 | - $pimple['twig'] = $pimple->share( function() { |
|
| 290 | + $pimple['twig'] = $pimple->share(function() { |
|
| 291 | 291 | $twigFactory = $this->getTwigFactory(); |
| 292 | - $loaders = array_filter( [ |
|
| 292 | + $loaders = array_filter([ |
|
| 293 | 293 | $twigFactory->newFileSystemLoader(), |
| 294 | 294 | $twigFactory->newArrayLoader(), // This is just a fallback for testing |
| 295 | - $twigFactory->newWikiPageLoader( $this->newWikiContentProvider() ), |
|
| 296 | - ] ); |
|
| 295 | + $twigFactory->newWikiPageLoader($this->newWikiContentProvider()), |
|
| 296 | + ]); |
|
| 297 | 297 | $extensions = [ |
| 298 | - $twigFactory->newTranslationExtension( $this->getTranslator() ), |
|
| 298 | + $twigFactory->newTranslationExtension($this->getTranslator()), |
|
| 299 | 299 | new Twig_Extensions_Extension_Intl() |
| 300 | 300 | ]; |
| 301 | - return $twigFactory->create( $loaders, $extensions ); |
|
| 301 | + return $twigFactory->create($loaders, $extensions); |
|
| 302 | 302 | } ); |
| 303 | 303 | |
| 304 | - $pimple['logger'] = $pimple->share( function() { |
|
| 305 | - $logger = new Logger( 'WMDE Fundraising Frontend logger' ); |
|
| 304 | + $pimple['logger'] = $pimple->share(function() { |
|
| 305 | + $logger = new Logger('WMDE Fundraising Frontend logger'); |
|
| 306 | 306 | |
| 307 | - $streamHandler = new StreamHandler( $this->newLoggerPath( ( new \DateTime() )->format( 'Y-m-d\TH:i:s\Z' ) ) ); |
|
| 308 | - $bufferHandler = new BufferHandler( $streamHandler, 500, Logger::DEBUG, true, true ); |
|
| 309 | - $streamHandler->setFormatter( new LineFormatter( "%message%\n" ) ); |
|
| 310 | - $logger->pushHandler( $bufferHandler ); |
|
| 307 | + $streamHandler = new StreamHandler($this->newLoggerPath((new \DateTime())->format('Y-m-d\TH:i:s\Z'))); |
|
| 308 | + $bufferHandler = new BufferHandler($streamHandler, 500, Logger::DEBUG, true, true); |
|
| 309 | + $streamHandler->setFormatter(new LineFormatter("%message%\n")); |
|
| 310 | + $logger->pushHandler($bufferHandler); |
|
| 311 | 311 | |
| 312 | - $errorHandler = new StreamHandler( $this->newLoggerPath( 'error' ), Logger::ERROR ); |
|
| 313 | - $errorHandler->setFormatter( new JsonFormatter() ); |
|
| 314 | - $logger->pushHandler( $errorHandler ); |
|
| 312 | + $errorHandler = new StreamHandler($this->newLoggerPath('error'), Logger::ERROR); |
|
| 313 | + $errorHandler->setFormatter(new JsonFormatter()); |
|
| 314 | + $logger->pushHandler($errorHandler); |
|
| 315 | 315 | |
| 316 | 316 | return $logger; |
| 317 | 317 | } ); |
| 318 | 318 | |
| 319 | - $pimple['messenger'] = $pimple->share( function() { |
|
| 319 | + $pimple['messenger'] = $pimple->share(function() { |
|
| 320 | 320 | return new Messenger( |
| 321 | 321 | new Swift_MailTransport(), |
| 322 | 322 | $this->getOperatorAddress(), |
@@ -324,11 +324,11 @@ discard block |
||
| 324 | 324 | ); |
| 325 | 325 | } ); |
| 326 | 326 | |
| 327 | - $pimple['confirmation-page-selector'] = $pimple->share( function() { |
|
| 328 | - return new DonationConfirmationPageSelector( $this->config['confirmation-pages'] ); |
|
| 327 | + $pimple['confirmation-page-selector'] = $pimple->share(function() { |
|
| 328 | + return new DonationConfirmationPageSelector($this->config['confirmation-pages']); |
|
| 329 | 329 | } ); |
| 330 | 330 | |
| 331 | - $pimple['paypal-payment-notification-verifier'] = $pimple->share( function() { |
|
| 331 | + $pimple['paypal-payment-notification-verifier'] = $pimple->share(function() { |
|
| 332 | 332 | return new LoggingPaymentNotificationVerifier( |
| 333 | 333 | new PayPalPaymentNotificationVerifier( |
| 334 | 334 | new Client(), |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | ); |
| 339 | 339 | } ); |
| 340 | 340 | |
| 341 | - $pimple['credit-card-api-service'] = $pimple->share( function() { |
|
| 341 | + $pimple['credit-card-api-service'] = $pimple->share(function() { |
|
| 342 | 342 | return new McpCreditCardService( |
| 343 | 343 | new TNvpServiceDispatcher( |
| 344 | 344 | 'IMcpCreditcardService_v1_5', |
@@ -362,17 +362,17 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | private function newDonationEventLogger(): DonationEventLogger { |
| 364 | 364 | return new BestEffortDonationEventLogger( |
| 365 | - new DoctrineDonationEventLogger( $this->getEntityManager() ), |
|
| 365 | + new DoctrineDonationEventLogger($this->getEntityManager()), |
|
| 366 | 366 | $this->getLogger() |
| 367 | 367 | ); |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | public function newInstaller(): Installer { |
| 371 | - return ( new StoreFactory( $this->getConnection() ) )->newInstaller(); |
|
| 371 | + return (new StoreFactory($this->getConnection()))->newInstaller(); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | public function newListCommentsUseCase(): ListCommentsUseCase { |
| 375 | - return new ListCommentsUseCase( $this->getCommentFinder() ); |
|
| 375 | + return new ListCommentsUseCase($this->getCommentFinder()); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | public function newCommentListJsonPresenter(): CommentListJsonPresenter { |
@@ -380,14 +380,14 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | public function newCommentListRssPresenter(): CommentListRssPresenter { |
| 383 | - return new CommentListRssPresenter( new TwigTemplate( |
|
| 383 | + return new CommentListRssPresenter(new TwigTemplate( |
|
| 384 | 384 | $this->getTwig(), |
| 385 | 385 | 'CommentList.rss.twig' |
| 386 | - ) ); |
|
| 386 | + )); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | public function newCommentListHtmlPresenter(): CommentListHtmlPresenter { |
| 390 | - return new CommentListHtmlPresenter( $this->getLayoutTemplate( 'CommentList.html.twig' ) ); |
|
| 390 | + return new CommentListHtmlPresenter($this->getLayoutTemplate('CommentList.html.twig')); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | private function getCommentFinder(): CommentFinder { |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | return $this->pimple['subscription_repository']; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | - public function setSubscriptionRepository( SubscriptionRepository $subscriptionRepository ) { |
|
| 401 | + public function setSubscriptionRepository(SubscriptionRepository $subscriptionRepository) { |
|
| 402 | 402 | $this->pimple['subscription_repository'] = $subscriptionRepository; |
| 403 | 403 | } |
| 404 | 404 | |
@@ -421,26 +421,26 @@ discard block |
||
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | public function newDisplayPagePresenter(): DisplayPagePresenter { |
| 424 | - return new DisplayPagePresenter( $this->getLayoutTemplate( 'DisplayPageLayout.twig' ) ); |
|
| 424 | + return new DisplayPagePresenter($this->getLayoutTemplate('DisplayPageLayout.twig')); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | public function newAddSubscriptionHTMLPresenter(): AddSubscriptionHtmlPresenter { |
| 428 | - return new AddSubscriptionHtmlPresenter( $this->getLayoutTemplate( 'AddSubscription.twig' ), $this->getTranslator() ); |
|
| 428 | + return new AddSubscriptionHtmlPresenter($this->getLayoutTemplate('AddSubscription.twig'), $this->getTranslator()); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | public function newConfirmSubscriptionHtmlPresenter(): ConfirmSubscriptionHtmlPresenter { |
| 432 | 432 | return new ConfirmSubscriptionHtmlPresenter( |
| 433 | - $this->getLayoutTemplate( 'ConfirmSubscription.html.twig' ), |
|
| 433 | + $this->getLayoutTemplate('ConfirmSubscription.html.twig'), |
|
| 434 | 434 | $this->getTranslator() |
| 435 | 435 | ); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | public function newAddSubscriptionJSONPresenter(): AddSubscriptionJsonPresenter { |
| 439 | - return new AddSubscriptionJsonPresenter( $this->getTranslator() ); |
|
| 439 | + return new AddSubscriptionJsonPresenter($this->getTranslator()); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | public function newGetInTouchHTMLPresenter(): GetInTouchHtmlPresenter { |
| 443 | - return new GetInTouchHtmlPresenter( $this->getLayoutTemplate( 'GetInTouch.twig' ), $this->getTranslator() ); |
|
| 443 | + return new GetInTouchHtmlPresenter($this->getLayoutTemplate('GetInTouch.twig'), $this->getTranslator()); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | public function getTwig(): Twig_Environment { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @param string $templateName |
| 454 | 454 | * @return TwigTemplate |
| 455 | 455 | */ |
| 456 | - private function getLayoutTemplate( string $templateName ): TwigTemplate { |
|
| 456 | + private function getLayoutTemplate(string $templateName): TwigTemplate { |
|
| 457 | 457 | return new TwigTemplate( |
| 458 | 458 | $this->getTwig(), |
| 459 | 459 | $templateName, |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | * @param string $templateName Template to include |
| 468 | 468 | * @return TwigTemplate |
| 469 | 469 | */ |
| 470 | - private function getIncludeTemplate( string $templateName ): TwigTemplate { |
|
| 470 | + private function getIncludeTemplate(string $templateName): TwigTemplate { |
|
| 471 | 471 | return new TwigTemplate( |
| 472 | 472 | $this->getTwig(), |
| 473 | 473 | 'IncludeInLayout.twig', |
| 474 | 474 | array_merge( |
| 475 | 475 | $this->getDefaultTwigVariables(), |
| 476 | - [ 'main_template' => $templateName] |
|
| 476 | + ['main_template' => $templateName] |
|
| 477 | 477 | ) |
| 478 | 478 | ); |
| 479 | 479 | } |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | private function newPageRetriever(): PageRetriever { |
| 499 | 499 | return new ApiBasedPageRetriever( |
| 500 | 500 | $this->getMediaWikiApi(), |
| 501 | - new ApiUser( $this->config['cms-wiki-user'], $this->config['cms-wiki-password'] ), |
|
| 501 | + new ApiUser($this->config['cms-wiki-user'], $this->config['cms-wiki-password']), |
|
| 502 | 502 | $this->getLogger() |
| 503 | 503 | ); |
| 504 | 504 | } |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | return $this->pimple['mw_api']; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - public function setMediaWikiApi( MediawikiApi $api ) { |
|
| 510 | + public function setMediaWikiApi(MediawikiApi $api) { |
|
| 511 | 511 | $this->pimple['mw_api'] = $api; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | return $this->pimple['logger']; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - private function newLoggerPath( string $fileName ): string { |
|
| 530 | + private function newLoggerPath(string $fileName): string { |
|
| 531 | 531 | return __DIR__ . '/../../var/log/' . $fileName . '.log'; |
| 532 | 532 | } |
| 533 | 533 | |
@@ -571,20 +571,20 @@ discard block |
||
| 571 | 571 | new TwigTemplate( |
| 572 | 572 | $this->getTwig(), |
| 573 | 573 | 'Mail_Subscription_Confirmation.twig', |
| 574 | - [ 'greeting_generator' => $this->getGreetingGenerator() ] |
|
| 574 | + ['greeting_generator' => $this->getGreetingGenerator()] |
|
| 575 | 575 | ), |
| 576 | 576 | 'mail_subject_membership' |
| 577 | 577 | ); |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - private function newTemplateMailer( TwigTemplate $template, string $messageKey ): TemplateBasedMailer { |
|
| 580 | + private function newTemplateMailer(TwigTemplate $template, string $messageKey): TemplateBasedMailer { |
|
| 581 | 581 | $mailer = new TemplateBasedMailer( |
| 582 | 582 | $this->getMessenger(), |
| 583 | 583 | $template, |
| 584 | - $this->getTranslator()->trans( $messageKey ) |
|
| 584 | + $this->getTranslator()->trans($messageKey) |
|
| 585 | 585 | ); |
| 586 | 586 | |
| 587 | - return new LoggingMailer( $mailer, $this->getLogger() ); |
|
| 587 | + return new LoggingMailer($mailer, $this->getLogger()); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | public function getGreetingGenerator() { |
@@ -592,11 +592,11 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | public function newCheckIbanUseCase(): CheckIbanUseCase { |
| 595 | - return new CheckIbanUseCase( $this->newBankDataConverter() ); |
|
| 595 | + return new CheckIbanUseCase($this->newBankDataConverter()); |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | public function newGenerateIbanUseCase(): GenerateIbanUseCase { |
| 599 | - return new GenerateIbanUseCase( $this->newBankDataConverter() ); |
|
| 599 | + return new GenerateIbanUseCase($this->newBankDataConverter()); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | public function newIbanPresenter(): IbanPresenter { |
@@ -604,14 +604,14 @@ discard block |
||
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | public function newBankDataConverter() { |
| 607 | - return new BankDataConverter( $this->config['bank-data-file'] ); |
|
| 607 | + return new BankDataConverter($this->config['bank-data-file']); |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | - public function setSubscriptionValidator( SubscriptionValidator $subscriptionValidator ) { |
|
| 610 | + public function setSubscriptionValidator(SubscriptionValidator $subscriptionValidator) { |
|
| 611 | 611 | $this->pimple['subscription_validator'] = $subscriptionValidator; |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | - public function setPageTitlePrefix( string $prefix ) { |
|
| 614 | + public function setPageTitlePrefix(string $prefix) { |
|
| 615 | 615 | $this->config['cms-wiki-title-prefix'] = $prefix; |
| 616 | 616 | } |
| 617 | 617 | |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | private function newContactConfirmationMailer(): TemplateBasedMailer { |
| 627 | 627 | return $this->newTemplateMailer( |
| 628 | - new TwigTemplate( $this->getTwig(), 'GetInTouchConfirmation.twig' ), |
|
| 628 | + new TwigTemplate($this->getTwig(), 'GetInTouchConfirmation.twig'), |
|
| 629 | 629 | 'mail_subject_getintouch' |
| 630 | 630 | ); |
| 631 | 631 | } |
@@ -643,12 +643,12 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | private function newSubscriptionDuplicateCutoffDate(): \DateTime { |
| 645 | 645 | $cutoffDateTime = new \DateTime(); |
| 646 | - $cutoffDateTime->sub( new \DateInterval( $this->config['subscription-interval'] ) ); |
|
| 646 | + $cutoffDateTime->sub(new \DateInterval($this->config['subscription-interval'])); |
|
| 647 | 647 | return $cutoffDateTime; |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | private function newHonorificValidator(): AllowedValuesValidator { |
| 651 | - return new AllowedValuesValidator( $this->getHonorifics()->getKeys() ); |
|
| 651 | + return new AllowedValuesValidator($this->getHonorifics()->getKeys()); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | private function getHonorifics(): Honorifics { |
@@ -656,45 +656,45 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | private function newPaymentTypeValidator(): AllowedValuesValidator { |
| 659 | - return new AllowedValuesValidator( PaymentType::getPaymentTypes() ); |
|
| 659 | + return new AllowedValuesValidator(PaymentType::getPaymentTypes()); |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | private function newBankDataValidator(): BankDataValidator { |
| 663 | - return new BankDataValidator( new IbanValidator( $this->newBankDataConverter() ) ); |
|
| 663 | + return new BankDataValidator(new IbanValidator($this->newBankDataConverter())); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | private function getMessenger(): Messenger { |
| 667 | 667 | return $this->pimple['messenger']; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - public function setMessenger( Messenger $messenger ) { |
|
| 670 | + public function setMessenger(Messenger $messenger) { |
|
| 671 | 671 | $this->pimple['messenger'] = $messenger; |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | public function setNullMessenger() { |
| 675 | - $this->setMessenger( new Messenger( |
|
| 675 | + $this->setMessenger(new Messenger( |
|
| 676 | 676 | Swift_NullTransport::newInstance(), |
| 677 | 677 | $this->getOperatorAddress() |
| 678 | - ) ); |
|
| 678 | + )); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | public function getOperatorAddress() { |
| 682 | - return new EmailAddress( $this->config['operator-email'] ); |
|
| 682 | + return new EmailAddress($this->config['operator-email']); |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | public function newInternalErrorHTMLPresenter(): InternalErrorHtmlPresenter { |
| 686 | - return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'Error.twig' ) ); |
|
| 686 | + return new InternalErrorHtmlPresenter($this->getLayoutTemplate('Error.twig')); |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | public function newAccessDeniedHTMLPresenter(): InternalErrorHtmlPresenter { |
| 690 | - return new InternalErrorHtmlPresenter( $this->getLayoutTemplate( 'AccessDenied.twig' ) ); |
|
| 690 | + return new InternalErrorHtmlPresenter($this->getLayoutTemplate('AccessDenied.twig')); |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | public function getTranslator(): TranslatorInterface { |
| 694 | 694 | return $this->pimple['translator']; |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - public function setTranslator( TranslatorInterface $translator ) { |
|
| 697 | + public function setTranslator(TranslatorInterface $translator) { |
|
| 698 | 698 | $this->pimple['translator'] = $translator; |
| 699 | 699 | } |
| 700 | 700 | |
@@ -702,40 +702,40 @@ discard block |
||
| 702 | 702 | return $this->pimple['twig_factory']; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - private function getTextPolicyValidator( $policyName ) { |
|
| 705 | + private function getTextPolicyValidator($policyName) { |
|
| 706 | 706 | $policyValidator = new TextPolicyValidator(); |
| 707 | 707 | |
| 708 | 708 | $contentProvider = $this->newWikiContentProvider(); |
| 709 | 709 | $textPolicyConfig = $this->config['text-policies'][$policyName]; |
| 710 | 710 | |
| 711 | 711 | // TODO: this is not the place to retrieve resources over the network |
| 712 | - $policyValidator->addBadWordsFromArray( $this->loadWordsFromWiki( |
|
| 712 | + $policyValidator->addBadWordsFromArray($this->loadWordsFromWiki( |
|
| 713 | 713 | $contentProvider, |
| 714 | 714 | $textPolicyConfig['badwords'] ?? '' |
| 715 | - ) ); |
|
| 716 | - $policyValidator->addWhiteWordsFromArray( $this->loadWordsFromWiki( |
|
| 715 | + )); |
|
| 716 | + $policyValidator->addWhiteWordsFromArray($this->loadWordsFromWiki( |
|
| 717 | 717 | $contentProvider, |
| 718 | 718 | $textPolicyConfig['whitewords'] ?? '' |
| 719 | - ) ); |
|
| 719 | + )); |
|
| 720 | 720 | |
| 721 | 721 | return $policyValidator; |
| 722 | 722 | } |
| 723 | 723 | |
| 724 | - private function loadWordsFromWiki( WikiContentProvider $contentProvider, string $pageName ): array { |
|
| 725 | - if ( $pageName === '' ) { |
|
| 726 | - return [ ]; |
|
| 724 | + private function loadWordsFromWiki(WikiContentProvider $contentProvider, string $pageName): array { |
|
| 725 | + if ($pageName === '') { |
|
| 726 | + return []; |
|
| 727 | 727 | } |
| 728 | - $content = $contentProvider->getContent( $pageName, 'raw' ); |
|
| 729 | - $words = array_map( 'trim', explode( "\n", $content ) ); |
|
| 728 | + $content = $contentProvider->getContent($pageName, 'raw'); |
|
| 729 | + $words = array_map('trim', explode("\n", $content)); |
|
| 730 | 730 | |
| 731 | - return array_filter( $words ); |
|
| 731 | + return array_filter($words); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - public function newCancelDonationUseCase( string $updateToken ): CancelDonationUseCase { |
|
| 734 | + public function newCancelDonationUseCase(string $updateToken): CancelDonationUseCase { |
|
| 735 | 735 | return new CancelDonationUseCase( |
| 736 | 736 | $this->getDonationRepository(), |
| 737 | 737 | $this->newCancelDonationMailer(), |
| 738 | - $this->newDonationAuthorizer( $updateToken ) |
|
| 738 | + $this->newDonationAuthorizer($updateToken) |
|
| 739 | 739 | ); |
| 740 | 740 | } |
| 741 | 741 | |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | new TwigTemplate( |
| 745 | 745 | $this->getTwig(), |
| 746 | 746 | 'Mail_Donation_Cancellation_Confirmation.twig', |
| 747 | - [ 'greeting_generator' => $this->getGreetingGenerator() ] |
|
| 747 | + ['greeting_generator' => $this->getGreetingGenerator()] |
|
| 748 | 748 | ), |
| 749 | 749 | 'mail_subject_confirm_cancellation' |
| 750 | 750 | ); |
@@ -772,9 +772,9 @@ discard block |
||
| 772 | 772 | private function newDonationValidator(): DonationValidator { |
| 773 | 773 | return new DonationValidator( |
| 774 | 774 | $this->newAmountValidator(), |
| 775 | - new AmountPolicyValidator( 1000, 200, 300 ), |
|
| 775 | + new AmountPolicyValidator(1000, 200, 300), |
|
| 776 | 776 | $this->newPersonalInfoValidator(), |
| 777 | - $this->getTextPolicyValidator( 'fields' ), |
|
| 777 | + $this->getTextPolicyValidator('fields'), |
|
| 778 | 778 | $this->newPaymentTypeValidator(), |
| 779 | 779 | $this->newBankDataValidator() |
| 780 | 780 | ); |
@@ -804,19 +804,19 @@ discard block |
||
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | public function newPayPalUrlGenerator() { |
| 807 | - return new PayPalUrlGenerator( $this->getPayPalUrlConfig() ); |
|
| 807 | + return new PayPalUrlGenerator($this->getPayPalUrlConfig()); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | private function getPayPalUrlConfig() { |
| 811 | - return PayPalUrlConfig::newFromConfig( $this->config['paypal'] ); |
|
| 811 | + return PayPalUrlConfig::newFromConfig($this->config['paypal']); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | private function newCreditCardUrlGenerator() { |
| 815 | - return new CreditCardUrlGenerator( $this->newCreditCardUrlConfig() ); |
|
| 815 | + return new CreditCardUrlGenerator($this->newCreditCardUrlConfig()); |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | private function newCreditCardUrlConfig() { |
| 819 | - return CreditCardUrlConfig::newFromConfig( $this->config['creditcard'] ); |
|
| 819 | + return CreditCardUrlConfig::newFromConfig($this->config['creditcard']); |
|
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | public function getDonationRepository(): DonationRepository { |
@@ -834,22 +834,22 @@ discard block |
||
| 834 | 834 | } |
| 835 | 835 | |
| 836 | 836 | private function newAmountFormatter(): AmountFormatter { |
| 837 | - return new AmountFormatter( $this->config['locale'] ); |
|
| 837 | + return new AmountFormatter($this->config['locale']); |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | public function newDecimalNumberFormatter(): NumberFormatter { |
| 841 | - return new NumberFormatter( $this->config['locale'], NumberFormatter::DECIMAL ); |
|
| 841 | + return new NumberFormatter($this->config['locale'], NumberFormatter::DECIMAL); |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | - public function newAddCommentUseCase( string $updateToken ): AddCommentUseCase { |
|
| 844 | + public function newAddCommentUseCase(string $updateToken): AddCommentUseCase { |
|
| 845 | 845 | return new AddCommentUseCase( |
| 846 | 846 | $this->getDonationRepository(), |
| 847 | - $this->newDonationAuthorizer( $updateToken ), |
|
| 848 | - $this->getTextPolicyValidator( 'comment' ) |
|
| 847 | + $this->newDonationAuthorizer($updateToken), |
|
| 848 | + $this->getTextPolicyValidator('comment') |
|
| 849 | 849 | ); |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - private function newDonationAuthorizer( string $updateToken = null, string $accessToken = null ): DonationAuthorizer { |
|
| 852 | + private function newDonationAuthorizer(string $updateToken = null, string $accessToken = null): DonationAuthorizer { |
|
| 853 | 853 | return new DoctrineDonationAuthorizer( |
| 854 | 854 | $this->getEntityManager(), |
| 855 | 855 | $updateToken, |
@@ -858,10 +858,10 @@ discard block |
||
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | public function getTokenGenerator(): TokenGenerator { |
| 861 | - if ( $this->tokenGenerator === null ) { |
|
| 861 | + if ($this->tokenGenerator === null) { |
|
| 862 | 862 | $this->tokenGenerator = new RandomTokenGenerator( |
| 863 | 863 | $this->config['token-length'], |
| 864 | - new \DateInterval( $this->config['token-validity-timestamp'] ) |
|
| 864 | + new \DateInterval($this->config['token-validity-timestamp']) |
|
| 865 | 865 | ); |
| 866 | 866 | } |
| 867 | 867 | |
@@ -870,13 +870,13 @@ discard block |
||
| 870 | 870 | |
| 871 | 871 | public function newDonationConfirmationPresenter() { |
| 872 | 872 | return new DonationConfirmationHtmlPresenter( |
| 873 | - $this->getLayoutTemplate( 'DonationConfirmation.twig' ) |
|
| 873 | + $this->getLayoutTemplate('DonationConfirmation.twig') |
|
| 874 | 874 | ); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | public function newCreditCardPaymentHtmlPresenter() { |
| 878 | 878 | return new CreditCardPaymentHtmlPresenter( |
| 879 | - $this->getIncludeTemplate( 'CreditCardPayment.html.twig' ), |
|
| 879 | + $this->getIncludeTemplate('CreditCardPayment.html.twig'), |
|
| 880 | 880 | $this->getTranslator(), |
| 881 | 881 | $this->newCreditCardUrlGenerator() |
| 882 | 882 | ); |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | public function newCancelDonationHtmlPresenter() { |
| 886 | 886 | return new CancelDonationHtmlPresenter( |
| 887 | - $this->getIncludeTemplate( 'Donation_Cancellation_Confirmation.twig' ) |
|
| 887 | + $this->getIncludeTemplate('Donation_Cancellation_Confirmation.twig') |
|
| 888 | 888 | ); |
| 889 | 889 | } |
| 890 | 890 | |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | new TwigTemplate( |
| 905 | 905 | $this->getTwig(), |
| 906 | 906 | 'Mail_Membership_Application_Confirmation.twig', |
| 907 | - [ 'greeting_generator' => $this->getGreetingGenerator() ] |
|
| 907 | + ['greeting_generator' => $this->getGreetingGenerator()] |
|
| 908 | 908 | ), |
| 909 | 909 | 'mail_subject_confirm_membership_application' |
| 910 | 910 | ); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | } |
| 920 | 920 | |
| 921 | 921 | private function newMembershipApplicationTracker(): MembershipApplicationTracker { |
| 922 | - return new DoctrineMembershipApplicationTracker( $this->getEntityManager() ); |
|
| 922 | + return new DoctrineMembershipApplicationTracker($this->getEntityManager()); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | private function newMembershipAuthUpdater(): MembershipAppAuthUpdater { |
@@ -928,9 +928,9 @@ discard block |
||
| 928 | 928 | ); |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - public function newCancelMembershipApplicationUseCase( string $updateToken ): CancelMembershipApplicationUseCase { |
|
| 931 | + public function newCancelMembershipApplicationUseCase(string $updateToken): CancelMembershipApplicationUseCase { |
|
| 932 | 932 | return new CancelMembershipApplicationUseCase( |
| 933 | - $this->newMembershipApplicationAuthorizer( $updateToken ), |
|
| 933 | + $this->newMembershipApplicationAuthorizer($updateToken), |
|
| 934 | 934 | $this->getMembershipApplicationRepository(), |
| 935 | 935 | $this->newCancelMembershipApplicationMailer() |
| 936 | 936 | ); |
@@ -955,20 +955,20 @@ discard block |
||
| 955 | 955 | new TwigTemplate( |
| 956 | 956 | $this->getTwig(), |
| 957 | 957 | 'Mail_Membership_Application_Cancellation_Confirmation.twig', |
| 958 | - [ 'greeting_generator' => $this->getGreetingGenerator() ] |
|
| 958 | + ['greeting_generator' => $this->getGreetingGenerator()] |
|
| 959 | 959 | ), |
| 960 | 960 | 'mail_subject_confirm_membership_application_cancellation' |
| 961 | 961 | ); |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | - public function newShowDonationConfirmationUseCase( string $accessToken ): ShowDonationConfirmationUseCase { |
|
| 964 | + public function newShowDonationConfirmationUseCase(string $accessToken): ShowDonationConfirmationUseCase { |
|
| 965 | 965 | return new ShowDonationConfirmationUseCase( |
| 966 | - $this->newDonationAuthorizer( null, $accessToken ), |
|
| 966 | + $this->newDonationAuthorizer(null, $accessToken), |
|
| 967 | 967 | $this->getDonationRepository() |
| 968 | 968 | ); |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - public function setDonationConfirmationPageSelector( DonationConfirmationPageSelector $selector ) { |
|
| 971 | + public function setDonationConfirmationPageSelector(DonationConfirmationPageSelector $selector) { |
|
| 972 | 972 | $this->pimple['confirmation-page-selector'] = $selector; |
| 973 | 973 | } |
| 974 | 974 | |
@@ -977,17 +977,17 @@ discard block |
||
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | public function newDonationFormViolationPresenter() { |
| 980 | - $template = $this->getLayoutTemplate( 'DisplayPageLayout.twig' ); |
|
| 980 | + $template = $this->getLayoutTemplate('DisplayPageLayout.twig'); |
|
| 981 | 981 | // TODO make this dependent on the 'form' value from the HTTP POST request |
| 982 | 982 | // (we need different form pages for A/B testing) |
| 983 | 983 | $template->context['main_template'] = 'DonationForm.html.twig'; |
| 984 | - return new DonationFormViolationPresenter( $template, $this->newAmountFormatter() ); |
|
| 984 | + return new DonationFormViolationPresenter($template, $this->newAmountFormatter()); |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | - public function newHandlePayPalPaymentNotificationUseCase( string $updateToken ) { |
|
| 987 | + public function newHandlePayPalPaymentNotificationUseCase(string $updateToken) { |
|
| 988 | 988 | return new HandlePayPalPaymentNotificationUseCase( |
| 989 | 989 | $this->getDonationRepository(), |
| 990 | - $this->newDonationAuthorizer( $updateToken ), |
|
| 990 | + $this->newDonationAuthorizer($updateToken), |
|
| 991 | 991 | $this->newDonationConfirmationMailer(), |
| 992 | 992 | $this->getLogger(), |
| 993 | 993 | $this->newDonationEventLogger() |
@@ -998,14 +998,14 @@ discard block |
||
| 998 | 998 | return $this->pimple['paypal-payment-notification-verifier']; |
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | - public function setPayPalPaymentNotificationVerifier( PaymentNotificationVerifier $verifier ) { |
|
| 1001 | + public function setPayPalPaymentNotificationVerifier(PaymentNotificationVerifier $verifier) { |
|
| 1002 | 1002 | $this->pimple['paypal-payment-notification-verifier'] = $verifier; |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | - public function newCreditCardNotificationUseCase( string $updateToken ) { |
|
| 1005 | + public function newCreditCardNotificationUseCase(string $updateToken) { |
|
| 1006 | 1006 | return new CreditCardNotificationUseCase( |
| 1007 | 1007 | $this->getDonationRepository(), |
| 1008 | - $this->newDonationAuthorizer( $updateToken ), |
|
| 1008 | + $this->newDonationAuthorizer($updateToken), |
|
| 1009 | 1009 | $this->getCreditCardService(), |
| 1010 | 1010 | $this->newDonationConfirmationMailer(), |
| 1011 | 1011 | $this->getLogger(), |
@@ -1015,23 +1015,23 @@ discard block |
||
| 1015 | 1015 | |
| 1016 | 1016 | public function newCancelMembershipApplicationHtmlPresenter() { |
| 1017 | 1017 | return new CancelMembershipApplicationHtmlPresenter( |
| 1018 | - $this->getIncludeTemplate( 'Membership_Application_Cancellation_Confirmation.twig' ) |
|
| 1018 | + $this->getIncludeTemplate('Membership_Application_Cancellation_Confirmation.twig') |
|
| 1019 | 1019 | ); |
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | public function newMembershipApplicationConfirmationHtmlPresenter() { |
| 1023 | 1023 | return new MembershipApplicationConfirmationHtmlPresenter( |
| 1024 | - $this->getIncludeTemplate( 'MembershipApplicationConfirmation.html.twig' ) |
|
| 1024 | + $this->getIncludeTemplate('MembershipApplicationConfirmation.html.twig') |
|
| 1025 | 1025 | ); |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | public function newMembershipFormViolationPresenter() { |
| 1029 | 1029 | return new MembershipFormViolationPresenter( |
| 1030 | - $this->getIncludeTemplate( 'MembershipApplication.html.twig' ) |
|
| 1030 | + $this->getIncludeTemplate('MembershipApplication.html.twig') |
|
| 1031 | 1031 | ); |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | - public function setCreditCardService( CreditCardService $ccService ) { |
|
| 1034 | + public function setCreditCardService(CreditCardService $ccService) { |
|
| 1035 | 1035 | $this->pimple['credit-card-api-service'] = $ccService; |
| 1036 | 1036 | } |
| 1037 | 1037 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | new TwigTemplate( |
| 1045 | 1045 | $this->getTwig(), |
| 1046 | 1046 | 'CreditCardPaymentNotification.twig', |
| 1047 | - [ 'returnUrl' => $this->config['creditcard']['return-url'] ] |
|
| 1047 | + ['returnUrl' => $this->config['creditcard']['return-url']] |
|
| 1048 | 1048 | ) |
| 1049 | 1049 | ); |
| 1050 | 1050 | } |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | ); |
| 1058 | 1058 | } |
| 1059 | 1059 | |
| 1060 | - public function setTokenGenerator( TokenGenerator $tokenGenerator ) { |
|
| 1060 | + public function setTokenGenerator(TokenGenerator $tokenGenerator) { |
|
| 1061 | 1061 | $this->tokenGenerator = $tokenGenerator; |
| 1062 | 1062 | } |
| 1063 | 1063 | |