1 | <?php |
||
9 | class ConfigService implements ConfigServiceInterface |
||
10 | { |
||
11 | /** @var ConfigManagerInterface */ |
||
12 | protected $configManager; |
||
13 | |||
14 | |||
15 | /** @var array name => [mixed, expiresAt] */ |
||
16 | private $valueCache = array(); |
||
17 | |||
18 | |||
19 | /** |
||
20 | * @param ConfigManagerInterface $configManager |
||
21 | */ |
||
22 | public function __construct(ConfigManagerInterface $configManager) |
||
26 | |||
27 | |||
28 | |||
29 | /** |
||
30 | * @param string $name |
||
31 | * @return bool|int|float|string|array|object |
||
32 | */ |
||
33 | public function get($name) |
||
55 | |||
56 | /** |
||
57 | * @param string $name |
||
58 | * @param bool|int|float|string|array|object $value |
||
59 | * @param string $type |
||
60 | * @param \DateTime|null $expiresAt |
||
61 | * @return void |
||
62 | */ |
||
63 | public function set($name, $value, $type = ConfigInterface::TYPE_STRING, \DateTime $expiresAt = null) |
||
84 | |||
85 | /** |
||
86 | * @param string $name |
||
87 | * @return bool |
||
88 | */ |
||
89 | public function delete($name) |
||
102 | |||
103 | /** |
||
104 | * @param int|null $limit |
||
105 | * @return int |
||
106 | */ |
||
107 | public function deleteExpired($limit = null) |
||
111 | |||
112 | /** |
||
113 | * Returns decoded value from the config object |
||
114 | * @param ConfigInterface $config |
||
115 | * @return array|bool|float|int|object|string |
||
116 | */ |
||
117 | protected function decodeValue(ConfigInterface $config = null) |
||
146 | |||
147 | /** |
||
148 | * Encodes value and sets it to the config object |
||
149 | * @param mixed $value |
||
150 | * @param ConfigInterface $config |
||
151 | */ |
||
152 | protected function encodeValue($value, ConfigInterface $config) |
||
176 | } |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.