• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

umbrellio / laravel-heavy-jobs / 26166905819

20 May 2026 01:49PM UTC coverage: 76.471% (+0.5%) from 75.956%
26166905819

Pull #18

github

m80bee
pascalgn/automerge-action v0.16.4 update
Pull Request #18: Laravel increased to 13 and PHP to 8.5.

4 of 5 new or added lines in 1 file covered. (80.0%)

143 of 187 relevant lines covered (76.47%)

40.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.3
/src/Decorators/QueueDecorator.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Umbrellio\LaravelHeavyJobs\Decorators;
6

7
use Illuminate\Contracts\Queue\Queue;
8
use Throwable;
9
use Umbrellio\LaravelHeavyJobs\Jobs\HeavyJob;
10
use Umbrellio\LaravelHeavyJobs\Jobs\ShouldStorePayload;
11

12
final class QueueDecorator implements Queue
13
{
14
    private $queue;
15

16
    public function __construct(Queue $queue)
17
    {
18
        $this->queue = $queue;
105✔
19
    }
20

21
    public function __call($name, $arguments)
22
    {
23
        return $this->queue->{$name}(...$arguments);
28✔
24
    }
25

26
    public function size($queue = null)
27
    {
NEW
28
        return $this->queue->size($queue);
×
29
    }
30

31
    public function pendingSize($queue = null)
32
    {
33
        return $this->queue->pendingSize($queue);
7✔
34
    }
35

36
    public function delayedSize($queue = null)
37
    {
38
        return $this->queue->delayedSize($queue);
7✔
39
    }
40

41
    public function reservedSize($queue = null)
42
    {
43
        return $this->queue->reservedSize($queue);
7✔
44
    }
45

46
    public function creationTimeOfOldestPendingJob($queue = null)
47
    {
48
        return $this->queue->creationTimeOfOldestPendingJob($queue);
7✔
49
    }
50

51
    public function push($job, $data = '', $queue = null)
52
    {
53
        try {
54
            $job = $this->prepareJob($job);
70✔
55

56
            return $this->queue->push($job, $data, $queue);
70✔
57
        } catch (Throwable $throwable) {
35✔
58
            $this->markJobs([$job]);
35✔
59

60
            throw $throwable;
35✔
61
        }
62
    }
63

64
    public function pushRaw($payload, $queue = null, array $options = [])
65
    {
66
        return $this->queue->pushRaw($payload, $queue, $options);
×
67
    }
68

69
    public function pushOn($queue, $job, $data = '')
70
    {
71
        try {
72
            $job = $this->prepareJob($job);
×
73

74
            return $this->queue->pushOn($queue, $job, $data);
×
75
        } catch (Throwable $throwable) {
×
76
            $this->markJobs([$job]);
×
77

78
            throw $throwable;
×
79
        }
80
    }
81

82
    public function later($delay, $job, $data = '', $queue = null)
83
    {
84
        try {
85
            $job = $this->prepareJob($job);
×
86

87
            return $this->queue->later($delay, $job, $data, $queue);
×
88
        } catch (Throwable $throwable) {
×
89
            $this->markJobs([$job]);
×
90

91
            throw $throwable;
×
92
        }
93
    }
94

95
    public function laterOn($queue, $delay, $job, $data = '')
96
    {
97
        try {
98
            $job = $this->prepareJob($job);
×
99

100
            return $this->queue->laterOn($queue, $delay, $job, $data);
×
101
        } catch (Throwable $throwable) {
×
102
            $this->markJobs([$job]);
×
103

104
            throw $throwable;
×
105
        }
106
    }
107

108
    public function bulk($jobs, $data = '', $queue = null)
109
    {
110
        try {
111
            $jobs = $this->prepareJobs($jobs);
×
112

113
            return $this->queue->bulk($jobs, $data, $queue);
×
114
        } catch (Throwable $throwable) {
×
115
            $this->markJobs($jobs);
×
116

117
            throw $throwable;
×
118
        }
119
    }
120

121
    public function pop($queue = null)
122
    {
123
        return $this->queue->pop($queue);
×
124
    }
125

126
    public function getConnectionName(): string
127
    {
128
        return $this->queue->getConnectionName();
×
129
    }
130

131
    public function setConnectionName($name): self
132
    {
133
        $this->queue->setConnectionName($name);
×
134

135
        return $this;
×
136
    }
137

138
    private function prepareJob($job)
139
    {
140
        if (
141
            $job instanceof ShouldStorePayload &&
70✔
142
            (!method_exists($job, 'isHeavyJobsEnabled') || $job->isHeavyJobsEnabled())
70✔
143
        ) {
144
            return new HeavyJob($job);
63✔
145
        }
146

147
        return $job;
14✔
148
    }
149

150
    private function markJobs(array $jobs): void
151
    {
152
        foreach ($jobs as $job) {
35✔
153
            if ($job instanceof HeavyJob) {
35✔
154
                $job->handlePayloadRemove();
35✔
155
            }
156
        }
157
    }
158

159
    private function prepareJobs($jobs): array
160
    {
161
        return array_map(function ($job) {
×
162
            return $this->prepareJob($job);
×
163
        }, $jobs);
×
164
    }
165
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc