1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* \Wicked\Timely\Entities\Pause |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Bernhard Wick <[email protected]> |
15
|
|
|
* @copyright 2016 Bernhard Wick |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/wick-ed/timely |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Wicked\Timely\Entities; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Pause entity |
24
|
|
|
* |
25
|
|
|
* @author Bernhard Wick <[email protected]> |
26
|
|
|
* @copyright 2016 Bernhard Wick |
27
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
28
|
|
|
* @link https://github.com/wick-ed/timely |
29
|
|
|
*/ |
30
|
|
|
class Pause extends Booking |
31
|
|
|
{ |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Constant for the pause start tag |
35
|
|
|
* |
36
|
|
|
* @var string PAUSE_TAG_START |
37
|
|
|
*/ |
38
|
|
|
const PAUSE_TAG_START = '--ps--'; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Constant for the pause end tag |
42
|
|
|
* |
43
|
|
|
* @var string PAUSE_TAG_END |
44
|
|
|
*/ |
45
|
|
|
const PAUSE_TAG_END = '--pe--'; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Default constructor |
49
|
|
|
* |
50
|
|
|
* @param string $comment Comment for the pause |
51
|
|
|
* @param boolean $resuming Whether or not the pause has ended |
52
|
|
|
* @param null|string $time Time of this booking |
53
|
|
|
*/ |
54
|
|
|
public function __construct($comment = '', $resuming = false, $time = null) |
55
|
|
|
{ |
56
|
|
|
// add the pause tags as special meta ticket IDs |
57
|
|
|
$this->metaTicketIds[] = self::PAUSE_TAG_START; |
58
|
|
|
$this->metaTicketIds[] = self::PAUSE_TAG_END; |
59
|
|
|
|
60
|
|
|
if ($resuming === true) { |
61
|
|
|
parent::__construct($comment, self::PAUSE_TAG_END, $time); |
62
|
|
|
} else { |
63
|
|
|
parent::__construct($comment, self::PAUSE_TAG_START, $time); |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Whether or not this booking can be the start of a task |
69
|
|
|
* |
70
|
|
|
* @param boolean $includePause Whether or not pauses are included as task building bookings |
|
|
|
|
71
|
|
|
* |
72
|
|
|
* @return boolean |
73
|
|
|
*/ |
74
|
|
|
public function isPauseEnd() |
75
|
|
|
{ |
76
|
|
|
return $this->getTicketId() === static::PAUSE_TAG_END; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* Whether or not this booking can be the start of a task |
81
|
|
|
* |
82
|
|
|
* @param boolean $includePause Whether or not pauses are included as task building bookings |
83
|
|
|
* |
84
|
|
|
* @return boolean |
85
|
|
|
*/ |
86
|
|
|
public function canStartTask($includePause = false) |
87
|
|
|
{ |
88
|
|
|
if ($includePause) { |
89
|
|
|
return $this->getTicketId() === self::PAUSE_TAG_START; |
90
|
|
|
} |
91
|
|
|
return false; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Whether or not this booking can be the end of a task |
96
|
|
|
* |
97
|
|
|
* @param boolean $includePause Whether or not pauses are included as task building bookings |
98
|
|
|
* |
99
|
|
|
* @return boolean |
100
|
|
|
*/ |
101
|
|
|
public function canEndTask($includePause = false) |
102
|
|
|
{ |
103
|
|
|
if ($includePause) { |
104
|
|
|
return $this->getTicketId() === self::PAUSE_TAG_END; |
105
|
|
|
} |
106
|
|
|
return false; |
107
|
|
|
} |
108
|
|
|
} |
109
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.