Completed
Push — master ( 6dc7d8...407c40 )
by Karsten
15:45
created

formats/Gantt/src/GanttTask.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
	public function setTitle( $title ) {
26
		$this->mTitle = $title;
27
	}
28
29
	public function getTitle() {
30
		return $this->mTitle;
31
	}
32
33
	public function setID( $id ) {
34
		$this->mID = $id;
35
	}
36
37
	public function getID() {
38
		return $this->mID;
39
	}
40
41
	public function setStatus($status){
42
		$this->mStatus = $this->mStatus . $status . ', ';
43
	}
44
45
	public function setPriority($priority){
46
		$this->mPriority = $this->mPriority . $priority . ', ';
47
	}
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
	public function setTaskParam( $params, $paramMapping, $type ) {
58
59
		// skip if $paramMapping is empty and
60
		// output errormessage if wrong mapping
61
		if ( !empty( $paramMapping ) ) {
62
63
			foreach ( $paramMapping as $pKey => $pVal ) {
0 ignored issues
show
The expression $paramMapping of type string is not traversable.
Loading history...
64
				if ( in_array( $pKey, $params ) ) {
65
					if ( $type === 'status' ) {
66
						$this->setStatus( trim( $pVal ) );
67
					}
68
					if ( $type === 'priority' ) {
69
						$this->setPriority( trim( $pVal ) );
70
					}
71
				}
72
			}
73
		}
74
	}
75
76
	public function getStatus() {
77
		return $this->mStatus;
78
	}
79
80
	public function getPriority() {
81
		return $this->mPriority;
82
	}
83
84
	public function setStartDate( $startDate ) {
85
		$this->mStartDate = $startDate;
86
	}
87
88
	public function getStartDate() {
89
		return $this->mStartDate;
90
	}
91
92
	public function setEndDate( $endDate ) {
93
		$this->mEndDate = $endDate;
94
	}
95
96
	public function getEndDate() {
97
		return $this->mEndDate;
98
	}
99
}