Development

/branches/1.1/lib/config/sfRoutingConfigHandler.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/config/sfRoutingConfigHandler.class.php

Revision 9085, 1.7 kB (checked in by Carl.Vondrick, 7 years ago)

1.1: fixed @param phpdoc to fit specs in config (refs #2991)

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Rev Date
Line 
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  * @package    symfony
13  * @subpackage config
14  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
15  * @version    SVN: $Id$
16  */
17 class sfRoutingConfigHandler extends sfYamlConfigHandler
18 {
19   /**
20    * Executes this configuration handler.
21    *
22    * @param array $configFiles An array of absolute filesystem path to a configuration file
23    *
24    * @return string Data to be written to a cache file
25    *
26    * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
27    * @throws sfParseException         If a requested configuration file is improperly formatted
28    */
29   public function execute($configFiles)
30   {
31     // parse the yaml
32     $config = self::getConfiguration($configFiles);
33
34     // connect routes
35     $data = array();
36     foreach ($config as $name => $params)
37     {
38       $data[] = sprintf('$this->connect(\'%s\', \'%s\', %s, %s);',
39         $name,
40         $params['url'] ? $params['url'] : '/',
41         isset($params['param']) ? var_export($params['param'], true) : 'array()',
42         isset($params['requirements']) ? var_export($params['requirements'], true) : 'array()'
43       );
44     }
45
46     return sprintf("<?php\n".
47                    "// auto-generated by sfRoutingConfigHandler\n".
48                    "// date: %s\n%s\n", date('Y/m/d H:i:s'), implode("\n", $data)
49     );
50   }
51
52   /**
53    * @see sfConfigHandler
54    */
55   static public function getConfiguration(array $configFiles)
56   {
57     return self::parseYamls($configFiles);
58   }
59 }
60
Note: See TracBrowser for help on using the browser.