Item::setTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
3
4
namespace floor12\DalliApi\Models;
5
6
7
class Item extends BaseXmlObject
8
{
9
    /** @var string */
10
    public $title;
11
    /** @var int */
12
    public $_quantity = 1;
13
    /** @var float */
14
    public $_weight;
15
    /** @var float */
16
    public $_retprice;
17
    /** @var int */
18
    public $_barcode;
19
    /** @var string */
20
    public $_article;
21
    /** @var bool|null */
22
    public $_return;
23
    /** @var string|null */
24
    public $_governmentCode;
25
26
27
    /**
28
     * @param int $quantity
29 2
     * @return Item
30
     */
31 2
    public function setQuantity(int $quantity)
32 2
    {
33
        $this->_quantity = $quantity;
34
        return $this;
35
    }
36
37
    /**
38
     * @param float $_weight
39
     * @return Item
40 2
     * @return Item
41
     */
42 2
    public function setWeight(float $_weight)
43 2
    {
44
        $this->_weight = $_weight;
45
        return $this;
46
    }
47
48
    /**
49
     * @param float $retprice
50
     * @return Item
51 2
     * @return Item
52
     */
53 2
    public function setRetprice(float $retprice)
54 2
    {
55
        $this->_retprice = $retprice;
56
        return $this;
57
    }
58
59
    /**
60
     * @param string $_barcode
61
     * @return Item
62 5
     * @return Item
63
     */
64 5
    public function setBarcode(string $_barcode)
65 5
    {
66
        $this->_barcode = $_barcode;
0 ignored issues
show
Documentation Bug introduced by
The property $_barcode was declared of type integer, but $_barcode is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
67
        return $this;
68
    }
69
70
    /**
71
     * @param string $_article
72
     * @return Item
73 1
     * @return Item
74
     */
75 1
    public function setArticle(string $_article)
76 1
    {
77
        $this->_article = $_article;
78
        return $this;
79
    }
80
81
    /**
82
     * @param string $title
83 1
     * @return self
84
     */
85 1
    public function setTitle(string $title): self
86 1
    {
87
        $this->title = $title;
88
        return $this;
89
    }
90
91
    /**
92
     * @param bool $return
93 3
     * @return self;
94
     */
95 3
    public function setReturn(bool $return): self
96 3
    {
97
        $this->_return = $return;
98
        return $this;
99
    }
100
101
    /**
102 2
     * @return bool|null
103
     */
104 2
    public function isReturned(): ?bool
105
    {
106
        return $this->_return;
107
    }
108
109
    /**
110
     * @param string $code
111
     * @return self;
112
     */
113
    public function setGovernmentCode(?string $code): self
114
    {
115
        if ($code) {
116
            $this->_governmentCode = $code;
117
        }
118
        return $this;
119
    }
120
}
121