Completed
Push — master ( 51e0cc...3b6349 )
by GIT
04:52
created

GanttTask   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 94.87%

Importance

Changes 0
Metric Value
wmc 18
lcom 1
cbo 0
dl 0
loc 85
ccs 37
cts 39
cp 0.9487
rs 10
c 0
b 0
f 0

13 Methods

Rating   Name   Duplication   Size   Complexity  
A setTitle() 0 3 1
A getTitle() 0 3 1
A setID() 0 3 1
A getID() 0 3 1
A setStatus() 0 3 1
A setPriority() 0 3 1
A setTaskParam() 0 18 6
A getStatus() 0 3 1
A getPriority() 0 3 1
A setStartDate() 0 3 1
A getStartDate() 0 3 1
A setEndDate() 0 3 1
A getEndDate() 0 3 1
1
<?php
2
/**
3
 * File holding the GanttTask class
4
 *
5
 * Creates Tasks with params
6
 *
7
 * @author Sebastian Schmid
8
 * @file
9
 * @ingroup SemanticResultFormats
10
 */
11
12
namespace SRF\Gantt;
13
14
15
class GanttTask {
16
17
	private $mTitle;
18
	private $mID;
19
	private $mStatus = '';
20
	private $mPriority = '';
21
	private $mStartDate;
22
	private $mEndDate;
23
24
25 1
	public function setTitle( $title ) {
26 1
		$this->mTitle = $title;
27 1
	}
28
29 1
	public function getTitle() {
30 1
		return $this->mTitle;
31
	}
32
33 1
	public function setID( $id ) {
34 1
		$this->mID = $id;
35 1
	}
36
37
	public function getID() {
38
		return $this->mID;
39
	}
40
41 1
	public function setStatus($status){
42 1
		$this->mStatus = $this->mStatus . $status . ', ';
43 1
	}
44
45 1
	public function setPriority($priority){
46 1
		$this->mPriority = $this->mPriority . $priority . ', ';
47 1
	}
48
49
	/**
50
	 * Either set the status or priority of the task
51
	 *
52
	 * @param array $params
53
	 * @param string $paramMapping
54
	 * @param string $type
55
	 *
56
	 */
57 1
	public function setTaskParam( $params, $paramMapping, $type ) {
58
59
		// skip if $paramMapping is empty and
60
		// output errormessage if wrong mapping
61 1
		if ( !empty( $paramMapping ) ) {
62
63 1
			foreach ( $paramMapping as $pKey => $pVal ) {
0 ignored issues
show
Bug introduced by
The expression $paramMapping of type string is not traversable.
Loading history...
64 1
				if ( in_array( $pKey, $params ) ) {
65 1
					if ( $type === 'status' ) {
66 1
						$this->setStatus( trim( $pVal ) );
67
					}
68 1
					if ( $type === 'priority' ) {
69 1
						$this->setPriority( trim( $pVal ) );
70
					}
71
				}
72
			}
73
		}
74 1
	}
75
76 1
	public function getStatus() {
77 1
		return $this->mStatus;
78
	}
79
80 1
	public function getPriority() {
81 1
		return $this->mPriority;
82
	}
83
84 1
	public function setStartDate( $startDate ) {
85 1
		$this->mStartDate = $startDate;
86 1
	}
87
88 1
	public function getStartDate() {
89 1
		return $this->mStartDate;
90
	}
91
92 1
	public function setEndDate( $endDate ) {
93 1
		$this->mEndDate = $endDate;
94 1
	}
95
96 1
	public function getEndDate() {
97 1
		return $this->mEndDate;
98
	}
99
}