|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the xAPI package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Christian Flothmann <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Xabbuh\XApi\Model; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* xAPI context activities. |
|
16
|
|
|
* |
|
17
|
|
|
* @author Christian Flothmann <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
final class ContextActivities |
|
20
|
|
|
{ |
|
21
|
|
|
private $parent; |
|
22
|
|
|
private $grouping; |
|
23
|
|
|
private $category; |
|
24
|
|
|
private $other; |
|
25
|
|
|
|
|
26
|
|
|
public function __construct(Activity $parent = null, Activity $grouping = null, Activity $category = null, Activity $other = null) |
|
27
|
|
|
{ |
|
28
|
|
|
$this->parent = $parent; |
|
29
|
|
|
$this->grouping = $grouping; |
|
30
|
|
|
$this->category = $category; |
|
31
|
|
|
$this->other = $other; |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
public function withParent(Activity $parent) |
|
35
|
|
|
{ |
|
36
|
|
|
$contextActivities = clone $this; |
|
37
|
|
|
$contextActivities->parent = $parent; |
|
38
|
|
|
|
|
39
|
|
|
return $contextActivities; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function withGrouping(Activity $grouping) |
|
43
|
|
|
{ |
|
44
|
|
|
$contextActivities = clone $this; |
|
45
|
|
|
$contextActivities->grouping = $grouping; |
|
46
|
|
|
|
|
47
|
|
|
return $contextActivities; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function withCategory(Activity $category) |
|
51
|
|
|
{ |
|
52
|
|
|
$contextActivities = clone $this; |
|
53
|
|
|
$contextActivities->category = $category; |
|
54
|
|
|
|
|
55
|
|
|
return $contextActivities; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function withOther(Activity $other) |
|
59
|
|
|
{ |
|
60
|
|
|
$contextActivities = clone $this; |
|
61
|
|
|
$contextActivities->other = $other; |
|
62
|
|
|
|
|
63
|
|
|
return $contextActivities; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function getParent() |
|
67
|
|
|
{ |
|
68
|
|
|
return $this->parent; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function getGrouping() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->grouping; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getCategory() |
|
77
|
|
|
{ |
|
78
|
|
|
return $this->category; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
public function getOther() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->other; |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|