Projekt

Obecné

Profil

Stáhnout (1.31 KB) Statistiky
| Větev: | Revize:
1
<?php
2

    
3
namespace Illuminate\Queue;
4

    
5
use Illuminate\Contracts\Queue\Job as JobContract;
6

    
7
trait InteractsWithQueue
8
{
9
    /**
10
     * The underlying queue job instance.
11
     *
12
     * @var \Illuminate\Contracts\Queue\Job
13
     */
14
    protected $job;
15

    
16
    /**
17
     * Get the number of times the job has been attempted.
18
     *
19
     * @return int
20
     */
21
    public function attempts()
22
    {
23
        return $this->job ? $this->job->attempts() : 1;
24
    }
25

    
26
    /**
27
     * Delete the job from the queue.
28
     *
29
     * @return void
30
     */
31
    public function delete()
32
    {
33
        if ($this->job) {
34
            return $this->job->delete();
35
        }
36
    }
37

    
38
    /**
39
     * Fail the job from the queue.
40
     *
41
     * @return void
42
     */
43
    public function failed()
44
    {
45
        if ($this->job) {
46
            return $this->job->failed();
47
        }
48
    }
49

    
50
    /**
51
     * Release the job back into the queue.
52
     *
53
     * @param  int   $delay
54
     * @return void
55
     */
56
    public function release($delay = 0)
57
    {
58
        if ($this->job) {
59
            return $this->job->release($delay);
60
        }
61
    }
62

    
63
    /**
64
     * Set the base queue job instance.
65
     *
66
     * @param  \Illuminate\Contracts\Queue\Job  $job
67
     * @return $this
68
     */
69
    public function setJob(JobContract $job)
70
    {
71
        $this->job = $job;
72

    
73
        return $this;
74
    }
75
}
(6-6/18)