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

Product   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 110
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 87.76%

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 1
dl 0
loc 110
ccs 43
cts 49
cp 0.8776
rs 10
c 0
b 0
f 0

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getImages() 0 4 1
A getCreationDatetime() 0 4 1
A getModificationDatetime() 0 4 1
A __construct() 0 4 1
A getId() 0 4 1
A setId() 0 4 1
A setImages() 0 4 1
A getVariants() 0 4 1
A setVariants() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getDescription() 0 4 1
A setDescription() 0 4 1
A getNotes() 0 4 1
A setNotes() 0 4 1
A setCreationDatetime() 0 4 1
A setModificationDatetime() 0 4 1
A jsonSerialize() 0 13 1
1
<?php
2
3
namespace Waredesk\Models;
4
5
use DateTime;
6
use Waredesk\Collections\Products\Variants;
7
use JsonSerializable;
8
9
class Product implements JsonSerializable
10
{
11
    private $id;
12
    private $images;
13
    private $variants;
14
    private $name;
15
    private $description;
16
    private $notes;
17
    private $creation_datetime;
18
    private $modification_datetime;
19
20 1
    public function __construct()
21
    {
22 1
        $this->variants = new Variants();
23 1
    }
24
25 1
    public function getId(): ?int
26
    {
27 1
        return $this->id;
28
    }
29
30 1
    public function setId(int $id = null)
31
    {
32 1
        $this->id = $id;
33 1
    }
34
35
    public function getImages(): ?array
36
    {
37
        return $this->images;
38
    }
39
40 1
    public function setImages(array $images = null)
41
    {
42 1
        $this->images = $images;
43 1
    }
44
45 1
    public function getVariants(): ?Variants
46
    {
47 1
        return $this->variants;
48
    }
49
50 1
    public function setVariants(Variants $variants)
51
    {
52 1
        $this->variants = $variants;
53 1
    }
54
55 1
    public function getName(): ?string
56
    {
57 1
        return $this->name;
58
    }
59
60 1
    public function setName(string $name = null)
61
    {
62 1
        $this->name = $name;
63 1
    }
64
65 1
    public function getDescription(): ?string
66
    {
67 1
        return $this->description;
68
    }
69
70 1
    public function setDescription(string $description = null)
71
    {
72 1
        $this->description = $description;
73 1
    }
74
75 1
    public function getNotes(): ?string
76
    {
77 1
        return $this->notes;
78
    }
79
80 1
    public function setNotes(string $notes = null)
81
    {
82 1
        $this->notes = $notes;
83 1
    }
84
85
    public function getCreationDatetime(): ?DateTime
86
    {
87
        return $this->creation_datetime;
88
    }
89
90 1
    public function setCreationDatetime(DateTime $creation_datetime = null)
91
    {
92 1
        $this->creation_datetime = $creation_datetime;
93 1
    }
94
95
    public function getModificationDatetime(): ?DateTime
96
    {
97
        return $this->modification_datetime;
98
    }
99
100 1
    public function setModificationDatetime(DateTime $modification_datetime = null)
101
    {
102 1
        $this->modification_datetime = $modification_datetime;
103 1
    }
104
105 1
    public function jsonSerialize()
106
    {
107
        $returnValue = [
108 1
            'variants' => $this->getVariants()->jsonSerialize(),
109 1
            'name' => $this->getName(),
0 ignored issues
show
Bug introduced by
Consider using $this->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
110 1
            'description' => $this->getDescription(),
111 1
            'notes' => $this->getNotes(),
112
        ];
113
        //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...
114
        // $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...
115
        // }
116 1
        return $returnValue;
117
    }
118
}
119