Passed
Push — master ( 2580ba...f9be08 )
by Tomáš
14:54
created

CommonData::setReturnBarcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\Balikobot\Model\PackageData\Package;
6
7
use Inspirum\Balikobot\Definitions\Attribute;
8
use function implode;
9
10
trait CommonData
11
{
12 25
    public function setEID(string $id): void
13
    {
14 25
        $this->offsetSet(Attribute::EID, $id);
0 ignored issues
show
Bug introduced by
It seems like offsetSet() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
        $this->/** @scrutinizer ignore-call */ 
15
               offsetSet(Attribute::EID, $id);
Loading history...
15
    }
16
17 5
    public function getEID(): ?string
18
    {
19 5
        return $this[Attribute::EID] ?? null;
20
    }
21
22 26
    public function hasEID(): bool
23
    {
24 26
        return $this->offsetExists(Attribute::EID);
0 ignored issues
show
Bug introduced by
It seems like offsetExists() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $this->/** @scrutinizer ignore-call */ offsetExists(Attribute::EID);
Loading history...
25
    }
26
27 1
    public function setOrderNumber(int $orderNumber): void
28
    {
29 1
        $this->offsetSet(Attribute::ORDER_NUMBER, $orderNumber);
30
    }
31
32 1
    public function setRealOrderId(string $realOrderId): void
33
    {
34 1
        $this->offsetSet(Attribute::REAL_ORDER_ID, $realOrderId);
35
    }
36
37 21
    public function setServiceType(string $serviceType): void
38
    {
39 21
        $this->offsetSet(Attribute::SERVICE_TYPE, $serviceType);
40
    }
41
42
    /**
43
     * @param array<string> $services
44
     */
45 1
    public function setServices(array $services): void
46
    {
47
        // TODO: add validation
48
49 1
        $this->offsetSet(Attribute::SERVICES, implode('+', $services));
50
    }
51
52 16
    public function setBranchId(string $branchId): void
53
    {
54 16
        $this->offsetSet(Attribute::BRANCH_ID, $branchId);
55
    }
56
57 1
    public function setBranchType(string $branchType): void
58
    {
59 1
        $this->offsetSet(Attribute::BRANCH_TYPE, $branchType);
60
    }
61
62 1
    public function setReturnFullErrors(bool $fullErrors = true): void
63
    {
64 1
        $this->offsetSet(Attribute::RETURN_FULL_ERRORS, (int) $fullErrors);
65
    }
66
67 1
    public function setReturnTrack(bool $returnTrack = true): void
68
    {
69 1
        $this->offsetSet(Attribute::RETURN_TRACK, (int) $returnTrack);
70
    }
71
72 1
    public function setReturnFinalCarrierId(bool $returnCarrierId = true): void
73
    {
74 1
        $this->offsetSet(Attribute::RETURN_FINAL_CARRIER_ID, (int) $returnCarrierId);
75
    }
76
77 1
    public function setReturnBarcode(bool $returnBarcode = true): void
78
    {
79 1
        $this->offsetSet(Attribute::RETURN_BARCODE, (int) $returnBarcode);
80
    }
81
}
82