Completed
Push — master ( ab94e9...fa2f9e )
by Gabriel
02:21
created

Variant   A

Complexity

Total Complexity 32

Size/Duplication

Total Lines 196
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 91.4%

Importance

Changes 0
Metric Value
wmc 32
lcom 1
cbo 3
dl 0
loc 196
ccs 85
cts 93
cp 0.914
rs 9.6
c 0
b 0
f 0

32 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getImages() 0 4 1
A getCreationDatetime() 0 4 1
A getModificationDatetime() 0 4 1
A __construct() 0 6 1
A setId() 0 4 1
A setImages() 0 4 1
A getOptions() 0 4 1
A setOptions() 0 4 1
A getCodes() 0 4 1
A setCodes() 0 4 1
A getPrices() 0 4 1
A setPrices() 0 4 1
A getDescription() 0 4 1
A setDescription() 0 4 1
A getNotes() 0 4 1
A setNotes() 0 4 1
A getWeightUnit() 0 4 1
A setWeightUnit() 0 4 1
A getLengthUnit() 0 4 1
A setLengthUnit() 0 4 1
A getWeight() 0 4 1
A setWeight() 0 4 1
A getWidth() 0 4 1
A setWidth() 0 4 1
A getHeight() 0 4 1
A setHeight() 0 4 1
A getDepth() 0 4 1
A setDepth() 0 4 1
A setCreationDatetime() 0 4 1
A setModificationDatetime() 0 4 1
A jsonSerialize() 0 20 1
1
<?php
2
3
namespace Waredesk\Models\Product;
4
5
use DateTime;
6
use JsonSerializable;
7
use Waredesk\Collections\Products\Variants\Codes;
8
use Waredesk\Collections\Products\Variants\Options;
9
use Waredesk\Collections\Products\Variants\Prices;
10
11
class Variant implements JsonSerializable
12
{
13
    private $id;
14
    private $images;
15
    private $options;
16
    private $codes;
17
    private $prices;
18
    private $description;
19
    private $notes;
20
    private $weight_unit;
21
    private $length_unit;
22
    private $weight;
23
    private $width;
24
    private $height;
25
    private $depth;
26
    private $creation_datetime;
27
    private $modification_datetime;
28
29 1
    public function __construct()
30
    {
31 1
        $this->options = new Options();
32 1
        $this->codes = new Codes();
33 1
        $this->prices = new Prices();
34 1
    }
35
36
    public function getId(): ?int
37
    {
38
        return $this->id;
39
    }
40
41 1
    public function setId(int $id = null)
42
    {
43 1
        $this->id = $id;
44 1
    }
45
46
    public function getImages(): ?array
47
    {
48
        return $this->images;
49
    }
50
51 1
    public function setImages(array $images = null)
52
    {
53 1
        $this->images = $images;
54 1
    }
55
56 1
    public function getOptions(): ?Options
57
    {
58 1
        return $this->options;
59
    }
60
61 1
    public function setOptions(Options $options)
62
    {
63 1
        $this->options = $options;
64 1
    }
65
66 1
    public function getCodes(): ?Codes
67
    {
68 1
        return $this->codes;
69
    }
70
71 1
    public function setCodes(Codes $codes)
72
    {
73 1
        $this->codes = $codes;
74 1
    }
75
76 1
    public function getPrices(): ?Prices
77
    {
78 1
        return $this->prices;
79
    }
80
81 1
    public function setPrices(Prices $prices)
82
    {
83 1
        $this->prices = $prices;
84 1
    }
85
86 1
    public function getDescription(): ?string
87
    {
88 1
        return $this->description;
89
    }
90
91 1
    public function setDescription(string $description = null)
92
    {
93 1
        $this->description = $description;
94 1
    }
95
96 1
    public function getNotes(): ?string
97
    {
98 1
        return $this->notes;
99
    }
100
101 1
    public function setNotes(string $notes = null)
102
    {
103 1
        $this->notes = $notes;
104 1
    }
105
106 1
    public function getWeightUnit(): ?string
107
    {
108 1
        return $this->weight_unit;
109
    }
110
111 1
    public function setWeightUnit(string $weight_unit = null)
112
    {
113 1
        $this->weight_unit = $weight_unit;
114 1
    }
115
116 1
    public function getLengthUnit(): ?string
117
    {
118 1
        return $this->length_unit;
119
    }
120
121 1
    public function setLengthUnit(string $length_unit = null)
122
    {
123 1
        $this->length_unit = $length_unit;
124 1
    }
125
126 1
    public function getWeight(): ?float
127
    {
128 1
        return $this->weight;
129
    }
130
131 1
    public function setWeight(float $weight = null)
132
    {
133 1
        $this->weight = $weight;
134 1
    }
135
136 1
    public function getWidth(): ?float
137
    {
138 1
        return $this->width;
139
    }
140
141 1
    public function setWidth(float $width = null)
142
    {
143 1
        $this->width = $width;
144 1
    }
145
146 1
    public function getHeight(): ?float
147
    {
148 1
        return $this->height;
149
    }
150
151 1
    public function setHeight(float $height = null)
152
    {
153 1
        $this->height = $height;
154 1
    }
155
156 1
    public function getDepth(): ?float
157
    {
158 1
        return $this->depth;
159
    }
160
161 1
    public function setDepth(float $depth = null)
162
    {
163 1
        $this->depth = $depth;
164 1
    }
165
166
    public function getCreationDatetime(): ?DateTime
167
    {
168
        return $this->creation_datetime;
169
    }
170
171 1
    public function setCreationDatetime(DateTime $creation_datetime = null)
172
    {
173 1
        $this->creation_datetime = $creation_datetime;
174 1
    }
175
176
    public function getModificationDatetime(): ?DateTime
177
    {
178
        return $this->modification_datetime;
179
    }
180
181 1
    public function setModificationDatetime(DateTime $modification_datetime = null)
182
    {
183 1
        $this->modification_datetime = $modification_datetime;
184 1
    }
185
186 1
    public function jsonSerialize()
187
    {
188
        $returnValue = [
189 1
            'description' => $this->getDescription(),
190 1
            'notes' => $this->getNotes(),
191 1
            'options' => $this->getOptions()->jsonSerialize(),
192 1
            'codes' => $this->getCodes()->jsonSerialize(),
193 1
            'prices' => $this->getPrices()->jsonSerialize(),
194 1
            'weight_unit' => $this->getWeightUnit(),
195 1
            'length_unit' => $this->getLengthUnit(),
196 1
            'weight' => $this->getWeight(),
197 1
            'width' => $this->getWidth(),
198 1
            'height' => $this->getHeight(),
199 1
            'depth' => $this->getDepth(),
200
        ];
201
        //if ($this->getImages() instanceof NewImage) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
202
        // $returnValue['image'] = base64($this->getNewImage());
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
203
        // }
204 1
        return $returnValue;
205
    }
206
}
207