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

ContextActivities   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 9
c 1
b 0
f 1
lcom 4
cbo 0
dl 0
loc 67
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A withParent() 0 7 1
A withGrouping() 0 7 1
A withCategory() 0 7 1
A withOther() 0 7 1
A getParent() 0 4 1
A getGrouping() 0 4 1
A getCategory() 0 4 1
A getOther() 0 4 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 $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