-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConfigManager.php
More file actions
51 lines (41 loc) · 1.05 KB
/
ConfigManager.php
File metadata and controls
51 lines (41 loc) · 1.05 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
<?php
namespace Undf\AngularJsBundle;
use Assetic\Filter\FilterInterface;
use Assetic\Asset\AssetInterface;
/**
* Config Manager
*
* @author Dani Gonzalez <daniel.gonzalez@undefined.es>
*/
class ConfigManager
{
private $configs;
public function __construct(array $configs)
{
$this->configs = $configs;
}
public function getConfigs()
{
return $this->configs;
}
public function getConfig($name)
{
if (!isset($this->configs[$name])) {
throw new \Exception(sprintf("Config '%s' doesn´t exist.", $name));
}
return $this->configs[$name];
}
public function getConfigNameFromMasterFile($filename)
{
$filename = trim(strrchr($filename, '/'),' /');
$parts = explode('.', $filename);
if(($num = count($parts)) > 2 && $parts[$num - 2] == 'undfangular') {
return $parts[$num - 3];
}
return false;
}
public function getMasterFileForConfig($configname)
{
return $configname.'.undfangular.js';
}
}