1 | <?php |
||
12 | class ComposerExtra |
||
13 | { |
||
14 | use PresetsAwareTrait; |
||
15 | use ComposerJsonAwareTrait; |
||
16 | |||
17 | protected $config; |
||
18 | protected $namespace; |
||
19 | protected $defaultConfig; |
||
20 | protected $presetsPath; |
||
21 | |||
22 | /** |
||
23 | * Merge configurations. |
||
24 | * |
||
25 | * @var callable |
||
26 | */ |
||
27 | public $merge = '\Schnittstabil\ConfigMerge\config_merge'; |
||
28 | |||
29 | /** |
||
30 | * Create a new ComposerExtra. |
||
31 | * |
||
32 | * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValue`. |
||
33 | * |
||
34 | * @param string|int|mixed[] $namespace a `Schnittstabil\Get\getValue` path |
||
35 | * @param mixed $defaultConfig default configuration |
||
36 | * @param string $presetsPath presets path (w/o namespace) |
||
37 | * |
||
38 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
39 | */ |
||
40 | public function __construct($namespace = array(), $defaultConfig = null, $presetsPath = null) |
||
47 | |||
48 | /** |
||
49 | * Get the configuration. |
||
50 | * |
||
51 | * @return mixed the configuration |
||
52 | */ |
||
53 | protected function getConfig() |
||
79 | |||
80 | /** |
||
81 | * Get configuration value. |
||
82 | * |
||
83 | * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValue`. |
||
84 | * |
||
85 | * @param string|int|mixed[] $path a `Schnittstabil\Get\getValue` path |
||
86 | * @param mixed $default default value if $path is not valid |
||
87 | * |
||
88 | * @return mixed the value determined by `$path` or otherwise `$default` |
||
89 | */ |
||
90 | public function get($path = array(), $default = null) |
||
94 | |||
95 | /** |
||
96 | * Get configuration value. |
||
97 | * |
||
98 | * @see https://github.com/schnittstabil/get Documentation of `Schnittstabil\Get\getValueOrFail`. |
||
99 | * |
||
100 | * @param string|int|mixed[] $path a `Schnittstabil\Get\getValueOrFail` path |
||
101 | * @param mixed $message exception message |
||
102 | * |
||
103 | * @throws \OutOfBoundsException if `$path` is not valid |
||
104 | * |
||
105 | * @return mixed the value determined by `$path` |
||
106 | */ |
||
107 | public function getOrFail($path = array(), $message = null) |
||
111 | } |
||
112 |