BackblazeB2ServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
eloc 10
dl 0
loc 20
c 0
b 0
f 0
ccs 0
cts 16
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 13 4
A register() 0 2 1
1
<?php
2
3
namespace Gliterd\BackblazeB2;
4
5
use BackblazeB2\Client as BackblazeClient;
6
use Illuminate\Support\Facades\Storage;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Storage 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...
7
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...
8
use League\Flysystem\Filesystem;
9
use Mhetreramesh\Flysystem\BackblazeAdapter;
10
11
class BackblazeB2ServiceProvider extends ServiceProvider
12
{
13
    public function boot()
14
    {
15
        Storage::extend('b2', function ($app, $config) {
16
            if (!(
17
                isset($config['accountId']) ||
18
                isset($config['applicationKey']) ||
19
                isset($config['bucketName']))) {
20
                throw new BackblazeB2Exception('Please set all configuration keys. (accountId, applicationKey, bucketName)');
21
            }
22
            $client = new BackblazeClient($config['accountId'], $config['applicationKey']);
23
            $adapter = new BackblazeAdapter($client, $config['bucketName']);
24
25
            return new Filesystem($adapter);
26
        });
27
    }
28
29
    public function register()
30
    {
31
    }
32
}
33