| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the symfony package.
|
|
|
5 |
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
6 |
*
|
|
|
7 |
* For the full copyright and license information, please view the LICENSE
|
|
|
8 |
* file that was distributed with this source code.
|
|
|
9 |
*/
|
|
|
10 |
|
|
|
11 |
/**
|
|
|
12 |
* sfSimpleYamlConfigHandler allows you to load simple configuration files formatted as YAML.
|
|
|
13 |
*
|
|
|
14 |
* @package symfony
|
|
|
15 |
* @subpackage config
|
|
|
16 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
17 |
* @version SVN: $Id: sfSimpleYamlConfigHandler.class.php 9085 2008-05-20 01:53:23Z Carl.Vondrick $
|
|
|
18 |
*/
|
|
|
19 |
class sfSimpleYamlConfigHandler extends sfYamlConfigHandler
|
|
|
20 |
{
|
|
|
21 |
/**
|
|
|
22 |
* Executes this configuration handler.
|
|
|
23 |
*
|
|
|
24 |
* @param array $configFiles An array of absolute filesystem path to a configuration file
|
|
|
25 |
*
|
|
|
26 |
* @return string Data to be written to a cache file
|
|
|
27 |
*/
|
|
|
28 |
public function execute($configFiles)
|
|
|
29 |
{
|
|
|
30 |
$config = self::getConfiguration($configFiles);
|
|
|
31 |
|
|
|
32 |
// compile data
|
|
|
33 |
$retval = "<?php\n".
|
|
|
34 |
"// auto-generated by %s\n".
|
|
|
35 |
"// date: %s\nreturn %s;\n";
|
|
|
36 |
$retval = sprintf($retval, __CLASS__, date('Y/m/d H:i:s'), var_export($config, true));
|
|
|
37 |
|
|
|
38 |
return $retval;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
/**
|
|
|
42 |
* @see sfConfigHandler
|
|
|
43 |
*/
|
|
|
44 |
static public function getConfiguration(array $configFiles)
|
|
|
45 |
{
|
|
|
46 |
return self::parseYamls($configFiles);
|
|
|
47 |
}
|
|
|
48 |
}
|