ServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 28
ccs 10
cts 12
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 3 1
A register() 0 15 4
1
<?php
2
3
/*
4
 * This file is part of the godruoyi/laravel-tencent007-captcha.
5
 *
6
 * (c) Godruoyi <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled.
9
 */
10
11
namespace Godruoyi\Tencent007;
12
13
use Illuminate\Foundation\Application as LaravelApplication;
14
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
15
use Laravel\Lumen\Application as LumenApplication;
16
17
class ServiceProvider extends BaseServiceProvider
18
{
19
    /**
20
     * Boot the provider.
21
     */
22 11
    public function boot()
23
    {
24 11
    }
25
26
    /**
27
     * Register the service provider.
28
     */
29 11
    public function register()
30
    {
31 11
        $source = realpath(__DIR__.'/config.php');
32
33 11
        if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
34 11
            $this->publishes([$source => config_path('007.php')], 'laravel-007');
35
        } elseif ($this->app instanceof LumenApplication) {
0 ignored issues
show
Bug introduced by
The class Laravel\Lumen\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
36
            $this->app->configure('007');
37
        }
38
39 11
        $this->mergeConfigFrom($source, '007');
40
41 11
        $this->app->singleton(Client::class);
42 11
        $this->app->singleton('007', Client::class);
43 11
    }
44
}
45