Completed
Pull Request — master (#2)
by
unknown
08:19
created

FailedDelivery::validate()   B

Complexity

Conditions 6
Paths 32

Size

Total Lines 24
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 3
Metric Value
c 4
b 0
f 3
dl 0
loc 24
rs 8.5126
cc 6
eloc 12
nc 32
nop 1
1
<?php
2
3
namespace Iris\Validator;
4
5
class FailedDelivery extends AbstractValidator
6
{
7
    /**
8
     * {@inheritdoc}
9
     * @param \Iris\Transfer\Tracking\FailedDelivery $transfer
10
     */
11
    protected function validate($transfer)
12
    {
13
        if (empty($transfer->getVentureOrderItemId())) {
14
            $this->errors[] = 'Order item id can\'t be empty';
15
        }
16
17
        if (empty($transfer->getReason())) {
18
            $this->errors[] = 'Reason can\'t be empty';
19
        }
20
21
        if (empty($transfer->getReasonDetail())) {
22
            $this->errors[] = 'Reason detail can\'t be empty';
23
        }
24
25
        if (empty($transfer->getPartnerCode())) {
26
            $this->errors[] = 'Partner code can\'t be empty';
27
        }
28
29
        if (empty($transfer->getVentureOrderNumber())) {
30
            $this->errors[] = 'Venture order number can\'t be empty';
31
        }
32
33
        return empty($this->errors);
34
    }
35
}
36