1 | <?php |
||
30 | class Task |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * First booking of this task |
||
35 | * |
||
36 | * @var \Wicked\Timely\Entities\Booking $startBooking |
||
37 | */ |
||
38 | protected $startBooking; |
||
39 | |||
40 | /** |
||
41 | * Last booking of this task |
||
42 | * |
||
43 | * @var \Wicked\Timely\Entities\Booking $endBooking |
||
44 | */ |
||
45 | protected $endBooking; |
||
46 | |||
47 | /** |
||
48 | * Bookings within this task |
||
49 | * |
||
50 | * @var \Wicked\Timely\Entities\Booking[] $intermediateBookings |
||
51 | */ |
||
52 | protected $intermediateBookings; |
||
53 | |||
54 | /** |
||
55 | * Intermediate tasks, done within this task instance |
||
56 | * |
||
57 | * @var \Wicked\Timely\Entities\Task[] $intermediateTasks |
||
58 | */ |
||
59 | protected $intermediateTasks; |
||
60 | |||
61 | /** |
||
62 | * The task's duration |
||
63 | * |
||
64 | * @var integer $duration |
||
65 | */ |
||
66 | protected $duration; |
||
67 | |||
68 | /** |
||
69 | * Getter for the first booking of the task instance |
||
70 | * |
||
71 | * @return \Wicked\Timely\Entities\Booking |
||
72 | */ |
||
73 | public function getStartBooking() |
||
77 | |||
78 | /** |
||
79 | * Getter for the last booking of the task instance |
||
80 | * |
||
81 | * @return \Wicked\Timely\Entities\Booking |
||
82 | */ |
||
83 | public function getEndBooking() |
||
87 | |||
88 | /** |
||
89 | * Getter for the intermediate bookings |
||
90 | * |
||
91 | * @return \Wicked\Timely\Entities\Booking[] |
||
92 | */ |
||
93 | public function getIntermediateBookings() |
||
97 | |||
98 | /** |
||
99 | * Getter for the task duration |
||
100 | * |
||
101 | * @return integer |
||
102 | */ |
||
103 | public function getDuration() |
||
107 | |||
108 | /** |
||
109 | * Default constructor |
||
110 | * |
||
111 | * @param \Wicked\Timely\Entities\Booking $startBooking The first booking of the task |
||
112 | * @param \Wicked\Timely\Entities\Booking $endBooking The last booking of the task |
||
113 | * @param \Wicked\Timely\Entities\Booking[] $intermediateBookings Bookings within this task |
||
114 | */ |
||
115 | public function __construct($startBooking, $endBooking, $intermediateBookings) |
||
124 | |||
125 | /** |
||
126 | * Calculates the duration of a task by given bookings |
||
127 | * |
||
128 | * @param \Wicked\Timely\Entities\Booking $startBooking The first booking of the task |
||
129 | * @param \Wicked\Timely\Entities\Booking $endBooking The last booking of the task |
||
130 | * @param \Wicked\Timely\Entities\Booking[] $intermediateBookings Bookings within this task |
||
131 | * |
||
132 | * @return integer |
||
133 | */ |
||
134 | protected function calculateDuration($startBooking, $endBooking, array $intermediateBookings) |
||
156 | } |
||
157 |