Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
DuplicateJob | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
newFromJob | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
6 | |||
run | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | /** |
22 | * No-op job that does nothing. |
23 | * |
24 | * This is used by JobQueue::pop to temporarily represent duplicates. |
25 | * |
26 | * @internal |
27 | * @ingroup JobQueue |
28 | */ |
29 | final class DuplicateJob extends Job implements GenericParameterJob { |
30 | /** |
31 | * Callers should use DuplicateJob::newFromJob() instead |
32 | * |
33 | * @param array $params Job parameters |
34 | */ |
35 | public function __construct( array $params ) { |
36 | parent::__construct( 'duplicate', $params ); |
37 | } |
38 | |
39 | /** |
40 | * Get a duplicate no-op version of a job |
41 | * |
42 | * @param RunnableJob $job |
43 | * @return Job |
44 | */ |
45 | public static function newFromJob( RunnableJob $job ) { |
46 | $djob = new self( $job->getParams() ); |
47 | $djob->command = $job->getType(); |
48 | $djob->params = is_array( $djob->params ) ? $djob->params : []; |
49 | $djob->params = [ 'isDuplicate' => true ] + $djob->params; |
50 | $djob->metadata = $job->getMetadata(); |
51 | |
52 | return $djob; |
53 | } |
54 | |
55 | public function run() { |
56 | return true; |
57 | } |
58 | } |