IConfigurable.php
1.9 KB
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
84
<?php
namespace clagiordano\weblibs\configmanager;
use RuntimeException;
/**
* Class ConfigManager, class for easily read and access to php config array file.
* @package clagiordano\weblibs\configmanager
*/
interface IConfigurable
{
/**
* Load config data from file and store it into internal property
*
* @param null|string $configFilePath
*
* @return IConfigurable
*/
public function loadConfig($configFilePath = null);
/**
* Prepare and write config file on disk
*
* @param null|string $configFilePath
* @param bool $autoReloadConfig
*
* @return IConfigurable
* @throws RuntimeException
*/
public function saveConfigFile($configFilePath = null, $autoReloadConfig = false);
/**
* Get value from config data throught keyValue path
*
* @param string $configPath
* @param mixed $defaultValue
*
* @return mixed
*/
public function getValue($configPath, $defaultValue = null);
/**
* Check if exist required config for keyValue
*
* @param string $keyValue
*
* @return mixed
*/
public function existValue($keyValue);
/**
* Set value in config path
*
* @param string $configPath
* @param mixed $newValue
*
* @return IConfigurable
*/
public function setValue($configPath, $newValue);
/**
* Returns the whole internal configuration as array
* @return array
*/
public function getConfig();
/**
* Sets the whole internal configuration from array
*
* @param array $config
* @return IConfigurable
*/
public function setConfig($config);
/**
* Converts the current instance into another one provided as argument,
* migrating its internal configuration and returning the new one.
*
* @param IConfigurable $target
* @return IConfigurable
*/
public function convert(IConfigurable $target);
}