Пример #1
0
 /**
  * @param TwigConfig $config
  *
  * @return array
  */
 public function buildTwigEnvironmentOptions(TwigConfig $config)
 {
     $options = ['debug' => $config->getDebug()];
     if ($config->getCharset() !== null) {
         $options['charset'] = $config->getCharset();
     }
     if ($config->getBaseTemplateClass() !== null) {
         $options['base_template_class'] = $config->getBaseTemplateClass();
     }
     if ($config->getCache() !== null) {
         $options['cache'] = $config->getCache();
     }
     if ($config->getAutoReload() !== null) {
         $options['auto_reload'] = $config->getAutoReload();
     }
     if ($config->getAutoEscape() !== null) {
         $options['autoescape'] = $config->getAutoEscape();
     }
     if ($config->getStrictVariables() !== null) {
         $options['strict_variables'] = $config->getStrictVariables();
     }
     if ($config->getOptimizations() !== null) {
         $options['optimizations'] = $config->getOptimizations();
     }
     return $options;
 }
Пример #2
0
 function let(TwigConfig $config)
 {
     $config->getPaths()->willReturn([__DIR__ . '/path1', __DIR__ . '/path2']);
     $config->getNamespaces()->willReturn(['namespace1' => __DIR__ . '/path1', 'namespace2' => __DIR__ . '/path2']);
     $config->getDebug()->willReturn(true);
     $config->getCharset()->willReturn('utf-8');
     $config->getCache()->willReturn(false);
     $config->getBaseTemplateClass()->willReturn('class');
     $config->getAutoReload()->willReturn(true);
     $config->getAutoEscape()->willReturn(true);
     $config->getOptimizations()->willReturn(-1);
     $config->getStrictVariables()->willReturn(true);
     directory_create(__DIR__ . '/path1');
     directory_create(__DIR__ . '/path2');
 }