DeferredServicesProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A provides() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\MissingUrlsRedirector;
6
7
use Illuminate\Contracts\Foundation\Application;
8
use Arcanedev\MissingUrlsRedirector\Contracts\{RedirectorManager, RedirectorProvider};
9
use Arcanedev\Support\Providers\ServiceProvider;
10
use Illuminate\Contracts\Support\DeferrableProvider;
11
12
/**
13
 * Class     DeferredServicesProvider
14
 *
15
 * @package  Arcanedev\MissingUrlsRedirector
16
 * @author   ARCANEDEV <[email protected]>
17
 */
18
class DeferredServicesProvider extends ServiceProvider implements DeferrableProvider
19
{
20
    /* -----------------------------------------------------------------
21
     |  Main Methods
22
     | -----------------------------------------------------------------
23
     */
24
25
    /**
26
     * Register any application services.
27
     */
28 138
    public function register(): void
29
    {
30 138
        parent::register();
31
32
        $this->bind(RedirectorProvider::class, function (Application $app) {
33 120
            return $app->make($app['config']->get('missing-urls.provider'));
34 138
        });
35 138
        $this->singleton(RedirectorManager::class, MissingUrlsRedirector::class);
36 138
    }
37
38
    /**
39
     * Get the services provided by the provider.
40
     *
41
     * @return array
42
     */
43 12
    public function provides(): array
44
    {
45
        return [
46 12
            RedirectorManager::class,
47
            RedirectorProvider::class,
48
        ];
49
    }
50
}
51