LaravelQueueCMQServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 30
ccs 0
cts 13
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 2
A boot() 0 7 1
1
<?php
2
3
namespace Freyo\LaravelQueueCMQ;
4
5
use Freyo\LaravelQueueCMQ\Queue\Connectors\CMQConnector;
6
use Illuminate\Queue\QueueManager;
7
use Illuminate\Support\ServiceProvider;
8
use Laravel\Lumen\Application as LumenApplication;
0 ignored issues
show
Bug introduced by
The type Laravel\Lumen\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
class LaravelQueueCMQServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Register the service provider.
14
     *
15
     * @return void
16
     */
17
    public function register()
18
    {
19
        if ($this->app instanceof LumenApplication) {
20
            $this->app->configure('queue');
0 ignored issues
show
Bug introduced by
The method configure() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean configPath()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
            $this->app->/** @scrutinizer ignore-call */ 
21
                        configure('queue');

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
        }
22
23
        $this->mergeConfigFrom(
24
            __DIR__.'/../config/cmq.php', 'queue.connections.cmq'
25
        );
26
    }
27
28
    /**
29
     * Register the application's event listeners.
30
     *
31
     * @return void
32
     */
33
    public function boot()
34
    {
35
        /** @var QueueManager $queue */
36
        $queue = $this->app['queue'];
37
38
        $queue->addConnector('cmq', function () {
39
            return new CMQConnector();
40
        });
41
    }
42
}
43