CloudFrontServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 59
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A registerAliases() 0 3 1
A boot() 0 6 2
A register() 0 7 1
A provides() 0 4 1
A registerCloudFrontManager() 0 4 1
1
<?php
2
3
namespace Meema\CloudFront\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Meema\CloudFront\CloudFrontManager;
7
use Meema\CloudFront\Facades\CloudFront;
8
9
class CloudFrontServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application services.
13
     *
14
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
15
     */
16
    public function boot()
17
    {
18
        if ($this->app->runningInConsole()) {
19
            $this->publishes([
20
                __DIR__.'/../../config/config.php' => config_path('cloudfront.php'),
21
            ], 'config');
22
        }
23
    }
24
25
    /**
26
     * Register the application services.
27
     */
28
    public function register()
29
    {
30
        $this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'media-convert');
31
32
        $this->registerCloudFrontManager();
33
34
        $this->registerAliases();
35
    }
36
37
    /**
38
     * Registers the Text to speech manager.
39
     *
40
     * @return void
41
     */
42
    protected function registerCloudFrontManager()
43
    {
44
        $this->app->singleton('cloudfront', function ($app) {
45
            return new CloudFrontManager($app);
46
        });
47
    }
48
49
    /**
50
     * Register aliases.
51
     *
52
     * @return void
53
     */
54
    protected function registerAliases()
55
    {
56
        $this->app->alias(CloudFront::class, 'CloudFront');
57
    }
58
59
    /**
60
     * Get the services provided by the provider.
61
     *
62
     * @return array
63
     */
64
    public function provides(): array
65
    {
66
        return [
67
            'cloudfront',
68
        ];
69
    }
70
}
71