Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
namespace Packback\Lti1p3;
4
 
5
use Packback\Lti1p3\Concerns\JsonStringable;
6
 
7
class LtiLineitem
8
{
9
    use JsonStringable;
10
    private $id;
11
    private $score_maximum;
12
    private $label;
13
    private $resource_id;
14
    private $resource_link_id;
15
    private $tag;
16
    private $start_date_time;
17
    private $end_date_time;
18
    private ?bool $grades_released;
19
 
20
    public function __construct(?array $lineitem = null)
21
    {
22
        $this->id = $lineitem['id'] ?? null;
23
        $this->score_maximum = $lineitem['scoreMaximum'] ?? null;
24
        $this->label = $lineitem['label'] ?? null;
25
        $this->resource_id = $lineitem['resourceId'] ?? null;
26
        $this->resource_link_id = $lineitem['resourceLinkId'] ?? null;
27
        $this->tag = $lineitem['tag'] ?? null;
28
        $this->start_date_time = $lineitem['startDateTime'] ?? null;
29
        $this->end_date_time = $lineitem['endDateTime'] ?? null;
30
        $this->grades_released = $lineitem['gradesReleased'] ?? null;
31
    }
32
 
33
    /**
34
     * Static function to allow for method chaining without having to assign to a variable first.
35
     */
36
    public static function new(?array $lineItem = null): self
37
    {
38
        return new LtiLineitem($lineItem);
39
    }
40
 
41
    public function getArray(): array
42
    {
43
        return [
44
            'id' => $this->id,
45
            'scoreMaximum' => $this->score_maximum,
46
            'label' => $this->label,
47
            'resourceId' => $this->resource_id,
48
            'resourceLinkId' => $this->resource_link_id,
49
            'tag' => $this->tag,
50
            'startDateTime' => $this->start_date_time,
51
            'endDateTime' => $this->end_date_time,
52
            'gradesReleased' => $this->grades_released,
53
        ];
54
    }
55
 
56
    public function getId()
57
    {
58
        return $this->id;
59
    }
60
 
61
    public function setId($value): self
62
    {
63
        $this->id = $value;
64
 
65
        return $this;
66
    }
67
 
68
    public function getLabel()
69
    {
70
        return $this->label;
71
    }
72
 
73
    public function setLabel($value): self
74
    {
75
        $this->label = $value;
76
 
77
        return $this;
78
    }
79
 
80
    public function getScoreMaximum()
81
    {
82
        return $this->score_maximum;
83
    }
84
 
85
    public function setScoreMaximum($value): self
86
    {
87
        $this->score_maximum = $value;
88
 
89
        return $this;
90
    }
91
 
92
    public function getResourceId()
93
    {
94
        return $this->resource_id;
95
    }
96
 
97
    public function setResourceId($value): self
98
    {
99
        $this->resource_id = $value;
100
 
101
        return $this;
102
    }
103
 
104
    public function getResourceLinkId()
105
    {
106
        return $this->resource_link_id;
107
    }
108
 
109
    public function setResourceLinkId($value): self
110
    {
111
        $this->resource_link_id = $value;
112
 
113
        return $this;
114
    }
115
 
116
    public function getTag()
117
    {
118
        return $this->tag;
119
    }
120
 
121
    public function setTag($value): self
122
    {
123
        $this->tag = $value;
124
 
125
        return $this;
126
    }
127
 
128
    public function getStartDateTime()
129
    {
130
        return $this->start_date_time;
131
    }
132
 
133
    public function setStartDateTime($value): self
134
    {
135
        $this->start_date_time = $value;
136
 
137
        return $this;
138
    }
139
 
140
    public function getEndDateTime()
141
    {
142
        return $this->end_date_time;
143
    }
144
 
145
    public function setEndDateTime($value): self
146
    {
147
        $this->end_date_time = $value;
148
 
149
        return $this;
150
    }
151
 
152
    public function getGradesReleased(): ?bool
153
    {
154
        return $this->grades_released;
155
    }
156
 
157
    public function setGradesReleased(?bool $value): self
158
    {
159
        $this->grades_released = $value;
160
 
161
        return $this;
162
    }
163
}