BatchJob   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 28
ccs 3
cts 5
cp 0.6
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A release() 0 9 2
1
<?php
2
/**
3
 * Laravel Queue for AWS Batch.
4
 *
5
 * @author    Luke Waite <[email protected]>
6
 * @copyright 2017 Luke Waite
7
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
8
 *
9
 * @link      https://github.com/dnxlabs/laravel-queue-aws-batch
10
 */
11
12
namespace DNXLabs\LaravelQueueAwsBatch\Jobs;
13
14
use Illuminate\Queue\Jobs\DatabaseJob;
15
use DNXLabs\LaravelQueueAwsBatch\Exceptions\UnsupportedException;
16
17
class BatchJob extends DatabaseJob
18
{
19
    /**
20
     * The database queue instance.
21
     *
22
     * @var \DNXLabs\LaravelQueueAwsBatch\Queues\BatchQueue
23
     */
24
    protected $database;
25
26
    /**
27
     * Release the job back into the queue.
28
     *
29
     * Here we need to retain the same jobId, so Batch can retry it, so we need to override the parent.
30
     *
31
     * @param int $delay
32
     *
33
     * @return void
34
     * @throws UnsupportedException
35
     */
36 1
    public function release($delay = 0)
37
    {
38 1
        if ($delay != 0) {
39 1
            throw new UnsupportedException('The BatchJob does not support releasing back onto the queue with a delay');
40
        }
41
42
        $this->released = true;
43
44
        $this->database->release($this->queue, $this->job, 0);
45
    }
46
}
47