Passed
Push — master ( 1e00a2...f52220 )
by Angel Fernando Quiroz
07:44 queued 14s
created

XApiToolLaunch::addItem()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Chamilo\CoreBundle\Entity;
4
5
use Chamilo\CoreBundle\Repository\XApiToolLaunchRepository;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\Common\Collections\Collection;
8
use Doctrine\DBAL\Types\Types;
9
use Doctrine\ORM\Mapping as ORM;
10
use Gedmo\Timestampable\Traits\TimestampableEntity;
11
12
#[ORM\Entity(repositoryClass: XApiToolLaunchRepository::class)]
13
class XApiToolLaunch
14
{
15
    use TimestampableEntity;
16
17
    #[ORM\Id]
18
    #[ORM\GeneratedValue]
19
    #[ORM\Column]
20
    private ?int $id = null;
21
22
    #[ORM\Column(length: 255)]
23
    private ?string $title = null;
24
25
    #[ORM\Column(type: Types::TEXT, nullable: true)]
26
    private ?string $description = null;
27
28
    #[ORM\ManyToOne]
29
    #[ORM\JoinColumn(nullable: false)]
30
    private ?Course $course = null;
31
32
    #[ORM\ManyToOne]
33
    private ?Session $session = null;
34
35
    #[ORM\Column(length: 255)]
36
    private ?string $launchUrl = null;
37
38
    #[ORM\Column(length: 255, nullable: true)]
39
    private ?string $activityId = null;
40
41
    #[ORM\Column(length: 255, nullable: true)]
42
    private ?string $activityType = null;
43
44
    #[ORM\Column]
45
    private ?bool $allowMultipleAttempts = null;
46
47
    #[ORM\Column(length: 255, nullable: true)]
48
    private ?string $lrsUrl = null;
49
50
    #[ORM\Column(length: 255, nullable: true)]
51
    private ?string $lrsAuthUsername = null;
52
53
    #[ORM\Column(length: 255, nullable: true)]
54
    private ?string $lrsAuthPassword = null;
55
56
    /**
57
     * @var Collection<int, XApiCmi5Item>
58
     */
59
    #[ORM\OneToMany(mappedBy: 'tool', targetEntity: XApiCmi5Item::class)]
60
    private Collection $items;
61
62
    public function __construct()
63
    {
64
        $this->items = new ArrayCollection();
65
    }
66
67
    public function getId(): ?int
68
    {
69
        return $this->id;
70
    }
71
72
    public function getTitle(): ?string
73
    {
74
        return $this->title;
75
    }
76
77
    public function setTitle(string $title): static
78
    {
79
        $this->title = $title;
80
81
        return $this;
82
    }
83
84
    public function getDescription(): ?string
85
    {
86
        return $this->description;
87
    }
88
89
    public function setDescription(?string $description): static
90
    {
91
        $this->description = $description;
92
93
        return $this;
94
    }
95
96
    public function getCourse(): ?Course
97
    {
98
        return $this->course;
99
    }
100
101
    public function setCourse(?Course $course): static
102
    {
103
        $this->course = $course;
104
105
        return $this;
106
    }
107
108
    public function getSession(): ?Session
109
    {
110
        return $this->session;
111
    }
112
113
    public function setSession(?Session $session): static
114
    {
115
        $this->session = $session;
116
117
        return $this;
118
    }
119
120
    public function getLaunchUrl(): ?string
121
    {
122
        return $this->launchUrl;
123
    }
124
125
    public function setLaunchUrl(string $launchUrl): static
126
    {
127
        $this->launchUrl = $launchUrl;
128
129
        return $this;
130
    }
131
132
    public function getActivityId(): ?string
133
    {
134
        return $this->activityId;
135
    }
136
137
    public function setActivityId(?string $activityId): static
138
    {
139
        $this->activityId = $activityId;
140
141
        return $this;
142
    }
143
144
    public function getActivityType(): ?string
145
    {
146
        return $this->activityType;
147
    }
148
149
    public function setActivityType(?string $activityType): static
150
    {
151
        $this->activityType = $activityType;
152
153
        return $this;
154
    }
155
156
    public function isAllowMultipleAttempts(): ?bool
157
    {
158
        return $this->allowMultipleAttempts;
159
    }
160
161
    public function setAllowMultipleAttempts(bool $allowMultipleAttempts): static
162
    {
163
        $this->allowMultipleAttempts = $allowMultipleAttempts;
164
165
        return $this;
166
    }
167
168
    public function getLrsUrl(): ?string
169
    {
170
        return $this->lrsUrl;
171
    }
172
173
    public function setLrsUrl(?string $lrsUrl): static
174
    {
175
        $this->lrsUrl = $lrsUrl;
176
177
        return $this;
178
    }
179
180
    public function getLrsAuthUsername(): ?string
181
    {
182
        return $this->lrsAuthUsername;
183
    }
184
185
    public function setLrsAuthUsername(?string $lrsAuthUsername): static
186
    {
187
        $this->lrsAuthUsername = $lrsAuthUsername;
188
189
        return $this;
190
    }
191
192
    public function getLrsAuthPassword(): ?string
193
    {
194
        return $this->lrsAuthPassword;
195
    }
196
197
    public function setLrsAuthPassword(?string $lrsAuthPassword): static
198
    {
199
        $this->lrsAuthPassword = $lrsAuthPassword;
200
201
        return $this;
202
    }
203
204
    /**
205
     * @return Collection<int, XApiCmi5Item>
206
     */
207
    public function getItems(): Collection
208
    {
209
        return $this->items;
210
    }
211
212
    public function addItem(XApiCmi5Item $item): static
213
    {
214
        if (!$this->items->contains($item)) {
215
            $this->items->add($item);
216
            $item->setTool($this);
217
        }
218
219
        return $this;
220
    }
221
222
    public function removeItem(XApiCmi5Item $item): static
223
    {
224
        if ($this->items->removeElement($item)) {
225
            // set the owning side to null (unless already changed)
226
            if ($item->getTool() === $this) {
227
                $item->setTool(null);
228
            }
229
        }
230
231
        return $this;
232
    }
233
}
234