-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFactory.php
83 lines (69 loc) · 1.61 KB
/
Factory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/**
* Qubus\Config
*
* @link https://github.com/QubusPHP/config
* @copyright 2020 Joshua Parker <[email protected]>
* @copyright 2016 Sinergi
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
declare(strict_types=1);
namespace Qubus\Config;
use Interop\Config\ConfigurationTrait;
use Interop\Config\RequiresConfig;
use Interop\Config\RequiresMandatoryOptions;
use function is_array;
class Factory implements RequiresMandatoryOptions, RequiresConfig
{
use ConfigurationTrait;
public const VENDOR_NAME = 'qubus';
public const PACKAGE_NAME = 'config';
/**
* @param array|Configuration $config
* @return Collection
*/
public function __invoke(array|Configuration $config): Collection
{
if (is_array($config)) {
$config = new Configuration($config);
}
return new Collection($config);
}
/**
* @return string
*/
public function vendorName(): string
{
return self::VENDOR_NAME;
}
/**
* @return string
*/
public function packageName(): string
{
return self::PACKAGE_NAME;
}
/**
* @return string[] List with mandatory options
*/
public function mandatoryOptions(): iterable
{
return [];
}
/**
* @return string[] List with optional options
*/
public function optionalOptions(): array
{
return [
'path',
'paths',
'environment',
'dotenv',
];
}
public function dimensions(): iterable
{
return [];
}
}