PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backup, Restore, Migration & Clone / 3.3.1
WP STAGING – WordPress Backup, Restore, Migration & Clone v3.3.1
4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Backup / Dto / TaskResponseDto.php
wp-staging / Backup / Dto Last commit date
Interfaces 2 years ago Job 2 years ago Service 2 years ago Task 2 years ago Traits 2 years ago AbstractDto.php 3 years ago AbstractTaskDto.php 2 years ago JobDataDto.php 2 years ago StepsDto.php 2 years ago TaskResponseDto.php 2 years ago
TaskResponseDto.php
234 lines
1 <?php
2
3 // TODO PHP7.x; declare(strict_type=1);
4 // TODO PHP7.x; type hints & return types
5
6 namespace WPStaging\Backup\Dto;
7
8 use WPStaging\Framework\Traits\ArrayableTrait;
9
10 class TaskResponseDto extends AbstractDto
11 {
12 use ArrayableTrait {
13 toArray as traitToArray;
14 }
15
16 /** @var bool */
17 protected $isRunning;
18
19 /** @var string */
20 protected $jobStatus;
21
22 /** @var int */
23 protected $percentage;
24
25 /** @var int */
26 protected $total;
27
28 /** @var int */
29 protected $step;
30
31 /** @var string */
32 protected $task;
33
34 /** @var string */
35 protected $job;
36
37 /** @var string */
38 protected $statusTitle;
39
40 /** @var array */
41 protected $messages;
42
43 /** @var string */
44 protected $jobId;
45
46 /**
47 * @return array<string, mixed>
48 */
49 public function toArray()
50 {
51 $data = $this->traitToArray();
52
53 $lastMsg = null;
54 if ($data['messages']) {
55 $lastMsg = end($data['messages']);
56 }
57
58 // TODO REF: Remove
59 $data['last_msg'] = $lastMsg;
60 $data['isForceSave'] = true;
61 $data['job_done'] = !$data['isRunning'];
62 return $data;
63 }
64
65 /**
66 * @param string $message
67 */
68 public function addMessage($message)
69 {
70 if (!is_array($this->messages)) {
71 $this->messages = [];
72 }
73
74 $this->messages[] = $message;
75 }
76
77 /**
78 * @return bool
79 */
80 public function isRunning()
81 {
82 return $this->isRunning;
83 }
84
85 /**
86 * @param bool $isRunning
87 */
88 public function setIsRunning($isRunning)
89 {
90 $this->isRunning = $isRunning;
91 }
92
93 /**
94 * @param string $jobStatus
95 */
96 public function setJobStatus($jobStatus)
97 {
98 $this->jobStatus = $jobStatus;
99 }
100
101 /**
102 * @return string
103 */
104 public function getJobStatus()
105 {
106 return $this->jobStatus;
107 }
108
109 /**
110 * @return int
111 */
112 public function getPercentage()
113 {
114 return $this->percentage;
115 }
116
117 /**
118 * @param int $percentage
119 */
120 public function setPercentage($percentage)
121 {
122 $this->percentage = $percentage;
123 }
124
125 /**
126 * @return int
127 */
128 public function getTotal()
129 {
130 return $this->total;
131 }
132
133 /**
134 * @param int $total
135 */
136 public function setTotal($total)
137 {
138 $this->total = $total;
139 }
140
141 /**
142 * @return int
143 */
144 public function getStep()
145 {
146 return $this->step;
147 }
148
149 /**
150 * @param int $step
151 */
152 public function setStep($step)
153 {
154 $this->step = $step;
155 }
156
157 /**
158 * @return string
159 */
160 public function getTask()
161 {
162 return $this->task;
163 }
164
165 /**
166 * @param string $task
167 */
168 public function setTask($task)
169 {
170 $this->task = $task;
171 }
172
173 /**
174 * @return string
175 */
176 public function getJob()
177 {
178 return $this->job;
179 }
180
181 /**
182 * @param string $job
183 */
184 public function setJob($job)
185 {
186 $this->job = $job;
187 }
188
189 /**
190 * @return string
191 */
192 public function getStatusTitle()
193 {
194 return $this->statusTitle;
195 }
196
197 /**
198 * @param string $statusTitle
199 */
200 public function setStatusTitle($statusTitle)
201 {
202 $this->statusTitle = $statusTitle;
203 }
204
205 /**
206 * @return array
207 */
208 public function getMessages()
209 {
210 return $this->messages;
211 }
212
213 public function setMessages(array $messages)
214 {
215 $this->messages = $messages;
216 }
217
218 /**
219 * @return string
220 */
221 public function getJobId()
222 {
223 return $this->jobId;
224 }
225
226 /**
227 * @param string $jobId
228 */
229 public function setJobId($jobId)
230 {
231 $this->jobId = $jobId;
232 }
233 }
234