-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppConfig.php
More file actions
executable file
·61 lines (52 loc) · 1.15 KB
/
AppConfig.php
File metadata and controls
executable file
·61 lines (52 loc) · 1.15 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
<?php
namespace BaseModule\Helper;
use Zend\Config\Config;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* Simple Config
*
* to difference the zf2 config with routes etc, and the application-config for the usage
*
* @copyright Felix Buchheim
* @author Felix Buchheim <hanibal4nothing@gmail.com>
*/
class AppConfig
{
/**
* key to fetch the config
*
* @var string
*/
const CONFIG_KEY = 'applicationConfig';
/**
* @var Config
*/
protected $config;
/**
* @param ServiceLocatorInterface $oServiceManager
*
* @return $this
*/
public function fetchConfig(ServiceLocatorInterface $oServiceManager)
{
$aConfig = $oServiceManager->get('config');
$this->config = new Config($aConfig[self::CONFIG_KEY], false);
return $this;
}
/**
* @return Config
*/
public function getConfig()
{
return $this->config;
}
/**
* @param $sKey
*
* @return mixed|null
*/
public function get($sKey)
{
return (true === $this->config->offsetExists($sKey) ? $this->config->get($sKey) : null);
}
}