Factory   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 61
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 3

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 2
A vendorName() 0 4 1
A packageName() 0 4 1
A mandatoryOptions() 0 4 1
A optionalOptions() 0 9 1
A dimensions() 0 3 1
1
<?php
2
3
namespace Sinergi\Config;
4
5
use Interop\Config\ConfigurationTrait;
6
use Interop\Config\RequiresMandatoryOptions;
7
use Interop\Config\RequiresConfig;
8
9
class Factory implements RequiresMandatoryOptions, RequiresConfig
10
{
11
    const VENDOR_NAME = 'sinergi';
12
    const PACKAGE_NAME = 'config';
13
14
    use ConfigurationTrait;
15
16
    /**
17
     * @param array|Configuration $config
18
     * @return Collection
19
     */
20
    public function __invoke($config)
21
    {
22
        if (is_array($config)) {
23
            $config = new Configuration($config);
24
        }
25
26
        return new Collection($config);
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function vendorName()
33
    {
34
        return self::VENDOR_NAME;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function packageName()
41
    {
42
        return self::PACKAGE_NAME;
43
    }
44
45
    /**
46
     * @return string[] List with mandatory options
47
     */
48
    public function mandatoryOptions()
49
    {
50
        return [];
51
    }
52
53
    /**
54
     * @return string[] List with optional options
55
     */
56
    public function optionalOptions()
57
    {
58
        return [
59
            'path',
60
            'paths',
61
            'environment',
62
            'dotenv',
63
        ];
64
    }
65
66
    public function dimensions() {
67
        return [];
68
    }
69
}
70