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

Shipped   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 5
Bugs 0 Features 3
Metric Value
wmc 7
c 5
b 0
f 3
lcom 1
cbo 2
dl 0
loc 35
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C validate() 0 28 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
    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->getDeliveryType())) {
18
            $this->errors[] = 'Delivery type can\'t be empty';
19
        }
20
21
        if (empty($transfer->getShippingProvider())) {
22
            $this->errors[] = 'Shipping provider can\'t be empty';
23
        }
24
25
        if (empty($transfer->getTrackingUrl())) {
26
            $this->errors[] = 'Tracking number can\'t be empty';
27
        }
28
29
        if (empty($transfer->getPartnerCode())) {
30
            $this->errors[] = 'Partner code can\'t be empty';
31
        }
32
33
        if (empty($transfer->getVentureOrderNumber())) {
34
            $this->errors[] = 'Venture order number can\'t be empty';
35
        }
36
37
        return empty($this->errors);
38
    }
39
}
40