Passed
Push — master ( f7c169...528c62 )
by Angel Fernando Quiroz
08:03 queued 15s
created

XApiStatement::getId()   A

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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Repository\XApiStatementRepository;
10
use Doctrine\Common\Collections\ArrayCollection;
11
use Doctrine\Common\Collections\Collection;
12
use Doctrine\ORM\Mapping as ORM;
13
14
#[ORM\Entity(repositoryClass: XApiStatementRepository::class)]
15
class XApiStatement
16
{
17
    #[ORM\Id]
18
    #[ORM\GeneratedValue(strategy: 'NONE')]
19
    #[ORM\Column]
20
    private ?string $id = null;
21
22
    #[ORM\Column(nullable: true)]
23
    private ?int $created = null;
24
25
    #[ORM\Column(nullable: true)]
26
    private ?int $stored = null;
27
28
    #[ORM\Column]
29
    private ?bool $hasAttachments = null;
30
31
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
32
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
33
    private ?XApiObject $actor = null;
34
35
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
36
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
37
    private ?XApiVerb $verb = null;
38
39
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
40
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
41
    private ?XApiObject $object = null;
42
43
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
44
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
45
    private ?XApiResult $result = null;
46
47
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
48
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
49
    private ?XApiObject $authority = null;
50
51
    #[ORM\OneToOne(cascade: ['persist', 'remove'])]
52
    #[ORM\JoinColumn(referencedColumnName: 'identifier')]
53
    private ?XApiContext $context = null;
54
55
    /**
56
     * @var Collection<int, XApiAttachment>
57
     */
58
    #[ORM\OneToMany(mappedBy: 'statement', targetEntity: XApiAttachment::class)]
59
    private Collection $attachments;
60
61
    public function __construct()
62
    {
63
        $this->attachments = new ArrayCollection();
64
    }
65
66
    public function getId(): ?string
67
    {
68
        return $this->id;
69
    }
70
71
    public function getCreated(): ?int
72
    {
73
        return $this->created;
74
    }
75
76
    public function setCreated(?int $created): static
77
    {
78
        $this->created = $created;
79
80
        return $this;
81
    }
82
83
    public function getStored(): ?int
84
    {
85
        return $this->stored;
86
    }
87
88
    public function setStored(?int $stored): static
89
    {
90
        $this->stored = $stored;
91
92
        return $this;
93
    }
94
95
    public function hasAttachments(): ?bool
96
    {
97
        return $this->hasAttachments;
98
    }
99
100
    public function setHasAttachments(bool $hasAttachments): static
101
    {
102
        $this->hasAttachments = $hasAttachments;
103
104
        return $this;
105
    }
106
107
    public function getActor(): ?XApiObject
108
    {
109
        return $this->actor;
110
    }
111
112
    public function setActor(?XApiObject $actor): static
113
    {
114
        $this->actor = $actor;
115
116
        return $this;
117
    }
118
119
    public function getVerb(): ?XApiVerb
120
    {
121
        return $this->verb;
122
    }
123
124
    public function setVerb(?XApiVerb $verb): static
125
    {
126
        $this->verb = $verb;
127
128
        return $this;
129
    }
130
131
    public function getObject(): ?XApiObject
132
    {
133
        return $this->object;
134
    }
135
136
    public function setObject(?XApiObject $object): static
137
    {
138
        $this->object = $object;
139
140
        return $this;
141
    }
142
143
    public function getResult(): ?XApiResult
144
    {
145
        return $this->result;
146
    }
147
148
    public function setResult(?XApiResult $result): static
149
    {
150
        $this->result = $result;
151
152
        return $this;
153
    }
154
155
    public function getAuthority(): ?XApiObject
156
    {
157
        return $this->authority;
158
    }
159
160
    public function setAuthority(?XApiObject $authority): static
161
    {
162
        $this->authority = $authority;
163
164
        return $this;
165
    }
166
167
    public function getContext(): ?XApiContext
168
    {
169
        return $this->context;
170
    }
171
172
    public function setContext(?XApiContext $context): static
173
    {
174
        $this->context = $context;
175
176
        return $this;
177
    }
178
179
    /**
180
     * @return Collection<int, XApiAttachment>
181
     */
182
    public function getAttachments(): Collection
183
    {
184
        return $this->attachments;
185
    }
186
187
    public function addAttachment(XApiAttachment $attachment): static
188
    {
189
        if (!$this->attachments->contains($attachment)) {
190
            $this->attachments->add($attachment);
191
            $attachment->setStatement($this);
192
        }
193
194
        return $this;
195
    }
196
197
    public function removeAttachment(XApiAttachment $attachment): static
198
    {
199
        if ($this->attachments->removeElement($attachment)) {
200
            // set the owning side to null (unless already changed)
201
            if ($attachment->getStatement() === $this) {
202
                $attachment->setStatement(null);
203
            }
204
        }
205
206
        return $this;
207
    }
208
}
209