AzureAdapterFactory   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11FlySystem\Adaptor;
5
6
use League\Flysystem\Azure\AzureAdapter;
7
use MicrosoftAzure\Storage\Common\ServicesBuilder;
8
use WShafer\PSR11FlySystem\FactoryInterface;
9
10
class AzureAdapterFactory implements FactoryInterface
11
{
12 1
    public function __invoke(array $options)
13
    {
14 1
        $accountName = $options['accountName'] ?? null;
15 1
        $apiKey = $options['apiKey'] ?? null;
16 1
        $container = $options['container'] ?? null;
17 1
        $prefix = $options['prefix'] ?? null;
18
19 1
        $endpoint = sprintf('DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s', $accountName, $apiKey);
20
21 1
        $proxy = ServicesBuilder::getInstance()->createBlobService($endpoint);
22 1
        return new AzureAdapter($proxy, $container, $prefix);
23
    }
24
}
25