Completed
Pull Request — master (#2)
by
unknown
06:17 queued 03:34
created

Shipped::validate()   C

Complexity

Conditions 7
Paths 64

Size

Total Lines 28
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 20
CRAP Score 7

Importance

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