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

SelectelServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
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