Completed
Push — master ( abe227...316baf )
by Raffael
13:55 queued 08:01
created

Factory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 22
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 16 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * tubee.io
7
 *
8
 * @copyright   Copryright (c) 2017-2019 gyselroth GmbH (https://gyselroth.com)
9
 * @license     GPL-3.0 https://opensource.org/licenses/GPL-3.0
10
 */
11
12
namespace Tubee\Endpoint\Ucs;
13
14
use GuzzleHttp\Client;
15
use Psr\Log\LoggerInterface;
16
use Tubee\Collection\CollectionInterface;
17
use Tubee\Endpoint\EndpointInterface;
18
use Tubee\Endpoint\Ucs;
19
use Tubee\Workflow\Factory as WorkflowFactory;
20
21
class Factory
22
{
23
    /**
24
     * Build instance.
25
     */
26
    public static function build(array $resource, CollectionInterface $collection, WorkflowFactory $workflow_factory, LoggerInterface $logger): EndpointInterface
27
    {
28
        $options = [
29
            'base_uri' => $resource['data']['resource']['base_uri'],
30
        ];
31
32
        $options = array_merge($resource['data']['resource']['request_options'], $options);
33
        $options += [
34
            'cookies' => true,
35
            'http_errors' => true,
36
        ];
37
38
        $client = new Client($options);
39
40
        return new Ucs($resource['name'], $resource['data']['type'], $resource['data']['resource']['flavor'], $client, $collection, $workflow_factory, $logger, $resource);
41
    }
42
}
43