Completed
Pull Request — master (#4)
by Neo
02:47
created

QueueServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerConnectors() 0 6 2
A registerSqsFifoConnector() 0 6 1
1
<?php
2
/*
3
 * This file is part of the Laravel Lodash package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
declare(strict_types=1);
11
12
namespace Longman\LaravelLodash\Queue;
13
14
use Illuminate\Queue\QueueManager;
15
use Illuminate\Queue\QueueServiceProvider as BaseQueueServiceProvider;
16
use Longman\LaravelLodash\Queue\SqsFifo\Connectors\SqsFifoConnector;
17
18
class QueueServiceProvider extends BaseQueueServiceProvider
19
{
20
    /**
21
     * Register the connectors on the queue manager.
22
     *
23
     * @param  \Illuminate\Queue\QueueManager $manager
24
     * @return void
25
     */
26
    public function registerConnectors($manager)
27
    {
28
        foreach (['Null', 'Sync', 'Database', 'Redis', 'Beanstalkd', 'Sqs', 'SqsFifo'] as $connector) {
29
            $this->{"register{$connector}Connector"}($manager);
30
        }
31
    }
32
33
    protected function registerSqsFifoConnector(QueueManager $manager): void
34
    {
35
        $manager->addConnector('sqs.fifo', function (): SqsFifoConnector {
36
            return new SqsFifoConnector();
37
        });
38
    }
39
}
40