Conditions | 7 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function validate($qrBill, Constraint $constraint) |
||
20 | { |
||
21 | if (!$qrBill instanceof QrBill) { |
||
22 | return; |
||
23 | } |
||
24 | |||
25 | $creditorInformation = $qrBill->getCreditorInformation(); |
||
26 | $paymentReference = $qrBill->getPaymentReference(); |
||
27 | |||
28 | if (null === $creditorInformation || null === $paymentReference) { |
||
29 | return; |
||
30 | } |
||
31 | |||
32 | if (null === $creditorInformation->getIban() || null === $paymentReference->getType()) { |
||
1 ignored issue
–
show
|
|||
33 | return; |
||
34 | } |
||
35 | |||
36 | if (self::QR_IBAN_IS_ALLOWED[$paymentReference->getType()] !== $creditorInformation->containsQrIban()) { |
||
37 | $this->context->buildViolation($constraint->message) |
||
38 | ->setParameter('{{ referenceType }}', $paymentReference->getType()) |
||
39 | ->setParameter('{{ iban }}', $creditorInformation->getIban()) |
||
40 | ->addViolation(); |
||
41 | } |
||
43 | } |