Completed
Branch master (9dff9d)
by Albert
05:30
created

SwooleTaskConnector::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SwooleTW\Http\Task\Connectors;
4
5
use SwooleTW\Http\Task\SwooleTaskQueue;
6
use Illuminate\Queue\Connectors\ConnectorInterface;
7
8
class SwooleTaskConnector implements ConnectorInterface
9
{
10
    /**
11
     * Swoole Server Instance
12
     *
13
     * @var \Swoole\Http\Server
14
     */
15
    protected $swoole;
16
17
     /**
18
     * Create a new Swoole Async task connector instance.
19
     *
20
     * @param  \Swoole\Http\Server $swoole
21
     * @return void
22
     */
23
    public function __construct($swoole)
24
    {
25
        $this->swoole = $swoole;
26
    }
27
28
    /**
29
     * Establish a queue connection.
30
     *
31
     * @param  array  $config
32
     * @return \Illuminate\Contracts\Queue\Queue
33
     */
34
    public function connect(array $config)
35
    {
36
        return new SwooleTaskQueue($this->swoole);
37
    }
38
}
39