Completed
Push — master ( 4cb76b...bae4b1 )
by Timur
01:49
created

SelectelServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 4 1
1
<?php
2
3
namespace ArgentCrusade\Flysystem\Selectel;
4
5
use League\Flysystem\Filesystem;
6
use Illuminate\Support\Facades\Storage;
7
use Illuminate\Support\ServiceProvider;
8
use ArgentCrusade\Selectel\CloudStorage\CloudStorage;
9
use ArgentCrusade\Selectel\CloudStorage\Api\ApiClient;
10
11
class SelectelServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application services.
15
     */
16
    public function boot()
17
    {
18
        Storage::extend('selectel', function ($app, $config) {
19
            $api = new ApiClient($config['username'], $config['password']);
20
            $storage = new CloudStorage($api);
21
            $container = $storage->getContainer($config['container']);
22
23
            return new Filesystem(new SelectelAdapter($container));
24
        });
25
    }
26
27
    /**
28
     * Register the application services.
29
     */
30
    public function register()
31
    {
32
        //
33
    }
34
}
35