| Línea 50... |
Línea 50... |
| 50 |
* An xAPI activity is mainly an IRI ID and an optional definition.
|
50 |
* An xAPI activity is mainly an IRI ID and an optional definition.
|
| 51 |
*
|
51 |
*
|
| 52 |
* @param stdClass $data from the specific xAPI element
|
52 |
* @param stdClass $data from the specific xAPI element
|
| 53 |
* @param item_definition $definition option definition item
|
53 |
* @param item_definition $definition option definition item
|
| 54 |
*/
|
54 |
*/
|
| 55 |
protected function __construct(stdClass $data, item_definition $definition = null) {
|
55 |
protected function __construct(stdClass $data, ?item_definition $definition = null) {
|
| 56 |
parent::__construct($data);
|
56 |
parent::__construct($data);
|
| 57 |
$this->id = iri::extract($data->id, 'activity');
|
57 |
$this->id = iri::extract($data->id, 'activity');
|
| 58 |
$this->definition = $definition;
|
58 |
$this->definition = $definition;
|
| 59 |
}
|
59 |
}
|
| Línea 91... |
Línea 91... |
| 91 |
*
|
91 |
*
|
| 92 |
* @param string $id any string that will converted into a valid IRI
|
92 |
* @param string $id any string that will converted into a valid IRI
|
| 93 |
* @param item_definition|null $definition optional item_definition
|
93 |
* @param item_definition|null $definition optional item_definition
|
| 94 |
* @return item_activity
|
94 |
* @return item_activity
|
| 95 |
*/
|
95 |
*/
|
| 96 |
public static function create_from_id(string $id, item_definition $definition = null): item_activity {
|
96 |
public static function create_from_id(string $id, ?item_definition $definition = null): item_activity {
|
| 97 |
$data = (object) [
|
97 |
$data = (object) [
|
| 98 |
'objectType' => 'Activity',
|
98 |
'objectType' => 'Activity',
|
| 99 |
'id' => iri::generate($id, 'activity'),
|
99 |
'id' => iri::generate($id, 'activity'),
|
| 100 |
];
|
100 |
];
|