Product::getSku()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Ipag\Classes;
4
5
use Ipag\Classes\Contracts\Emptiable;
6
use Ipag\Classes\Traits\EmptiableTrait;
7
8
final class Product extends BaseResource implements Emptiable
9
{
10
    use EmptiableTrait;
11
12
    /**
13
     * @var string
14
     */
15
    private $name;
16
17
    /**
18
     * @var int
19
     */
20
    private $quantity;
21
22
    /**
23
     * @var float
24
     */
25
    private $unitPrice;
26
27
    /**
28
     * @var string
29
     */
30
    private $sku;
31
32
    /**
33
     * @return string
34
     */
35
    public function getName()
36
    {
37
        return $this->name;
38
    }
39
40
    /**
41
     * @param string $name
42
     */
43
    public function setName($name)
44
    {
45
        $this->name = substr($name, 0, 100);
46
47
        return $this;
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getQuantity()
54
    {
55
        return $this->quantity;
56
    }
57
58
    /**
59
     * @param int $quantity
60
     */
61
    public function setQuantity($quantity)
62
    {
63
        $this->quantity = (int) $quantity;
64
65
        return $this;
66
    }
67
68
    /**
69
     * @return float
70
     */
71
    public function getUnitPrice()
72
    {
73
        return $this->unitPrice;
74
    }
75
76
    /**
77
     * @param mixed $unitPrice
78
     */
79
    public function setUnitPrice($unitPrice)
80
    {
81
        $this->unitPrice = $this->getNumberUtil()->convertToDouble($unitPrice);
82
83
        return $this;
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function getSku()
90
    {
91
        return $this->sku;
92
    }
93
94
    /**
95
     * @param string $sku
96
     */
97
    public function setSku($sku)
98
    {
99
        $this->sku = substr($sku, 0, 20);
100
101
        return $this;
102
    }
103
}
104