1 | <?php |
||
37 | class Process |
||
38 | { |
||
39 | const STATE_RUNNING = 'running'; |
||
40 | const STATE_CANCELLED = 'cancelled'; |
||
41 | const STATE_COMPLETED = 'completed'; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $row; |
||
47 | |||
48 | /** |
||
49 | * @var QueueRepository |
||
50 | */ |
||
51 | protected $queueRepository; |
||
52 | |||
53 | /** |
||
54 | * @var ObjectManager |
||
55 | */ |
||
56 | protected $objectManager; |
||
57 | |||
58 | /** |
||
59 | * @param array $row |
||
60 | */ |
||
61 | 20 | public function __construct($row = []) |
|
67 | |||
68 | /** |
||
69 | * Returns the activity state for this process |
||
70 | * |
||
71 | * @param void |
||
72 | * @return boolean |
||
73 | */ |
||
74 | 1 | public function getActive() |
|
75 | { |
||
76 | 1 | return $this->row['active']; |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * Returns the identifier for the process |
||
81 | * |
||
82 | * @return string |
||
83 | */ |
||
84 | 15 | public function getProcess_id() |
|
88 | |||
89 | /** |
||
90 | * Returns the timestamp of the exectime for the first relevant queue item. |
||
91 | * This can be used to determine the runtime |
||
92 | * |
||
93 | * @return int |
||
94 | */ |
||
95 | 1 | public function getTimeForFirstItem() |
|
100 | |||
101 | /** |
||
102 | * Returns the timestamp of the exectime for the last relevant queue item. |
||
103 | * This can be used to determine the runtime |
||
104 | * |
||
105 | * @return int |
||
106 | */ |
||
107 | 1 | public function getTimeForLastItem() |
|
112 | |||
113 | /** |
||
114 | * Returns the difference between first and last processed item |
||
115 | * |
||
116 | * @return int |
||
117 | */ |
||
118 | 5 | public function getRuntime() |
|
122 | |||
123 | /** |
||
124 | * Returns the ttl of the process |
||
125 | * |
||
126 | * @return int |
||
127 | */ |
||
128 | 1 | public function getTTL() |
|
132 | |||
133 | /** |
||
134 | * Counts the number of items which need to be processed |
||
135 | * |
||
136 | * @return int |
||
137 | * @codeCoverageIgnore |
||
138 | */ |
||
139 | public function countItemsProcessed() |
||
143 | |||
144 | /** |
||
145 | * Counts the number of items which still need to be processed |
||
146 | * |
||
147 | * @return int |
||
148 | * @codeCoverageIgnore |
||
149 | */ |
||
150 | public function countItemsToProcess() |
||
154 | |||
155 | /** |
||
156 | * Returns the Progress of a crawling process as a percentage value |
||
157 | * |
||
158 | * @return float |
||
159 | */ |
||
160 | 5 | public function getProgress() |
|
174 | |||
175 | /** |
||
176 | * Returns the number of assigned entries |
||
177 | * |
||
178 | * @return int |
||
179 | */ |
||
180 | 1 | public function countItemsAssigned() |
|
184 | |||
185 | /** |
||
186 | * Return the processes current state |
||
187 | * |
||
188 | * @return string |
||
189 | */ |
||
190 | 4 | public function getState() |
|
201 | |||
202 | /** |
||
203 | * Returns the properties of the object as array |
||
204 | * |
||
205 | * @return array |
||
206 | */ |
||
207 | 1 | public function getRow() |
|
211 | |||
212 | /** |
||
213 | * @param array $row |
||
214 | * |
||
215 | * @return void |
||
216 | */ |
||
217 | 19 | public function setRow(array $row) |
|
221 | } |
||
222 |