|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of Fabrica. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Alexandre Salomé <[email protected]> |
|
7
|
|
|
* (c) Julien DIDIER <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This source file is subject to the GPL license that is bundled |
|
10
|
|
|
* with this source code in the file LICENSE. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Fabrica\Component\Config; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Interface for dynamic configuration of Fabrica. |
|
17
|
|
|
* |
|
18
|
|
|
* This configuration is basically a key-value storage or scalars. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Alexandre Salomé <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
interface ConfigInterface |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Fetch a configuration value. |
|
26
|
|
|
* |
|
27
|
|
|
* @param string $key Key value |
|
28
|
|
|
* @param mixed $default Value to return if nothing is found in confiugration |
|
29
|
|
|
* |
|
30
|
|
|
* @return mixed Value if exists, $default otherwise |
|
31
|
|
|
*/ |
|
32
|
|
|
public function get($key, $default = null); |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Set a configuration value. |
|
36
|
|
|
* |
|
37
|
|
|
* @param string $key Key of the value to set |
|
38
|
|
|
* @param mixed $value Value to set |
|
39
|
|
|
*/ |
|
40
|
|
|
public function set($key, $value); |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Removes a given value from config. |
|
44
|
|
|
* |
|
45
|
|
|
* @param string $value The key of value to remove. |
|
|
|
|
|
|
46
|
|
|
*/ |
|
47
|
|
|
public function remove($key); |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Returns all values. |
|
51
|
|
|
* |
|
52
|
|
|
* @return array All values |
|
53
|
|
|
*/ |
|
54
|
|
|
public function all(); |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Replaces all values with given one. |
|
58
|
|
|
*/ |
|
59
|
|
|
public function setAll(array $values); |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Merge values in current config |
|
63
|
|
|
*/ |
|
64
|
|
|
public function merge(array $values); |
|
65
|
|
|
} |
|
66
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.