Test Failed
Push — master ( 892598...558941 )
by Antonio Carlos
11:17
created

Queue   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A check() 0 23 2
A gatherWorkerOptions() 0 4 1
1
<?php
2
3
namespace PragmaRX\Health\Checkers;
4
5
use Illuminate\Queue\Worker;
6
use Queue as IlluminateQueue;
7
use Illuminate\Queue\WorkerOptions;
8
use PragmaRX\Health\Support\Result;
9
10
class Queue extends Base
11
{
12
    /**
13
     * Check resource.
14
     *
15
     * @return Result
16
     */
17 1
    public function check()
18
    {
19 1
        IlluminateQueue::pushOn(
20 1
            $this->target->name,
21 1
            instantiate($this->target->testJob)
0 ignored issues
show
Bug introduced by
The property testJob does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
22
        );
23
24 1
        $worker = instantiate(Worker::class);
25
26 1
        $connection = $this->target->connection
0 ignored issues
show
Bug introduced by
The property connection does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
27 1
            ?: app('config')['queue.default'];
28
29 1
        $queue = app('config')->get(
30 1
            "queue.connections.{$connection}.queue",
31 1
            'default'
32
        );
33
34 1
        $worker->setCache(instantiate($this->target->cacheInstance)->driver());
0 ignored issues
show
Bug introduced by
The property cacheInstance does not seem to exist in PragmaRX\Health\Support\Target.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
35
36 1
        $worker->runNextJob($connection, $queue, $this->gatherWorkerOptions());
37
38 1
        return $this->makeResult(true);
39
    }
40
41
    /**
42
     * Gather all of the queue worker options as a single object.
43
     *
44
     * @return \Illuminate\Queue\WorkerOptions
45
     */
46 1
    protected function gatherWorkerOptions()
47
    {
48 1
        return new WorkerOptions(0, 0, 0, 0, 0, false);
49
    }
50
}
51