ConfiguredService   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 6 2
A queryURISpace() 0 6 2
1
<?php declare(strict_types = 1);
2
3
namespace JSKOS;
4
5
/**
6
 * This subclass of JSKOS\Service contains service configuration to
7
 * to configure an URISpaceService among other settings.
8
 */
9
abstract class ConfiguredService extends Service
10
{
11
    protected $config = [];
12
13
    private $uriSpaceService;
14
15
    public function __construct(array $config=[])
16
    {
17
        $this->configure($config);
18
    }
19
20
    public function configure(array $config)
21
    {
22
        $this->config = $config;
23
        $this->uriSpaceService = isset($config['_uriSpace'])
24
            ? new URISpaceService($config['_uriSpace']) : null;
25
    }
26
27
    public function queryURISpace(array $query=[], string $path=''): Result
28
    {
29
        return $this->uriSpaceService 
30
            ? $this->uriSpaceService->query($query, $path) 
31
            : new Result();
32
    }
33
}
34