OEmbedServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 2
b 0
f 0
dl 0
loc 36
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A boot() 0 6 2
A registerConfig() 0 3 1
A provides() 0 3 1
1
<?php
2
namespace Cohensive\OEmbed;
3
4
use Illuminate\Contracts\Support\DeferrableProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Contracts\Support\DeferrableProvider 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...
5
use Illuminate\Support\ServiceProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\ServiceProvider 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...
6
7
class OEmbedServiceProvider extends ServiceProvider implements DeferrableProvider
8
{
9
    /**
10
     * Boots the service provider.
11
     */
12
    public function boot(): void
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__ . '/../resources/config.php' => $this->app->configPath('oembed.php'),
17
            ], 'config');
18
        }
19
    }
20
21
    /**
22
     * Register the service provider.
23
     */
24
    public function register(): void
25
    {
26
        $this->registerConfig();
27
28
        $this->app->singleton('oembed', function ($app) {
29
            return new OEmbed($app['config']['oembed']);
30
        });
31
32
        $this->app->alias('oembed', OEmbed::class);
33
    }
34
35
    public function provides(): array
36
    {
37
        return [OEmbed::class, 'oembed'];
38
    }
39
40
    private function registerConfig(): void
41
    {
42
        $this->mergeConfigFrom(__DIR__ . '/../resources/config.php', 'oembed');
43
    }
44
}
45