/**
  * Executes this configuration handler
  * 
  * @param   array   $configFiles    An array of absolute filesystem path to a configuration file
  * @return  string  Data to be written to a cache file
  * @see     sfRoutingConfigHandler::execute()
  */
 public function execute($configFiles)
 {
     $options = $this->getOptions();
     unset($options['cache']);
     $data = array();
     $modules = sfConfig::get('sf_enabled_modules');
     $dir = sfConfig::get('sf_app_module_dir');
     foreach ($this->parse($configFiles) as $name => $routeConfig) {
         $r = new ReflectionClass($routeConfig[0]);
         $routes = $r->newInstanceArgs($routeConfig[1]);
         if ($routes instanceof sfRouteCollection) {
             $collOptions = $routes->getOptions();
             if (isset($collOptions['module']) && !in_array($collOptions['module'], $modules) && !is_readable($dir . '/' . $collOptions['module'])) {
                 continue;
             }
         } else {
             $routes = array($name => $routes);
         }
         foreach (sfPatternRouting::flattenRoutes($routes) as $name => $route) {
             $route->setDefaultOptions($options);
             $data[] = sprintf('$this->routes[\'%s\'] = unserialize(\'%s\');', $name, serialize($route));
         }
     }
     return sprintf("<?php\n// auto-generated by dinRoutingConfigHandler\n// date: %s\n%s\n", date('Y/m/d H:i:s'), implode("\n", $data));
 }
 /**
  * Executes this configuration handler.
  *
  * @param array $configFiles An array of absolute filesystem path to a configuration file
  *
  * @return string Data to be written to a cache file
  *
  * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
  * @throws sfParseException         If a requested configuration file is improperly formatted
  */
 public function execute($configFiles)
 {
     $options = $this->getOptions();
     unset($options['cache']);
     $data = array();
     foreach ($this->parse($configFiles) as $name => $routeConfig) {
         $r = new ReflectionClass($routeConfig[0]);
         $route = $r->newInstanceArgs($routeConfig[1]);
         $routes = $route instanceof sfRouteCollection ? $route : array($name => $route);
         foreach (sfPatternRouting::flattenRoutes($routes) as $name => $route) {
             $route->setDefaultOptions($options);
             $data[] = sprintf('$this->routes[\'%s\'] = %s;', $name, var_export(serialize($route), true));
         }
     }
     return sprintf("<?php\n" . "// auto-generated by sfRoutingConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), implode("\n", $data));
 }
 /**
  * Executes this configuration handler.
  *
  * @param array $configFiles An array of absolute filesystem path to a configuration file
  *
  * @return string Data to be written to a cache file
  *
  * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
  * @throws sfParseException         If a requested configuration file is improperly formatted
  */
 public function execute($configFiles)
 {
     $config = sfFactoryConfigHandler::getConfiguration(sfContext::getInstance()->getConfiguration()->getConfigPaths('config/factories.yml'));
     $options = $config['routing']['param'];
     unset($options['cache']);
     $data = array();
     foreach ($this->parse($configFiles) as $name => $routeConfig) {
         $r = new ReflectionClass($routeConfig[0]);
         $route = $r->newInstanceArgs($routeConfig[1]);
         $routes = $route instanceof sfRouteCollection ? $route : array($name => $route);
         foreach (sfPatternRouting::flattenRoutes($routes) as $name => $route) {
             $route->setDefaultOptions($options);
             $data[] = sprintf('$map[\'%s\'] = new %s(%s, %s, %s, %s);', $name, get_class($route), var_export($route->getPattern(), true), var_export($route->getDefaults(), true), var_export($route->getRequirements(), true), var_export($route->getOptions(), true));
             $data[] = sprintf('$map[\'%s\']->setCompiledData(%s);', $name, var_export($route->getCompiledData(), true));
         }
     }
     return sprintf("<?php\n" . "// auto-generated by sfRoutingConfigHandler\n" . "// date: %s\n\$map = array();\n%s\nreturn \$map;\n", date('Y/m/d H:i:s'), implode("\n", $data));
 }