Passed
Push — master ( fa71d8...fc91e5 )
by Radu
03:01
created

Shipment   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 10
Bugs 0 Features 1
Metric Value
wmc 9
eloc 20
c 10
b 0
f 1
dl 0
loc 55
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getReference() 0 3 1
A getStatus() 0 3 1
A setService() 0 4 1
A getService() 0 3 1
A getScheduledProcessing() 0 3 1
A setScheduledProcessing() 0 4 1
A setStatus() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ParcelValue\Api\JsonApi\ResourceObjects;
6
7
class Shipment extends \WebServCo\Api\JsonApi\AbstractResourceObject
8
{
9
    public const DATE_FORMAT = 'Y-m-d';
10
    public const SERVICE_ECONOMY = 'economy';
11
    public const SERVICE_EXPRESS = 'express';
12
    public const CURRENCY_EUR = 'EUR';
13
    public const TYPE = 'shipment';
14
15
    public function __construct(?string $id = null)
16
    {
17
        parent::__construct(self::TYPE);
18
19
        if (!$id) {
20
            return;
21
        }
22
23
        $this->setId($id);
24
    }
25
26
    public function getReference(): string
27
    {
28
        return (string) $this->getMeta('reference');
29
    }
30
31
    public function getScheduledProcessing(): bool
32
    {
33
        return (bool) $this->getMeta('scheduledProcessing');
34
    }
35
36
    public function getService(): string
37
    {
38
        return (string) $this->getMeta('service');
39
    }
40
41
    public function getStatus(): int
42
    {
43
        return (int) $this->getMeta('status');
44
    }
45
46
    public function setScheduledProcessing(bool $scheduledProcessing): bool
47
    {
48
        $this->setMeta('scheduledProcessing', $scheduledProcessing);
49
        return true;
50
    }
51
52
    public function setService(string $service): bool
53
    {
54
        $this->setMeta('service', $service);
55
        return true;
56
    }
57
58
    public function setStatus(int $status): bool
59
    {
60
        $this->setMeta('status', $status);
61
        return true;
62
    }
63
}
64