Completed
Pull Request — master (#15)
by Christian
03:51
created

ContextActivities::withCategoryActivity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
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 $parentActivity;
22
    private $groupingActivity;
23
    private $categoryActivity;
24
    private $otherActivity;
25
26
    public function __construct(Activity $parent = null, Activity $grouping = null, Activity $category = null, Activity $other = null)
27
    {
28
        $this->parentActivity = $parent;
29
        $this->groupingActivity = $grouping;
30
        $this->categoryActivity = $category;
31
        $this->otherActivity = $other;
32
    }
33
34
    public function withParentActivity(Activity $parentActivity)
35
    {
36
        $contextActivities = clone $this;
37
        $contextActivities->parentActivity = $parentActivity;
38
39
        return $contextActivities;
40
    }
41
42
    public function withGroupingActivity(Activity $groupingActivity)
43
    {
44
        $contextActivities = clone $this;
45
        $contextActivities->groupingActivity = $groupingActivity;
46
47
        return $contextActivities;
48
    }
49
50
    public function withCategoryActivity(Activity $categoryActivity)
51
    {
52
        $contextActivities = clone $this;
53
        $contextActivities->categoryActivity = $categoryActivity;
54
55
        return $contextActivities;
56
    }
57
58
    public function withOtherActivity(Activity $otherActivity)
59
    {
60
        $contextActivities = clone $this;
61
        $contextActivities->otherActivity = $otherActivity;
62
63
        return $contextActivities;
64
    }
65
66
    public function getParentActivity()
67
    {
68
        return $this->parentActivity;
69
    }
70
71
    public function getGroupingActivity()
72
    {
73
        return $this->groupingActivity;
74
    }
75
76
    public function getCategoryActivity()
77
    {
78
        return $this->categoryActivity;
79
    }
80
81
    public function getOtherActivity()
82
    {
83
        return $this->otherActivity;
84
    }
85
}
86