5124ea1fcb211ceb645a770f38def6731cf4cbdf
[yaffs-website] / vendor / consolidation / config / src / ConfigInterface.php
1 <?php
2 namespace Consolidation\Config;
3
4 interface ConfigInterface
5 {
6     /**
7      * Determine if a non-default config value exists.
8      */
9     public function has($key);
10
11     /**
12      * Fetch a configuration value
13      *
14      * @param string $key Which config item to look up
15      * @param string|null $defaultFallback Fallback default value to use when
16      *   configuration object has neither a value nor a default. Use is
17      *   discouraged; use default context in ConfigOverlay, or provide defaults
18      *   using a config processor.
19      *
20      * @return mixed
21      */
22     public function get($key, $defaultFallback = null);
23
24     /**
25      * Set a config value
26      *
27      * @param string $key
28      * @param mixed $value
29      *
30      * @return $this
31      */
32     public function set($key, $value);
33
34     /**
35      * Import configuration from the provided nexted array, replacing whatever
36      * was here previously. No processing is done on the provided data.
37      *
38      * @deprecated Use 'replace'. Dflydev\DotAccessData\Data::import() merges, which is confusing, since this method replaces.
39      *
40      * @param array $data
41      * @return Config
42      */
43     public function import($data);
44
45     /**
46      * Load configuration from the provided nexted array, replacing whatever
47      * was here previously. No processing is done on the provided data.
48      *
49      * TODO: This will become a required method in version 2.0. Adding now
50      * would break clients that implement ConfigInterface.
51      *
52      * @param array $data
53      * @return Config
54      */
55     // public function replace($data);
56
57     /**
58      * Import configuration from the provided nexted array, merging with whatever
59      * was here previously. No processing is done on the provided data.
60      * Any data provided to the combine() method will overwrite existing data
61      * with the same key.
62      *
63      * TODO: This will become a required method in version 2.0. Adding now
64      * would break clients that implement ConfigInterface.
65      *
66      * @param array $data
67      * @return Config
68      */
69     // public function combine($data);
70
71     /**
72      * Export all configuration as a nested array.
73      */
74     public function export();
75
76     /**
77      * Return the default value for a given configuration item.
78      *
79      * @param string $key
80      *
81      * @return mixed
82      */
83     public function hasDefault($key);
84
85     /**
86      * Return the default value for a given configuration item.
87      *
88      * @param string $key
89      * @param mixed $defaultFallback
90      *
91      * @return mixed
92      */
93     public function getDefault($key, $defaultFallback = null);
94
95     /**
96      * Set the default value for a configuration setting. This allows us to
97      * set defaults either before or after more specific configuration values
98      * are loaded. Keeping defaults separate from current settings also
99      * allows us to determine when a setting has been overridden.
100      *
101      * @param string $key
102      * @param string $value
103      */
104     public function setDefault($key, $value);
105 }