1 | <?php |
||
9 | class Config { |
||
10 | |||
11 | /** |
||
12 | * All of the configuration items. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $items = []; |
||
17 | |||
18 | /** |
||
19 | * Create a new configuration repository. |
||
20 | * |
||
21 | * @param array $items |
||
22 | * @return void |
||
|
|||
23 | */ |
||
24 | public function __construct(array $items = []) |
||
28 | |||
29 | /** |
||
30 | * Determine if the given configuration value exists. |
||
31 | * |
||
32 | * @param string $key |
||
33 | * @return bool |
||
34 | */ |
||
35 | public function has($key) |
||
39 | |||
40 | /** |
||
41 | * Get the specified configuration value. |
||
42 | * |
||
43 | * @param string $key |
||
44 | * @param mixed $default |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function get($key, $default = null) |
||
51 | |||
52 | /** |
||
53 | * Set a given configuration value. |
||
54 | * |
||
55 | * @param array|string $key |
||
56 | * @param mixed $value |
||
57 | * @return void |
||
58 | */ |
||
59 | public function set($key, $value = null) |
||
67 | |||
68 | /** |
||
69 | * Prepend a value onto an array configuration value. |
||
70 | * |
||
71 | * @param string $key |
||
72 | * @param mixed $value |
||
73 | * @return void |
||
74 | */ |
||
75 | public function prepend($key, $value) |
||
83 | |||
84 | /** |
||
85 | * Push a value onto an array configuration value. |
||
86 | * |
||
87 | * @param string $key |
||
88 | * @param mixed $value |
||
89 | * @return void |
||
90 | */ |
||
91 | public function push($key, $value) |
||
99 | |||
100 | /** |
||
101 | * Get all of the configuration items for the application. |
||
102 | * |
||
103 | * @return array |
||
104 | */ |
||
105 | public function all() |
||
109 | |||
110 | /** |
||
111 | * Determine if the given configuration option exists. |
||
112 | * |
||
113 | * @param string $key |
||
114 | * @return bool |
||
115 | */ |
||
116 | public function offsetExists($key) |
||
120 | |||
121 | /** |
||
122 | * Get a configuration option. |
||
123 | * |
||
124 | * @param string $key |
||
125 | * @return mixed |
||
126 | */ |
||
127 | public function offsetGet($key) |
||
131 | |||
132 | /** |
||
133 | * Set a configuration option. |
||
134 | * |
||
135 | * @param string $key |
||
136 | * @param mixed $value |
||
137 | * @return void |
||
138 | */ |
||
139 | public function offsetSet($key, $value) |
||
143 | |||
144 | /** |
||
145 | * Unset a configuration option. |
||
146 | * |
||
147 | * @param string $key |
||
148 | * @return void |
||
149 | */ |
||
150 | public function offsetUnset($key) |
||
154 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.