1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
/* |
5
|
|
|
* The MIT License |
6
|
|
|
* |
7
|
|
|
* Copyright 2016 BCL Technologies. |
8
|
|
|
* |
9
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
10
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
11
|
|
|
* in the Software without restriction, including without limitation the rights |
12
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
14
|
|
|
* furnished to do so, subject to the following conditions: |
15
|
|
|
* |
16
|
|
|
* The above copyright notice and this permission notice shall be included in |
17
|
|
|
* all copies or substantial portions of the Software. |
18
|
|
|
* |
19
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
25
|
|
|
* THE SOFTWARE. |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
namespace Bcl\EasyPdfCloud; |
29
|
|
|
|
30
|
|
|
class JobInfo |
31
|
|
|
{ |
32
|
|
|
const STATUS_UNKNOWN = 0; |
33
|
|
|
const STATUS_WAITING = 1; |
34
|
|
|
const STATUS_COMPLETED = 2; |
35
|
|
|
const STATUS_FAILED = 3; |
36
|
|
|
const STATUS_CANCELLED = 4; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
private $jobId; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
private $workflowId; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var bool |
50
|
|
|
*/ |
51
|
|
|
private $finished; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var int |
55
|
|
|
*/ |
56
|
|
|
private $status; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var int |
60
|
|
|
*/ |
61
|
|
|
private $progress; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var JobInfoDetail |
65
|
|
|
*/ |
66
|
|
|
private $detail; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* JobInfo constructor. |
70
|
|
|
* |
71
|
|
|
* @param string $jobId |
72
|
|
|
* @param string $workflowId |
73
|
|
|
* @param bool $finished |
74
|
|
|
* @param int $status |
75
|
|
|
* @param int $progress |
76
|
|
|
* @param JobInfoDetail|null $detail |
77
|
|
|
*/ |
78
|
|
|
public function __construct(string $jobId, string $workflowId, bool $finished, int $status, int $progress, ?JobInfoDetail $detail = null) |
79
|
|
|
{ |
80
|
|
|
$this->jobId = $jobId; |
81
|
|
|
$this->workflowId = $workflowId; |
82
|
|
|
$this->finished = $finished; |
83
|
|
|
$this->status = $status; |
84
|
|
|
$this->progress = $progress; |
85
|
|
|
$this->detail = $detail; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
public function getJobId(): string |
92
|
|
|
{ |
93
|
|
|
return $this->jobId; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getWorkflowId() |
100
|
|
|
{ |
101
|
|
|
return $this->workflowId; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return int |
106
|
|
|
*/ |
107
|
|
|
public function getStatus(): int |
108
|
|
|
{ |
109
|
|
|
return $this->status; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return bool |
114
|
|
|
*/ |
115
|
|
|
public function getFinished(): bool |
116
|
|
|
{ |
117
|
|
|
return $this->finished; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return int |
122
|
|
|
*/ |
123
|
|
|
public function getProgress(): int |
124
|
|
|
{ |
125
|
|
|
return $this->progress; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return JobInfoDetail|null |
130
|
|
|
*/ |
131
|
|
|
public function getDetail(): ?JobInfoDetail |
132
|
|
|
{ |
133
|
|
|
return $this->detail; |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
|