Completed
Push — master ( 9396da...236110 )
by Joachim
15:12
created

Segment   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 143
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 143
ccs 25
cts 25
cp 1
rs 10
c 0
b 0
f 0
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getExternalId() 0 3 1
A setCategories() 0 5 1
A setId() 0 5 1
A getCategories() 0 3 1
A setSegmentOptions() 0 5 1
A setExternalId() 0 5 1
A getProducts() 0 3 1
A setProducts() 0 5 1
A getSegmentOptions() 0 3 1
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\SegmentInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...\Generated\SegmentTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @ORM\Entity()
12
 * @ORM\Table(name="ldf_segments")
13
 */
14
class Segment extends AbstractEntity implements SegmentInterface
15
{
16
    use SegmentTrait;
17
18
    protected $hydrateConversions = [
19
        'id' => 'externalId',
20
    ];
21
22
    /**
23
     * @var int
24
     *
25
     * @ORM\Id
26
     * @ORM\GeneratedValue
27
     * @ORM\Column(type="integer")
28
     **/
29
    protected $id;
30
31
    /**
32
     * @var string
33
     *
34
     * @ORM\Column(type="string", unique=true, length=191)
35
     */
36
    protected $externalId;
37
38
    /**
39
     * @var Category[]|ArrayCollection
40
     *
41
     * @ORM\ManyToMany(mappedBy="segments", targetEntity="Category")
42
     */
43
    protected $categories;
44
45
    /**
46
     * @var Product[]|ArrayCollection
47
     *
48
     * @ORM\ManyToMany(mappedBy="segments", targetEntity="Product")
49
     */
50
    protected $products;
51
52
    /**
53
     * @var array|null
54
     *
55
     * @ORM\Column(nullable=true, type="json")
56
     */
57
    protected $segmentOptions;
58
59
    /**
60
     * @return int
61
     */
62 6
    public function getId(): int
63
    {
64 6
        return (int) $this->id;
65
    }
66
67
    /**
68
     * @param int $id
69
     *
70
     * @return SegmentInterface
71 3
     */
72
    public function setId(int $id)
73 3
    {
74 3
        $this->id = $id;
75
76
        return $this;
77
    }
78
79
    /**
80 6
     * @return string
81
     */
82 6
    public function getExternalId(): string
83
    {
84
        return (string) $this->externalId;
85
    }
86
87
    /**
88
     * @param string $externalId
89 3
     *
90
     * @return SegmentInterface
91 3
     */
92 3
    public function setExternalId(string $externalId)
93
    {
94
        $this->externalId = $externalId;
95
96
        return $this;
97
    }
98 3
99
    /**
100 3
     * @return ArrayCollection|Category[]
101
     */
102
    public function getCategories()
103
    {
104
        return $this->categories;
105
    }
106
107 3
    /**
108
     * @param ArrayCollection|Category[] $categories
109 3
     *
110 3
     * @return SegmentInterface
111
     */
112
    public function setCategories($categories)
113
    {
114
        $this->categories = $categories;
115
116 3
        return $this;
117
    }
118 3
119
    /**
120
     * @return ArrayCollection|Product[]
121
     */
122
    public function getProducts()
123
    {
124
        return $this->products;
125 3
    }
126
127 3
    /**
128 3
     * @param ArrayCollection|Product[] $products
129
     *
130
     * @return SegmentInterface
131
     */
132
    public function setProducts($products)
133
    {
134 3
        $this->products = $products;
135
136 3
        return $this;
137
    }
138
139
    /**
140
     * @return array
141
     */
142
    public function getSegmentOptions()
143 3
    {
144
        return $this->segmentOptions;
145 3
    }
146 3
147
    /**
148
     * @param array $segmentOptions
149
     *
150
     * @return SegmentInterface
151
     */
152
    public function setSegmentOptions(array $segmentOptions)
153
    {
154
        $this->segmentOptions = $segmentOptions;
155
156
        return $this;
157
    }
158
}
159