Timber - Version 1.1.12

Version Description

  • Fixed Twig issue with deprecation #1265 (thanks @codesman)!
  • Cleaned-up the warnings for WP.org users and disabled easy updates for major/milestone versions 331314d9aaf90a52ff1c5a213656b8c02a27c60e
Download this release

Release Info

Developer jarednova
Plugin Icon 128x128 Timber
Version 1.1.12
Comparing to
See all releases

Code changes from version 1.1.11 to 1.1.12

Files changed (91) hide show
  1. lib/Admin.php +50 -19
  2. lib/ImageHelper.php +2 -4
  3. lib/Theme.php +6 -6
  4. lib/Timber.php +1 -1
  5. lib/Twig.php +4 -4
  6. readme.txt +5 -1
  7. timber.php +1 -1
  8. vendor/autoload.php +1 -1
  9. vendor/composer/autoload_real.php +3 -3
  10. vendor/composer/installed.json +8 -8
  11. vendor/twig/twig/.travis.yml +6 -1
  12. vendor/twig/twig/CHANGELOG +19 -0
  13. vendor/twig/twig/composer.json +2 -2
  14. vendor/twig/twig/doc/advanced.rst +5 -7
  15. vendor/twig/twig/doc/advanced_legacy.rst +5 -7
  16. vendor/twig/twig/doc/api.rst +19 -3
  17. vendor/twig/twig/doc/functions/block.rst +26 -0
  18. vendor/twig/twig/doc/functions/constant.rst +11 -0
  19. vendor/twig/twig/doc/functions/include.rst +7 -3
  20. vendor/twig/twig/doc/recipes.rst +10 -10
  21. vendor/twig/twig/doc/tags/autoescape.rst +0 -2
  22. vendor/twig/twig/doc/tags/extends.rst +6 -2
  23. vendor/twig/twig/doc/tags/include.rst +7 -3
  24. vendor/twig/twig/doc/tags/index.rst +1 -0
  25. vendor/twig/twig/doc/tags/with.rst +44 -0
  26. vendor/twig/twig/doc/templates.rst +2 -4
  27. vendor/twig/twig/ext/twig/php_twig.h +1 -1
  28. vendor/twig/twig/lib/Twig/BaseNodeVisitor.php +0 -6
  29. vendor/twig/twig/lib/Twig/Compiler.php +10 -17
  30. vendor/twig/twig/lib/Twig/CompilerInterface.php +1 -3
  31. vendor/twig/twig/lib/Twig/Environment.php +57 -58
  32. vendor/twig/twig/lib/Twig/ExpressionParser.php +6 -1
  33. vendor/twig/twig/lib/Twig/Extension/Core.php +42 -24
  34. vendor/twig/twig/lib/Twig/Extension/Escaper.php +0 -2
  35. vendor/twig/twig/lib/Twig/Extension/StringLoader.php +1 -1
  36. vendor/twig/twig/lib/Twig/ExtensionInterface.php +1 -3
  37. vendor/twig/twig/lib/Twig/LexerInterface.php +1 -1
  38. vendor/twig/twig/lib/Twig/Loader/Array.php +1 -3
  39. vendor/twig/twig/lib/Twig/Loader/Chain.php +1 -8
  40. vendor/twig/twig/lib/Twig/Loader/Filesystem.php +0 -2
  41. vendor/twig/twig/lib/Twig/Node.php +2 -36
  42. vendor/twig/twig/lib/Twig/Node/Expression/Array.php +1 -1
  43. vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php +4 -0
  44. vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php +59 -14
  45. vendor/twig/twig/lib/Twig/Node/Expression/Call.php +2 -2
  46. vendor/twig/twig/lib/Twig/Node/Expression/Function.php +7 -2
  47. vendor/twig/twig/lib/Twig/Node/Expression/Name.php +14 -4
  48. vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php +23 -0
  49. vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php +4 -1
  50. vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php +1 -3
  51. vendor/twig/twig/lib/Twig/Node/With.php +62 -0
  52. vendor/twig/twig/lib/Twig/NodeInterface.php +0 -2
  53. vendor/twig/twig/lib/Twig/NodeTraverser.php +2 -11
  54. vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php +5 -18
  55. vendor/twig/twig/lib/Twig/NodeVisitorInterface.php +0 -6
  56. vendor/twig/twig/lib/Twig/Parser.php +3 -14
  57. vendor/twig/twig/lib/Twig/ParserInterface.php +1 -3
  58. vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php +2 -2
  59. vendor/twig/twig/lib/Twig/Template.php +117 -49
  60. vendor/twig/twig/lib/Twig/TemplateInterface.php +1 -1
  61. vendor/twig/twig/lib/Twig/TemplateWrapper.php +131 -0
  62. vendor/twig/twig/lib/Twig/Test/NodeTestCase.php +4 -0
  63. vendor/twig/twig/lib/Twig/Token.php +7 -20
  64. vendor/twig/twig/lib/Twig/TokenParser.php +0 -2
  65. vendor/twig/twig/lib/Twig/TokenParser/Filter.php +1 -1
  66. vendor/twig/twig/lib/Twig/TokenParser/With.php +48 -0
  67. vendor/twig/twig/lib/Twig/TokenParserBroker.php +0 -22
  68. vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php +1 -3
  69. vendor/twig/twig/lib/Twig/TokenParserInterface.php +1 -5
  70. vendor/twig/twig/lib/Twig/TokenStream.php +0 -9
  71. vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php +2 -2
  72. vendor/twig/twig/phpunit.xml.dist +8 -0
  73. vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php +8 -3
  74. vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test +20 -0
  75. vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test +22 -0
  76. vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test +12 -0
  77. vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test +1 -1
  78. vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test +13 -0
  79. vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test +10 -0
  80. vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test +15 -0
  81. vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test +10 -0
  82. vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test +10 -0
  83. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test +35 -0
  84. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test +38 -0
  85. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test +17 -0
  86. vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test +14 -0
  87. vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php +3 -0
  88. vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php +9 -1
  89. vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php +31 -0
  90. vendor/twig/twig/test/Twig/Tests/TemplateTest.php +96 -11
  91. vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php +64 -0
lib/Admin.php CHANGED
@@ -25,12 +25,44 @@ class Admin {
25
  $links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
26
  $links[] = '<a href="https://github.com/timber/timber/wiki" target="_blank">Documentation</a>';
27
  $links[] = '<a href="https://github.com/timber/timber/wiki/getting-started" target="_blank">Starter Guide</a>';
28
- $links[] = '<p><a href="https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip">Site not working on 1.0? Downgrade to version 0.22.6</a></p>';
29
  return $links;
30
  }
31
  return $links;
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /**
35
  * Displays an update message for plugin list screens.
36
  * Shows only the version updates from the current until the newest version
@@ -44,26 +76,25 @@ class Admin {
44
  * @param {object} $r
45
  */
46
  public static function in_plugin_update_message( $plugin_data, $r ) {
47
- $m = '';
48
-
49
- if ( version_compare("1.0.0", $plugin_data['new_version']) <= 0 ) {
50
- //a version of 1.0.0 or greater is availalbe
51
- $m .= '<br><b>Warning:</b> Timber 1.0 removed a number of features and methods. Before upgrading please test your theme on a local or staging site to ensure that your theme will work with the newest version.<br>
52
-
53
- <br><strong>Is your theme in active development?</strong> That is, is someone actively in PHP files writing new code? If you answered "no", then <i>do not upgrade</i>. You will not benefit from Timber 1.0<br>';
54
-
55
- $m .= '<br>Read the <strong><a href="https://github.com/timber/timber/wiki/1.0-Upgrade-Guide">Upgrade Guide</a></strong> for more information<br>';
56
-
57
- $m .= "<br>You can also <b><a href='https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip'>upgrade to version 0.22.6</a></b> if you want to upgrade, but are unsure if you're ready for 1.0<br>";
58
-
59
- }
60
-
61
- if ( version_compare("1.0.0", $plugin_data['Version']) <= 0 ) {
62
- $m .= "<br>Are you seeing errors since upgrading to 1.0? Download <b><a href='https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip'>Version 0.22.6</a></b> to bring things back to stability.";
63
  }
 
64
 
65
- // show message
66
- echo '<br />'.sprintf($m);
67
 
68
  }
69
 
25
  $links[] = '<a href="http://upstatement.com/timber" target="_blank">Homepage</a>';
26
  $links[] = '<a href="https://github.com/timber/timber/wiki" target="_blank">Documentation</a>';
27
  $links[] = '<a href="https://github.com/timber/timber/wiki/getting-started" target="_blank">Starter Guide</a>';
 
28
  return $links;
29
  }
30
  return $links;
31
  }
32
 
33
+ protected static function disable_update() {
34
+ $m = '<br>Is your theme in active development? That is, is someone actively in PHP files writing new code? If you answered "no", then <i>DO NOT UPGRADE</i>. ';
35
+ $m .= "We're so serious about it, we've even disabled the update link. If you really really think you should upgrade you can still <a href='https://wordpress.org/plugins/timber-library/'>download from WordPress.org</a>, but that's on you!";
36
+ $m .= '<style>#timber-library-update .update-link {pointer-events: none;
37
+ cursor: default; opacity:0.3;}</style>';
38
+ return $m;
39
+ }
40
+
41
+ protected static function update_message_milestone() {
42
+ $m = '<br><b>Warning:</b> Timber 1.0 removed a number of features and methods. Before upgrading please test your theme on a local or staging site to ensure that your theme will work with the newest version.<br>
43
+
44
+ <br><strong>Is your theme in active development?</strong> That is, is someone actively in PHP files writing new code? If you answered "no", then <i>do not upgrade</i>. You will not benefit from Timber 1.0<br>';
45
+
46
+ $m .= '<br>Read the <strong><a href="https://github.com/timber/timber/wiki/1.0-Upgrade-Guide">Upgrade Guide</a></strong> for more information<br>';
47
+
48
+ $m .= "<br>You can also <b><a href='https://downloads.wordpress.org/plugin/timber-library.0.22.6.zip'>upgrade to version 0.22.6</a></b> if you want to upgrade, but are unsure if you're ready for 1.0<br>";
49
+ $m .= self::disable_update();
50
+ return $m;
51
+ }
52
+
53
+ protected static function update_message_major() {
54
+ $m = '<br><b>Warning:</b> This new version of Timber introduces some major new features which might have unknown effects on your site.';
55
+
56
+
57
+ $m .= self::disable_update();
58
+ return $m;
59
+ }
60
+
61
+ protected static function update_message_minor() {
62
+ $m = "<br><b>Warning:</b> This new version of Timber introduces some new features which might have unknown effects on your site. We have automated tests to help us catch potential issues, but nothing is 100%. You're likley safe to upgrade, but do so very carefully and only if you have an experienced WordPress developer available to help you debug potential issues.";
63
+ return $m;
64
+ }
65
+
66
  /**
67
  * Displays an update message for plugin list screens.
68
  * Shows only the version updates from the current until the newest version
76
  * @param {object} $r
77
  */
78
  public static function in_plugin_update_message( $plugin_data, $r ) {
79
+ $current_version = $plugin_data['Version'];
80
+ $current_version_array = explode('.', (string)$current_version);
81
+ $new_version = $plugin_data['new_version'];
82
+ $new_version_array = explode('.', (string)$new_version);
83
+ if ( $new_version_array[0] > $current_version_array[0]) {
84
+ //milestone version
85
+ $message = self::update_message_milestone();
86
+ echo '<br />'.sprintf($message);
87
+ } elseif ( $new_version_array[1] > $current_version_array[1] ) {
88
+ //major version
89
+ $message = self::update_message_major();
90
+ echo '<br />'.sprintf($message);
91
+ } elseif ( isset($new_version_array[2]) && isset($current_version_array[2]) &&
92
+ $new_version_array[2] > $current_version_array[2] ) {
93
+ $message = self::update_message_minor();
94
+ echo '<br />'.($message);
95
  }
96
+ return;
97
 
 
 
98
 
99
  }
100
 
lib/ImageHelper.php CHANGED
@@ -354,8 +354,8 @@ class ImageHelper {
354
  );
355
  $upload_dir = wp_upload_dir();
356
  $tmp = $url;
357
- if ( 0 === strpos($tmp, ABSPATH) ) {
358
- // we've been given a dir, not an url
359
  $result['absolute'] = true;
360
  if ( 0 === strpos($tmp, $upload_dir['basedir']) ) {
361
  $result['base'] = self::BASE_UPLOADS; // upload based
@@ -484,10 +484,8 @@ class ImageHelper {
484
  $au['subdir'],
485
  $au['basename']
486
  );
487
-
488
  $new_url = apply_filters('timber/image/new_url', $new_url);
489
  $destination_path = apply_filters('timber/image/new_path', $destination_path);
490
-
491
  // if already exists...
492
  if ( file_exists($destination_path) ) {
493
  if ( $force || filemtime($source_path) > filemtime($destination_path) ) {
354
  );
355
  $upload_dir = wp_upload_dir();
356
  $tmp = $url;
357
+ if ( 0 === strpos($tmp, ABSPATH) || 0 === strpos($tmp, '/srv/www/') ) {
358
+ // we've been given a dir, not an url
359
  $result['absolute'] = true;
360
  if ( 0 === strpos($tmp, $upload_dir['basedir']) ) {
361
  $result['base'] = self::BASE_UPLOADS; // upload based
484
  $au['subdir'],
485
  $au['basename']
486
  );
 
487
  $new_url = apply_filters('timber/image/new_url', $new_url);
488
  $destination_path = apply_filters('timber/image/new_path', $destination_path);
 
489
  // if already exists...
490
  if ( file_exists($destination_path) ) {
491
  if ( $force || filemtime($source_path) > filemtime($destination_path) ) {
lib/Theme.php CHANGED
@@ -77,17 +77,17 @@ class Theme extends Core {
77
  * @param string $slug
78
  */
79
  protected function init( $slug = null ) {
80
- $data = wp_get_theme($slug);
81
- $this->name = $data->get('Name');
82
- $ss = $data->get_stylesheet();
83
  $this->slug = $ss;
84
 
85
  if ( !function_exists('get_home_path') ) {
86
  require_once(ABSPATH.'wp-admin/includes/file.php');
87
  }
88
-
89
  $this->uri = get_stylesheet_directory_uri();
90
- $this->parent_slug = $data->get('Template');
91
  if ( !$this->parent_slug ) {
92
  $this->uri = get_template_directory_uri();
93
  }
@@ -101,7 +101,7 @@ class Theme extends Core {
101
  * @return string the absolute path to the theme (ex: `http://example.org/wp-content/themes/my-timber-theme`)
102
  */
103
  public function link() {
104
- return $this->uri;
105
  }
106
 
107
  /**
77
  * @param string $slug
78
  */
79
  protected function init( $slug = null ) {
80
+ $theme = wp_get_theme($slug);
81
+ $this->name = $theme->get('Name');
82
+ $ss = $theme->get_stylesheet();
83
  $this->slug = $ss;
84
 
85
  if ( !function_exists('get_home_path') ) {
86
  require_once(ABSPATH.'wp-admin/includes/file.php');
87
  }
88
+ $this->_link = get_theme_root_uri().'/'.$this->slug;
89
  $this->uri = get_stylesheet_directory_uri();
90
+ $this->parent_slug = $theme->get('Template');
91
  if ( !$this->parent_slug ) {
92
  $this->uri = get_template_directory_uri();
93
  }
101
  * @return string the absolute path to the theme (ex: `http://example.org/wp-content/themes/my-timber-theme`)
102
  */
103
  public function link() {
104
+ return $this->_link;
105
  }
106
 
107
  /**
lib/Timber.php CHANGED
@@ -35,7 +35,7 @@ use Timber\Loader;
35
  */
36
  class Timber {
37
 
38
- public static $version = '1.1.11';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
35
  */
36
  class Timber {
37
 
38
+ public static $version = '1.1.12';
39
  public static $locations;
40
  public static $dirname = 'views';
41
  public static $twig_cache = false;
lib/Twig.php CHANGED
@@ -220,18 +220,18 @@ class Twig {
220
  */
221
  public function add_timber_escapers( $twig ) {
222
 
223
- $twig->getExtension('core')->setEscaper('esc_url', function( \Twig_Environment $env, $string ) {
224
  return esc_url( $string );
225
  });
226
- $twig->getExtension('core')->setEscaper('wp_kses_post', function( \Twig_Environment $env, $string ) {
227
  return wp_kses_post( $string );
228
  });
229
 
230
- $twig->getExtension('core')->setEscaper('esc_html', function( \Twig_Environment $env, $string ) {
231
  return esc_html( $string );
232
  });
233
 
234
- $twig->getExtension('core')->setEscaper('esc_js', function( \Twig_Environment $env, $string ) {
235
  return esc_js( $string );
236
  });
237
 
220
  */
221
  public function add_timber_escapers( $twig ) {
222
 
223
+ $twig->getExtension('Twig_Extension_Core')->setEscaper('esc_url', function( \Twig_Environment $env, $string ) {
224
  return esc_url( $string );
225
  });
226
+ $twig->getExtension('Twig_Extension_Core')->setEscaper('wp_kses_post', function( \Twig_Environment $env, $string ) {
227
  return wp_kses_post( $string );
228
  });
229
 
230
+ $twig->getExtension('Twig_Extension_Core')->setEscaper('esc_html', function( \Twig_Environment $env, $string ) {
231
  return esc_html( $string );
232
  });
233
 
234
+ $twig->getExtension('Twig_Extension_Core')->setEscaper('esc_js', function( \Twig_Environment $env, $string ) {
235
  return esc_js( $string );
236
  });
237
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
- Stable tag: 1.1.11
6
  Tested up to: 4.6
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
@@ -41,6 +41,10 @@ Timber is great for any WordPress developer who cares about writing good, mainta
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 1.1.11 =
45
  * Improved flexibility for public query_vars #1250 (thanks @xavivars)
46
  * Children should inehrit publish state #1255 (thanks @motia)
2
  Contributors: jarednova, connorjburton, lggorman
3
  Tags: template engine, templates, twig
4
  Requires at least: 3.7
5
+ Stable tag: 1.1.12
6
  Tested up to: 4.6
7
  PHP version: 5.3.0 or greater
8
  License: GPLv2 or later
41
 
42
  == Changelog ==
43
 
44
+ = 1.1.12 =
45
+ * Fixed Twig issue with deprecation #1265 (thanks @codesman)!
46
+ * Cleaned-up the warnings for WP.org users and disabled easy updates for major/milestone versions 331314d9aaf90a52ff1c5a213656b8c02a27c60e
47
+
48
  = 1.1.11 =
49
  * Improved flexibility for public query_vars #1250 (thanks @xavivars)
50
  * Children should inehrit publish state #1255 (thanks @motia)
timber.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Timber
4
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
- Version: 1.1.11
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
4
  Description: The WordPress Timber Library allows you to write themes using the power Twig templates.
5
  Plugin URI: http://timber.upstatement.com
6
  Author: Jared Novack + Upstatement
7
+ Version: 1.1.12
8
  Author URI: http://upstatement.com/
9
  */
10
  // we look for Composer files first in the plugins dir.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit169e0829974ac43c7824bc524908c054::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit22f8a762fefc8182d5b4a7cd2473d3dc::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit169e0829974ac43c7824bc524908c054
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit169e0829974ac43c7824bc524908c054
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit169e0829974ac43c7824bc524908c054', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit169e0829974ac43c7824bc524908c054', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit22f8a762fefc8182d5b4a7cd2473d3dc
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit22f8a762fefc8182d5b4a7cd2473d3dc', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit22f8a762fefc8182d5b4a7cd2473d3dc', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
vendor/composer/installed.json CHANGED
@@ -110,17 +110,17 @@
110
  },
111
  {
112
  "name": "twig/twig",
113
- "version": "v1.27.0",
114
- "version_normalized": "1.27.0.0",
115
  "source": {
116
  "type": "git",
117
  "url": "https://github.com/twigphp/Twig.git",
118
- "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97"
119
  },
120
  "dist": {
121
  "type": "zip",
122
- "url": "https://api.github.com/repos/twigphp/Twig/zipball/3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97",
123
- "reference": "3c6c0033fd3b5679c6e1cb60f4f9766c2b424d97",
124
  "shasum": ""
125
  },
126
  "require": {
@@ -128,13 +128,13 @@
128
  },
129
  "require-dev": {
130
  "symfony/debug": "~2.7",
131
- "symfony/phpunit-bridge": "~2.7"
132
  },
133
- "time": "2016-10-25 19:17:17",
134
  "type": "library",
135
  "extra": {
136
  "branch-alias": {
137
- "dev-master": "1.27-dev"
138
  }
139
  },
140
  "installation-source": "dist",
110
  },
111
  {
112
  "name": "twig/twig",
113
+ "version": "v1.28.2",
114
+ "version_normalized": "1.28.2.0",
115
  "source": {
116
  "type": "git",
117
  "url": "https://github.com/twigphp/Twig.git",
118
+ "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c"
119
  },
120
  "dist": {
121
  "type": "zip",
122
+ "url": "https://api.github.com/repos/twigphp/Twig/zipball/b22ce0eb070e41f7cba65d78fe216de29726459c",
123
+ "reference": "b22ce0eb070e41f7cba65d78fe216de29726459c",
124
  "shasum": ""
125
  },
126
  "require": {
128
  },
129
  "require-dev": {
130
  "symfony/debug": "~2.7",
131
+ "symfony/phpunit-bridge": "~3.2@dev"
132
  },
133
+ "time": "2016-11-23 18:41:40",
134
  "type": "library",
135
  "extra": {
136
  "branch-alias": {
137
+ "dev-master": "1.28-dev"
138
  }
139
  },
140
  "installation-source": "dist",
vendor/twig/twig/.travis.yml CHANGED
@@ -14,12 +14,16 @@ php:
14
  - 5.5
15
  - 5.6
16
  - 7.0
 
17
  - hhvm
18
 
19
  env:
20
  - TWIG_EXT=no
21
  - TWIG_EXT=yes
22
 
 
 
 
23
  install:
24
  # Composer is not available on PHP 5.2
25
  - if [ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]; then travis_retry composer install; fi
@@ -34,6 +38,7 @@ matrix:
34
  exclude:
35
  - php: hhvm
36
  env: TWIG_EXT=yes
37
- allow_failures:
38
  - php: 7.0
39
  env: TWIG_EXT=yes
 
 
14
  - 5.5
15
  - 5.6
16
  - 7.0
17
+ - 7.1
18
  - hhvm
19
 
20
  env:
21
  - TWIG_EXT=no
22
  - TWIG_EXT=yes
23
 
24
+ before_install:
25
+ - if [[ ! $TRAVIS_PHP_VERSION = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
26
+
27
  install:
28
  # Composer is not available on PHP 5.2
29
  - if [ ${TRAVIS_PHP_VERSION:0:3} != "5.2" ]; then travis_retry composer install; fi
38
  exclude:
39
  - php: hhvm
40
  env: TWIG_EXT=yes
 
41
  - php: 7.0
42
  env: TWIG_EXT=yes
43
+ - php: 7.1
44
+ env: TWIG_EXT=yes
vendor/twig/twig/CHANGELOG CHANGED
@@ -1,3 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  * 1.27.0 (2016-10-25)
2
 
3
  * deprecated Twig_Parser::getEnvironment()
1
+ * 1.28.2 (2016-11-23)
2
+
3
+ * fixed precedence between getFoo() and isFoo() in Twig_Template::getAttribute()
4
+ * improved a deprecation message
5
+
6
+ * 1.28.1 (2016-11-18)
7
+
8
+ * fixed block() function when used with a template argument
9
+
10
+ * 1.28.0 (2016-11-17)
11
+
12
+ * added support for the PHP 7 null coalescing operator for the ?? Twig implementation
13
+ * exposed a way to access template data and methods in a portable way
14
+ * changed context access to use the PHP 7 null coalescing operator when available
15
+ * added the "with" tag
16
+ * added support for a custom template on the block() function
17
+ * added "is defined" support for block() and constant()
18
+ * optimized the way attributes are fetched
19
+
20
  * 1.27.0 (2016-10-25)
21
 
22
  * deprecated Twig_Parser::getEnvironment()
vendor/twig/twig/composer.json CHANGED
@@ -30,7 +30,7 @@
30
  "php": ">=5.2.7"
31
  },
32
  "require-dev": {
33
- "symfony/phpunit-bridge": "~2.7",
34
  "symfony/debug": "~2.7"
35
  },
36
  "autoload": {
@@ -40,7 +40,7 @@
40
  },
41
  "extra": {
42
  "branch-alias": {
43
- "dev-master": "1.27-dev"
44
  }
45
  }
46
  }
30
  "php": ">=5.2.7"
31
  },
32
  "require-dev": {
33
+ "symfony/phpunit-bridge": "~3.2@dev",
34
  "symfony/debug": "~2.7"
35
  },
36
  "autoload": {
40
  },
41
  "extra": {
42
  "branch-alias": {
43
+ "dev-master": "1.28-dev"
44
  }
45
  }
46
  }
vendor/twig/twig/doc/advanced.rst CHANGED
@@ -554,8 +554,6 @@ An extension is a class that implements the following interface::
554
  *
555
  * This is where you can load some file that contains filter functions for instance.
556
  *
557
- * @param Twig_Environment $environment The current Twig_Environment instance
558
- *
559
  * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
560
  */
561
  function initRuntime(Twig_Environment $environment);
@@ -563,35 +561,35 @@ An extension is a class that implements the following interface::
563
  /**
564
  * Returns the token parser instances to add to the existing list.
565
  *
566
- * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
567
  */
568
  function getTokenParsers();
569
 
570
  /**
571
  * Returns the node visitor instances to add to the existing list.
572
  *
573
- * @return array An array of Twig_NodeVisitorInterface instances
574
  */
575
  function getNodeVisitors();
576
 
577
  /**
578
  * Returns a list of filters to add to the existing list.
579
  *
580
- * @return array An array of filters
581
  */
582
  function getFilters();
583
 
584
  /**
585
  * Returns a list of tests to add to the existing list.
586
  *
587
- * @return array An array of tests
588
  */
589
  function getTests();
590
 
591
  /**
592
  * Returns a list of functions to add to the existing list.
593
  *
594
- * @return array An array of functions
595
  */
596
  function getFunctions();
597
 
554
  *
555
  * This is where you can load some file that contains filter functions for instance.
556
  *
 
 
557
  * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
558
  */
559
  function initRuntime(Twig_Environment $environment);
561
  /**
562
  * Returns the token parser instances to add to the existing list.
563
  *
564
+ * @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[]
565
  */
566
  function getTokenParsers();
567
 
568
  /**
569
  * Returns the node visitor instances to add to the existing list.
570
  *
571
+ * @return Twig_NodeVisitorInterface[]
572
  */
573
  function getNodeVisitors();
574
 
575
  /**
576
  * Returns a list of filters to add to the existing list.
577
  *
578
+ * @return Twig_SimpleFilter[]
579
  */
580
  function getFilters();
581
 
582
  /**
583
  * Returns a list of tests to add to the existing list.
584
  *
585
+ * @return Twig_SimpleTest[]
586
  */
587
  function getTests();
588
 
589
  /**
590
  * Returns a list of functions to add to the existing list.
591
  *
592
+ * @return Twig_SimpleFunction[]
593
  */
594
  function getFunctions();
595
 
vendor/twig/twig/doc/advanced_legacy.rst CHANGED
@@ -539,43 +539,41 @@ An extension is a class that implements the following interface::
539
  * Initializes the runtime environment.
540
  *
541
  * This is where you can load some file that contains filter functions for instance.
542
- *
543
- * @param Twig_Environment $environment The current Twig_Environment instance
544
  */
545
  function initRuntime(Twig_Environment $environment);
546
 
547
  /**
548
  * Returns the token parser instances to add to the existing list.
549
  *
550
- * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
551
  */
552
  function getTokenParsers();
553
 
554
  /**
555
  * Returns the node visitor instances to add to the existing list.
556
  *
557
- * @return array An array of Twig_NodeVisitorInterface instances
558
  */
559
  function getNodeVisitors();
560
 
561
  /**
562
  * Returns a list of filters to add to the existing list.
563
  *
564
- * @return array An array of filters
565
  */
566
  function getFilters();
567
 
568
  /**
569
  * Returns a list of tests to add to the existing list.
570
  *
571
- * @return array An array of tests
572
  */
573
  function getTests();
574
 
575
  /**
576
  * Returns a list of functions to add to the existing list.
577
  *
578
- * @return array An array of functions
579
  */
580
  function getFunctions();
581
 
539
  * Initializes the runtime environment.
540
  *
541
  * This is where you can load some file that contains filter functions for instance.
 
 
542
  */
543
  function initRuntime(Twig_Environment $environment);
544
 
545
  /**
546
  * Returns the token parser instances to add to the existing list.
547
  *
548
+ * @return (Twig_TokenParserInterface|Twig_TokenParserBrokerInterface)[]
549
  */
550
  function getTokenParsers();
551
 
552
  /**
553
  * Returns the node visitor instances to add to the existing list.
554
  *
555
+ * @return Twig_NodeVisitorInterface[]
556
  */
557
  function getNodeVisitors();
558
 
559
  /**
560
  * Returns a list of filters to add to the existing list.
561
  *
562
+ * @return Twig_SimpleFilter[]
563
  */
564
  function getFilters();
565
 
566
  /**
567
  * Returns a list of tests to add to the existing list.
568
  *
569
+ * @return Twig_SimpleTest[]
570
  */
571
  function getTests();
572
 
573
  /**
574
  * Returns a list of functions to add to the existing list.
575
  *
576
+ * @return Twig_SimpleFunction[]
577
  */
578
  function getFunctions();
579
 
vendor/twig/twig/doc/api.rst CHANGED
@@ -43,10 +43,18 @@ templates from a database or other resources.
43
  the evaluated templates. For such a need, you can use any available PHP
44
  cache library.
45
 
46
- To load a template from this environment you just have to call the
47
- ``loadTemplate()`` method which then returns a ``Twig_Template`` instance::
 
 
 
 
 
 
 
48
 
49
- $template = $twig->loadTemplate('index.html');
 
50
 
51
  To render the template with some variables, call the ``render()`` method::
52
 
@@ -60,6 +68,14 @@ You can also load and render the template in one fell swoop::
60
 
61
  echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here'));
62
 
 
 
 
 
 
 
 
 
63
  .. _environment_options:
64
 
65
  Environment Options
43
  the evaluated templates. For such a need, you can use any available PHP
44
  cache library.
45
 
46
+ Rendering Templates
47
+ -------------------
48
+
49
+ To load a template from a Twig environment, call the ``load()`` method which
50
+ returns a ``Twig_TemplateWrapper`` instance::
51
+
52
+ $template = $twig->load('index.html');
53
+
54
+ .. note::
55
 
56
+ Before Twig 1.28, you should use ``loadTemplate()`` instead which returns a
57
+ ``Twig_Template`` instance.
58
 
59
  To render the template with some variables, call the ``render()`` method::
60
 
68
 
69
  echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here'));
70
 
71
+ .. versionadded:: 1.28
72
+ The possibility to render blocks from the API was added in Twig 1.28.
73
+
74
+ If a template defines blocks, they can be rendered individually via the
75
+ ``renderBlock()`` call::
76
+
77
+ echo $template->renderBlock('block_name', array('the' => 'variables', 'go' => 'here'));
78
+
79
  .. _environment_options:
80
 
81
  Environment Options
vendor/twig/twig/doc/functions/block.rst CHANGED
@@ -1,6 +1,12 @@
1
  ``block``
2
  =========
3
 
 
 
 
 
 
 
4
  When a template uses inheritance and if you want to print a block multiple
5
  times, use the ``block`` function:
6
 
@@ -12,4 +18,24 @@ times, use the ``block`` function:
12
 
13
  {% block body %}{% endblock %}
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  .. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>`
1
  ``block``
2
  =========
3
 
4
+ .. versionadded: 1.28
5
+ Using ``block`` with the ``defined`` test was added in Twig 1.28.
6
+
7
+ .. versionadded: 1.28
8
+ Support for the template argument was added in Twig 1.28.
9
+
10
  When a template uses inheritance and if you want to print a block multiple
11
  times, use the ``block`` function:
12
 
18
 
19
  {% block body %}{% endblock %}
20
 
21
+ The ``block`` function can also be used to display one block of another
22
+ template:
23
+
24
+ .. code-block:: jinja
25
+
26
+ {{ block("title", "common_blocks.twig") }}
27
+
28
+ Use the ``defined`` test to check if a block exists in the context of the
29
+ current template:
30
+
31
+ .. code-block:: jinja
32
+
33
+ {% if block("footer") is defined %}
34
+ ...
35
+ {% endif %}
36
+
37
+ {% if block("footer", "common_blocks.twig") is defined %}
38
+ ...
39
+ {% endif %}
40
+
41
  .. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>`
vendor/twig/twig/doc/functions/constant.rst CHANGED
@@ -4,6 +4,9 @@
4
  .. versionadded: 1.12.1
5
  constant now accepts object instances as the second argument.
6
 
 
 
 
7
  ``constant`` returns the constant value for a given string:
8
 
9
  .. code-block:: jinja
@@ -16,3 +19,11 @@ As of 1.12.1 you can read constants from object instances as well:
16
  .. code-block:: jinja
17
 
18
  {{ constant('RSS', date) }}
 
 
 
 
 
 
 
 
4
  .. versionadded: 1.12.1
5
  constant now accepts object instances as the second argument.
6
 
7
+ .. versionadded: 1.28
8
+ Using ``constant`` with the ``defined`` test was added in Twig 1.28.
9
+
10
  ``constant`` returns the constant value for a given string:
11
 
12
  .. code-block:: jinja
19
  .. code-block:: jinja
20
 
21
  {{ constant('RSS', date) }}
22
+
23
+ Use the ``defined`` test to check if a constant is defined:
24
+
25
+ .. code-block:: jinja
26
+
27
+ {% if constant('SOME_CONST') is defined %}
28
+ ...
29
+ {% endif %}
vendor/twig/twig/doc/functions/include.rst CHANGED
@@ -37,14 +37,18 @@ You can disable access to the context by setting ``with_context`` to
37
  {# no variables will be accessible #}
38
  {{ include('template.html', with_context = false) }}
39
 
40
- And if the expression evaluates to a ``Twig_Template`` object, Twig will use it
41
- directly::
42
 
43
  // {{ include(template) }}
44
 
 
45
  $template = $twig->loadTemplate('some_template.twig');
46
 
47
- $twig->loadTemplate('template.twig')->display(array('template' => $template));
 
 
 
48
 
49
  When you set the ``ignore_missing`` flag, Twig will return an empty string if
50
  the template does not exist:
37
  {# no variables will be accessible #}
38
  {{ include('template.html', with_context = false) }}
39
 
40
+ And if the expression evaluates to a ``Twig_Template`` or a
41
+ ``Twig_TemplateWrapper`` instance, Twig will use it directly::
42
 
43
  // {{ include(template) }}
44
 
45
+ // deprecated as of Twig 1.28
46
  $template = $twig->loadTemplate('some_template.twig');
47
 
48
+ // as of Twig 1.28
49
+ $template = $twig->load('some_template.twig');
50
+
51
+ $twig->display('template.twig', array('template' => $template));
52
 
53
  When you set the ``ignore_missing`` flag, Twig will return an empty string if
54
  the template does not exist:
vendor/twig/twig/doc/recipes.rst CHANGED
@@ -551,18 +551,18 @@ include in your templates:
551
  ``interpolateProvider`` service, for instance at the module initialization
552
  time:
553
 
554
- ```js
555
- angular.module('myApp', []).config(function($interpolateProvider) {
556
- $interpolateProvider.startSymbol('{[').endSymbol(']}');
557
- });
558
- ```
559
 
560
  * For Twig, change the delimiters via the ``tag_variable`` Lexer option:
561
 
562
- ```php
563
- $env->setLexer(new Twig_Lexer($env, array(
564
- 'tag_variable' => array('{[', ']}'),
565
- )));
566
- ```
567
 
568
  .. _callback: http://www.php.net/manual/en/function.is-callable.php
551
  ``interpolateProvider`` service, for instance at the module initialization
552
  time:
553
 
554
+ ..code-block:: javascript
555
+
556
+ angular.module('myApp', []).config(function($interpolateProvider) {
557
+ $interpolateProvider.startSymbol('{[').endSymbol(']}');
558
+ });
559
 
560
  * For Twig, change the delimiters via the ``tag_variable`` Lexer option:
561
 
562
+ ..code-block:: php
563
+
564
+ $env->setLexer(new Twig_Lexer($env, array(
565
+ 'tag_variable' => array('{[', ']}'),
566
+ )));
567
 
568
  .. _callback: http://www.php.net/manual/en/function.is-callable.php
vendor/twig/twig/doc/tags/autoescape.rst CHANGED
@@ -6,8 +6,6 @@ template to be escaped or not by using the ``autoescape`` tag:
6
 
7
  .. code-block:: jinja
8
 
9
- {# The following syntax works as of Twig 1.8 -- see the note below for previous versions #}
10
-
11
  {% autoescape %}
12
  Everything will be automatically escaped in this block
13
  using the HTML strategy
6
 
7
  .. code-block:: jinja
8
 
 
 
9
  {% autoescape %}
10
  Everything will be automatically escaped in this block
11
  using the HTML strategy
vendor/twig/twig/doc/tags/extends.rst CHANGED
@@ -153,13 +153,17 @@ Twig supports dynamic inheritance by using a variable as the base template:
153
 
154
  {% extends some_var %}
155
 
156
- If the variable evaluates to a ``Twig_Template`` object, Twig will use it as
157
- the parent template::
158
 
159
  // {% extends layout %}
160
 
 
161
  $layout = $twig->loadTemplate('some_layout_template.twig');
162
 
 
 
 
163
  $twig->display('template.twig', array('layout' => $layout));
164
 
165
  .. versionadded:: 1.2
153
 
154
  {% extends some_var %}
155
 
156
+ If the variable evaluates to a ``Twig_Template`` or a ``Twig_TemplateWraper``
157
+ instance, Twig will use it as the parent template::
158
 
159
  // {% extends layout %}
160
 
161
+ // deprecated as of Twig 1.28
162
  $layout = $twig->loadTemplate('some_layout_template.twig');
163
 
164
+ // as of Twig 1.28
165
+ $layout = $twig->load('some_layout_template.twig');
166
+
167
  $twig->display('template.twig', array('layout' => $layout));
168
 
169
  .. versionadded:: 1.2
vendor/twig/twig/doc/tags/include.rst CHANGED
@@ -50,14 +50,18 @@ The template name can be any valid Twig expression:
50
  {% include some_var %}
51
  {% include ajax ? 'ajax.html' : 'not_ajax.html' %}
52
 
53
- And if the expression evaluates to a ``Twig_Template`` object, Twig will use it
54
- directly::
55
 
56
  // {% include template %}
57
 
 
58
  $template = $twig->loadTemplate('some_template.twig');
59
 
60
- $twig->loadTemplate('template.twig')->display(array('template' => $template));
 
 
 
61
 
62
  .. versionadded:: 1.2
63
  The ``ignore missing`` feature has been added in Twig 1.2.
50
  {% include some_var %}
51
  {% include ajax ? 'ajax.html' : 'not_ajax.html' %}
52
 
53
+ And if the expression evaluates to a ``Twig_Template`` or a
54
+ ``Twig_TemplateWrapper`` instance, Twig will use it directly::
55
 
56
  // {% include template %}
57
 
58
+ // deprecated as of Twig 1.28
59
  $template = $twig->loadTemplate('some_template.twig');
60
 
61
+ // as of Twig 1.28
62
+ $template = $twig->load('some_template.twig');
63
+
64
+ $twig->display('template.twig', array('template' => $template));
65
 
66
  .. versionadded:: 1.2
67
  The ``ignore missing`` feature has been added in Twig 1.2.
vendor/twig/twig/doc/tags/index.rst CHANGED
@@ -22,3 +22,4 @@ Tags
22
  spaceless
23
  use
24
  verbatim
 
22
  spaceless
23
  use
24
  verbatim
25
+ with
vendor/twig/twig/doc/tags/with.rst ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ``with``
2
+ ========
3
+
4
+ .. versionadded:: 1.28
5
+ The ``with`` tag was added in Twig 1.28.
6
+
7
+ Use the ``with`` tag to create a new inner scope. Variables set within this
8
+ scope are not visible outside of the scope:
9
+
10
+ .. code-block:: jinja
11
+
12
+ {% with %}
13
+ {% set foo = 42 %}
14
+ {{ foo }} foo is 42 here
15
+ {% endwith %}
16
+ foo is not visible here any longer
17
+
18
+ Instead of defining variables at the beginning of the scope, you can pass a
19
+ hash of variables you want to define in the ``with`` tag; the previous example
20
+ is equivalent to the following one:
21
+
22
+ .. code-block:: jinja
23
+
24
+ {% with { foo: 42 } %}
25
+ {{ foo }} foo is 42 here
26
+ {% endwith %}
27
+ foo is not visible here any longer
28
+
29
+ {# it works with any expression that resolves to a hash #}
30
+ {% set vars = { foo: 42 } %}
31
+ {% with vars %}
32
+ ...
33
+ {% endwith %}
34
+
35
+ By default, the inner scope has access to the outer scope context; you can
36
+ disable this behavior by appending the ``only`` keyword:
37
+
38
+ .. code-block:: jinja
39
+
40
+ {% set bar = 'bar' %}
41
+ {% with { foo: 42 } only %}
42
+ {# only foo is defined #}
43
+ {# bar is not defined #}
44
+ {% endwith %}
vendor/twig/twig/doc/templates.rst CHANGED
@@ -424,10 +424,8 @@ everything by default.
424
 
425
  Twig supports both, automatic escaping is enabled by default.
426
 
427
- .. note::
428
-
429
- Automatic escaping is only supported if the *escaper* extension has been
430
- enabled (which is the default).
431
 
432
  Working with Manual Escaping
433
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
424
 
425
  Twig supports both, automatic escaping is enabled by default.
426
 
427
+ The automatic escaping strategy can be configured via the
428
+ :ref:`autoescape<environment_options>` option and defaults to ``html``.
 
 
429
 
430
  Working with Manual Escaping
431
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vendor/twig/twig/ext/twig/php_twig.h CHANGED
@@ -15,7 +15,7 @@
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
- #define PHP_TWIG_VERSION "1.27.0"
19
 
20
  #include "php.h"
21
 
15
  #ifndef PHP_TWIG_H
16
  #define PHP_TWIG_H
17
 
18
+ #define PHP_TWIG_VERSION "1.28.2"
19
 
20
  #include "php.h"
21
 
vendor/twig/twig/lib/Twig/BaseNodeVisitor.php CHANGED
@@ -43,9 +43,6 @@ abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
43
  /**
44
  * Called before child nodes are visited.
45
  *
46
- * @param Twig_Node $node The node to visit
47
- * @param Twig_Environment $env The Twig environment instance
48
- *
49
  * @return Twig_Node The modified node
50
  */
51
  abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env);
@@ -53,9 +50,6 @@ abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface
53
  /**
54
  * Called after child nodes are visited.
55
  *
56
- * @param Twig_Node $node The node to visit
57
- * @param Twig_Environment $env The Twig environment instance
58
- *
59
  * @return Twig_Node|false The modified node or false if the node must be removed
60
  */
61
  abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
43
  /**
44
  * Called before child nodes are visited.
45
  *
 
 
 
46
  * @return Twig_Node The modified node
47
  */
48
  abstract protected function doEnterNode(Twig_Node $node, Twig_Environment $env);
50
  /**
51
  * Called after child nodes are visited.
52
  *
 
 
 
53
  * @return Twig_Node|false The modified node or false if the node must be removed
54
  */
55
  abstract protected function doLeaveNode(Twig_Node $node, Twig_Environment $env);
vendor/twig/twig/lib/Twig/Compiler.php CHANGED
@@ -26,11 +26,6 @@ class Twig_Compiler implements Twig_CompilerInterface
26
  protected $sourceLine;
27
  protected $filename;
28
 
29
- /**
30
- * Constructor.
31
- *
32
- * @param Twig_Environment $env The twig environment instance
33
- */
34
  public function __construct(Twig_Environment $env)
35
  {
36
  $this->env = $env;
@@ -49,7 +44,7 @@ class Twig_Compiler implements Twig_CompilerInterface
49
  /**
50
  * Returns the environment instance related to this compiler.
51
  *
52
- * @return Twig_Environment The environment instance
53
  */
54
  public function getEnvironment()
55
  {
@@ -72,7 +67,7 @@ class Twig_Compiler implements Twig_CompilerInterface
72
  * @param Twig_NodeInterface $node The node to compile
73
  * @param int $indentation The current indentation
74
  *
75
- * @return Twig_Compiler The current compiler instance
76
  */
77
  public function compile(Twig_NodeInterface $node, $indentation = 0)
78
  {
@@ -110,7 +105,7 @@ class Twig_Compiler implements Twig_CompilerInterface
110
  *
111
  * @param string $string The string
112
  *
113
- * @return Twig_Compiler The current compiler instance
114
  */
115
  public function raw($string)
116
  {
@@ -122,7 +117,7 @@ class Twig_Compiler implements Twig_CompilerInterface
122
  /**
123
  * Writes a string to the compiled code by adding indentation.
124
  *
125
- * @return Twig_Compiler The current compiler instance
126
  */
127
  public function write()
128
  {
@@ -137,7 +132,7 @@ class Twig_Compiler implements Twig_CompilerInterface
137
  /**
138
  * Appends an indentation to the current PHP code after compilation.
139
  *
140
- * @return Twig_Compiler The current compiler instance
141
  *
142
  * @deprecated since 1.27 (to be removed in 2.0).
143
  */
@@ -155,7 +150,7 @@ class Twig_Compiler implements Twig_CompilerInterface
155
  *
156
  * @param string $value The string
157
  *
158
- * @return Twig_Compiler The current compiler instance
159
  */
160
  public function string($value)
161
  {
@@ -169,7 +164,7 @@ class Twig_Compiler implements Twig_CompilerInterface
169
  *
170
  * @param mixed $value The value to convert
171
  *
172
- * @return Twig_Compiler The current compiler instance
173
  */
174
  public function repr($value)
175
  {
@@ -210,9 +205,7 @@ class Twig_Compiler implements Twig_CompilerInterface
210
  /**
211
  * Adds debugging information.
212
  *
213
- * @param Twig_NodeInterface $node The related twig node
214
- *
215
- * @return Twig_Compiler The current compiler instance
216
  */
217
  public function addDebugInfo(Twig_NodeInterface $node)
218
  {
@@ -249,7 +242,7 @@ class Twig_Compiler implements Twig_CompilerInterface
249
  *
250
  * @param int $step The number of indentation to add
251
  *
252
- * @return Twig_Compiler The current compiler instance
253
  */
254
  public function indent($step = 1)
255
  {
@@ -263,7 +256,7 @@ class Twig_Compiler implements Twig_CompilerInterface
263
  *
264
  * @param int $step The number of indentation to remove
265
  *
266
- * @return Twig_Compiler The current compiler instance
267
  *
268
  * @throws LogicException When trying to outdent too much so the indentation would become negative
269
  */
26
  protected $sourceLine;
27
  protected $filename;
28
 
 
 
 
 
 
29
  public function __construct(Twig_Environment $env)
30
  {
31
  $this->env = $env;
44
  /**
45
  * Returns the environment instance related to this compiler.
46
  *
47
+ * @return Twig_Environment
48
  */
49
  public function getEnvironment()
50
  {
67
  * @param Twig_NodeInterface $node The node to compile
68
  * @param int $indentation The current indentation
69
  *
70
+ * @return $this
71
  */
72
  public function compile(Twig_NodeInterface $node, $indentation = 0)
73
  {
105
  *
106
  * @param string $string The string
107
  *
108
+ * @return $this
109
  */
110
  public function raw($string)
111
  {
117
  /**
118
  * Writes a string to the compiled code by adding indentation.
119
  *
120
+ * @return $this
121
  */
122
  public function write()
123
  {
132
  /**
133
  * Appends an indentation to the current PHP code after compilation.
134
  *
135
+ * @return $this
136
  *
137
  * @deprecated since 1.27 (to be removed in 2.0).
138
  */
150
  *
151
  * @param string $value The string
152
  *
153
+ * @return $this
154
  */
155
  public function string($value)
156
  {
164
  *
165
  * @param mixed $value The value to convert
166
  *
167
+ * @return $this
168
  */
169
  public function repr($value)
170
  {
205
  /**
206
  * Adds debugging information.
207
  *
208
+ * @return $this
 
 
209
  */
210
  public function addDebugInfo(Twig_NodeInterface $node)
211
  {
242
  *
243
  * @param int $step The number of indentation to add
244
  *
245
+ * @return $this
246
  */
247
  public function indent($step = 1)
248
  {
256
  *
257
  * @param int $step The number of indentation to remove
258
  *
259
+ * @return $this
260
  *
261
  * @throws LogicException When trying to outdent too much so the indentation would become negative
262
  */
vendor/twig/twig/lib/Twig/CompilerInterface.php CHANGED
@@ -21,9 +21,7 @@ interface Twig_CompilerInterface
21
  /**
22
  * Compiles a node.
23
  *
24
- * @param Twig_NodeInterface $node The node to compile
25
- *
26
- * @return Twig_CompilerInterface The current compiler instance
27
  */
28
  public function compile(Twig_NodeInterface $node);
29
 
21
  /**
22
  * Compiles a node.
23
  *
24
+ * @return $this
 
 
25
  */
26
  public function compile(Twig_NodeInterface $node);
27
 
vendor/twig/twig/lib/Twig/Environment.php CHANGED
@@ -16,7 +16,12 @@
16
  */
17
  class Twig_Environment
18
  {
19
- const VERSION = '1.27.0';
 
 
 
 
 
20
 
21
  protected $charset;
22
  protected $loader;
@@ -89,7 +94,7 @@ class Twig_Environment
89
  * (default to -1 which means that all optimizations are enabled;
90
  * set it to 0 to disable).
91
  *
92
- * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance
93
  * @param array $options An array of options
94
  */
95
  public function __construct(Twig_LoaderInterface $loader = null, $options = array())
@@ -373,7 +378,30 @@ class Twig_Environment
373
  }
374
 
375
  /**
376
- * Loads a template by name.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  *
378
  * @param string $name The template name
379
  * @param int $index The index if it is an embedded template
@@ -382,6 +410,8 @@ class Twig_Environment
382
  *
383
  * @throws Twig_Error_Loader When the template cannot be found
384
  * @throws Twig_Error_Syntax When an error occurred during compilation
 
 
385
  */
386
  public function loadTemplate($name, $index = null)
387
  {
@@ -416,9 +446,17 @@ class Twig_Environment
416
  $this->writeCacheFile($key, $content);
417
  } else {
418
  $this->cache->write($key, $content);
 
419
  }
420
 
421
- eval('?>'.$content);
 
 
 
 
 
 
 
422
  }
423
  }
424
 
@@ -563,7 +601,7 @@ class Twig_Environment
563
  /**
564
  * Gets the Lexer instance.
565
  *
566
- * @return Twig_LexerInterface A Twig_LexerInterface instance
567
  *
568
  * @deprecated since 1.25 (to be removed in 2.0)
569
  */
@@ -578,11 +616,6 @@ class Twig_Environment
578
  return $this->lexer;
579
  }
580
 
581
- /**
582
- * Sets the Lexer instance.
583
- *
584
- * @param Twig_LexerInterface $lexer A Twig_LexerInterface instance
585
- */
586
  public function setLexer(Twig_LexerInterface $lexer)
587
  {
588
  $this->lexer = $lexer;
@@ -594,7 +627,7 @@ class Twig_Environment
594
  * @param string|Twig_Source $source The template source code
595
  * @param string $name The template name (deprecated)
596
  *
597
- * @return Twig_TokenStream A Twig_TokenStream instance
598
  *
599
  * @throws Twig_Error_Syntax When the code is syntactically wrong
600
  */
@@ -615,7 +648,7 @@ class Twig_Environment
615
  /**
616
  * Gets the Parser instance.
617
  *
618
- * @return Twig_ParserInterface A Twig_ParserInterface instance
619
  *
620
  * @deprecated since 1.25 (to be removed in 2.0)
621
  */
@@ -630,11 +663,6 @@ class Twig_Environment
630
  return $this->parser;
631
  }
632
 
633
- /**
634
- * Sets the Parser instance.
635
- *
636
- * @param Twig_ParserInterface $parser A Twig_ParserInterface instance
637
- */
638
  public function setParser(Twig_ParserInterface $parser)
639
  {
640
  $this->parser = $parser;
@@ -643,9 +671,7 @@ class Twig_Environment
643
  /**
644
  * Converts a token stream to a node tree.
645
  *
646
- * @param Twig_TokenStream $stream A token stream instance
647
- *
648
- * @return Twig_Node_Module A node tree
649
  *
650
  * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
651
  */
@@ -661,7 +687,7 @@ class Twig_Environment
661
  /**
662
  * Gets the Compiler instance.
663
  *
664
- * @return Twig_CompilerInterface A Twig_CompilerInterface instance
665
  *
666
  * @deprecated since 1.25 (to be removed in 2.0)
667
  */
@@ -676,11 +702,6 @@ class Twig_Environment
676
  return $this->compiler;
677
  }
678
 
679
- /**
680
- * Sets the Compiler instance.
681
- *
682
- * @param Twig_CompilerInterface $compiler A Twig_CompilerInterface instance
683
- */
684
  public function setCompiler(Twig_CompilerInterface $compiler)
685
  {
686
  $this->compiler = $compiler;
@@ -689,8 +710,6 @@ class Twig_Environment
689
  /**
690
  * Compiles a node and returns the PHP code.
691
  *
692
- * @param Twig_NodeInterface $node A Twig_NodeInterface instance
693
- *
694
  * @return string The compiled PHP source code
695
  */
696
  public function compile(Twig_NodeInterface $node)
@@ -729,11 +748,6 @@ class Twig_Environment
729
  }
730
  }
731
 
732
- /**
733
- * Sets the Loader instance.
734
- *
735
- * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance
736
- */
737
  public function setLoader(Twig_LoaderInterface $loader)
738
  {
739
  if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_LoaderInterface')) {
@@ -746,7 +760,7 @@ class Twig_Environment
746
  /**
747
  * Gets the Loader instance.
748
  *
749
- * @return Twig_LoaderInterface A Twig_LoaderInterface instance
750
  */
751
  public function getLoader()
752
  {
@@ -833,7 +847,7 @@ class Twig_Environment
833
  *
834
  * @param string $class The extension class name
835
  *
836
- * @return Twig_ExtensionInterface A Twig_ExtensionInterface instance
837
  */
838
  public function getExtension($class)
839
  {
@@ -878,11 +892,6 @@ class Twig_Environment
878
  throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
879
  }
880
 
881
- /**
882
- * Registers an extension.
883
- *
884
- * @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
885
- */
886
  public function addExtension(Twig_ExtensionInterface $extension)
887
  {
888
  if ($this->extensionInitialized) {
@@ -955,11 +964,6 @@ class Twig_Environment
955
  return $this->extensions;
956
  }
957
 
958
- /**
959
- * Registers a Token Parser.
960
- *
961
- * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
962
- */
963
  public function addTokenParser(Twig_TokenParserInterface $parser)
964
  {
965
  if ($this->extensionInitialized) {
@@ -972,7 +976,7 @@ class Twig_Environment
972
  /**
973
  * Gets the registered Token Parsers.
974
  *
975
- * @return Twig_TokenParserBrokerInterface A broker containing token parsers
976
  *
977
  * @internal
978
  */
@@ -990,7 +994,7 @@ class Twig_Environment
990
  *
991
  * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.
992
  *
993
- * @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances
994
  *
995
  * @internal
996
  */
@@ -1006,11 +1010,6 @@ class Twig_Environment
1006
  return $tags;
1007
  }
1008
 
1009
- /**
1010
- * Registers a Node Visitor.
1011
- *
1012
- * @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance
1013
- */
1014
  public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
1015
  {
1016
  if ($this->extensionInitialized) {
@@ -1023,7 +1022,7 @@ class Twig_Environment
1023
  /**
1024
  * Gets the registered Node Visitors.
1025
  *
1026
- * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
1027
  *
1028
  * @internal
1029
  */
@@ -1040,7 +1039,7 @@ class Twig_Environment
1040
  * Registers a Filter.
1041
  *
1042
  * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance
1043
- * @param Twig_FilterInterface|Twig_SimpleFilter $filter A Twig_FilterInterface instance or a Twig_SimpleFilter instance
1044
  */
1045
  public function addFilter($name, $filter = null)
1046
  {
@@ -1116,7 +1115,7 @@ class Twig_Environment
1116
  *
1117
  * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
1118
  *
1119
- * @return Twig_FilterInterface[] An array of Twig_FilterInterface instances
1120
  *
1121
  * @see registerUndefinedFilterCallback
1122
  *
@@ -1160,7 +1159,7 @@ class Twig_Environment
1160
  /**
1161
  * Gets the registered Tests.
1162
  *
1163
- * @return Twig_TestInterface[] An array of Twig_TestInterface instances
1164
  *
1165
  * @internal
1166
  */
@@ -1199,7 +1198,7 @@ class Twig_Environment
1199
  * Registers a Function.
1200
  *
1201
  * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance
1202
- * @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance
1203
  */
1204
  public function addFunction($name, $function = null)
1205
  {
@@ -1275,7 +1274,7 @@ class Twig_Environment
1275
  *
1276
  * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
1277
  *
1278
- * @return Twig_FunctionInterface[] An array of Twig_FunctionInterface instances
1279
  *
1280
  * @see registerUndefinedFunctionCallback
1281
  *
16
  */
17
  class Twig_Environment
18
  {
19
+ const VERSION = '1.28.2';
20
+ const VERSION_ID = 12802;
21
+ const MAJOR_VERSION = 1;
22
+ const MINOR_VERSION = 28;
23
+ const RELEASE_VERSION = 2;
24
+ const EXTRA_VERSION = '';
25
 
26
  protected $charset;
27
  protected $loader;
94
  * (default to -1 which means that all optimizations are enabled;
95
  * set it to 0 to disable).
96
  *
97
+ * @param Twig_LoaderInterface $loader
98
  * @param array $options An array of options
99
  */
100
  public function __construct(Twig_LoaderInterface $loader = null, $options = array())
378
  }
379
 
380
  /**
381
+ * Loads a template.
382
+ *
383
+ * @param string|Twig_TemplateWrapper|Twig_Template $name The template name
384
+ *
385
+ * @return Twig_TemplateWrapper
386
+ */
387
+ public function load($name)
388
+ {
389
+ if ($name instanceof Twig_TemplateWrapper) {
390
+ return $name;
391
+ }
392
+
393
+ if ($name instanceof Twig_Template) {
394
+ return new Twig_TemplateWrapper($this, $name);
395
+ }
396
+
397
+ return new Twig_TemplateWrapper($this, $this->loadTemplate($name));
398
+ }
399
+
400
+ /**
401
+ * Loads a template internal representation.
402
+ *
403
+ * This method is for internal use only and should never be called
404
+ * directly.
405
  *
406
  * @param string $name The template name
407
  * @param int $index The index if it is an embedded template
410
  *
411
  * @throws Twig_Error_Loader When the template cannot be found
412
  * @throws Twig_Error_Syntax When an error occurred during compilation
413
+ *
414
+ * @internal
415
  */
416
  public function loadTemplate($name, $index = null)
417
  {
446
  $this->writeCacheFile($key, $content);
447
  } else {
448
  $this->cache->write($key, $content);
449
+ $this->cache->load($key);
450
  }
451
 
452
+ if (!class_exists($cls, false)) {
453
+ /* Last line of defense if either $this->bcWriteCacheFile was used,
454
+ * $this->cache is implemented as a no-op or we have a race condition
455
+ * where the cache was cleared between the above calls to write to and load from
456
+ * the cache.
457
+ */
458
+ eval('?>'.$content);
459
+ }
460
  }
461
  }
462
 
601
  /**
602
  * Gets the Lexer instance.
603
  *
604
+ * @return Twig_LexerInterface
605
  *
606
  * @deprecated since 1.25 (to be removed in 2.0)
607
  */
616
  return $this->lexer;
617
  }
618
 
 
 
 
 
 
619
  public function setLexer(Twig_LexerInterface $lexer)
620
  {
621
  $this->lexer = $lexer;
627
  * @param string|Twig_Source $source The template source code
628
  * @param string $name The template name (deprecated)
629
  *
630
+ * @return Twig_TokenStream
631
  *
632
  * @throws Twig_Error_Syntax When the code is syntactically wrong
633
  */
648
  /**
649
  * Gets the Parser instance.
650
  *
651
+ * @return Twig_ParserInterface
652
  *
653
  * @deprecated since 1.25 (to be removed in 2.0)
654
  */
663
  return $this->parser;
664
  }
665
 
 
 
 
 
 
666
  public function setParser(Twig_ParserInterface $parser)
667
  {
668
  $this->parser = $parser;
671
  /**
672
  * Converts a token stream to a node tree.
673
  *
674
+ * @return Twig_Node_Module
 
 
675
  *
676
  * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
677
  */
687
  /**
688
  * Gets the Compiler instance.
689
  *
690
+ * @return Twig_CompilerInterface
691
  *
692
  * @deprecated since 1.25 (to be removed in 2.0)
693
  */
702
  return $this->compiler;
703
  }
704
 
 
 
 
 
 
705
  public function setCompiler(Twig_CompilerInterface $compiler)
706
  {
707
  $this->compiler = $compiler;
710
  /**
711
  * Compiles a node and returns the PHP code.
712
  *
 
 
713
  * @return string The compiled PHP source code
714
  */
715
  public function compile(Twig_NodeInterface $node)
748
  }
749
  }
750
 
 
 
 
 
 
751
  public function setLoader(Twig_LoaderInterface $loader)
752
  {
753
  if (!$loader instanceof Twig_SourceContextLoaderInterface && 0 !== strpos(get_class($loader), 'Mock_Twig_LoaderInterface')) {
760
  /**
761
  * Gets the Loader instance.
762
  *
763
+ * @return Twig_LoaderInterface
764
  */
765
  public function getLoader()
766
  {
847
  *
848
  * @param string $class The extension class name
849
  *
850
+ * @return Twig_ExtensionInterface
851
  */
852
  public function getExtension($class)
853
  {
892
  throw new Twig_Error_Runtime(sprintf('Unable to load the "%s" runtime.', $class));
893
  }
894
 
 
 
 
 
 
895
  public function addExtension(Twig_ExtensionInterface $extension)
896
  {
897
  if ($this->extensionInitialized) {
964
  return $this->extensions;
965
  }
966
 
 
 
 
 
 
967
  public function addTokenParser(Twig_TokenParserInterface $parser)
968
  {
969
  if ($this->extensionInitialized) {
976
  /**
977
  * Gets the registered Token Parsers.
978
  *
979
+ * @return Twig_TokenParserBrokerInterface
980
  *
981
  * @internal
982
  */
994
  *
995
  * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.
996
  *
997
+ * @return Twig_TokenParserInterface[]
998
  *
999
  * @internal
1000
  */
1010
  return $tags;
1011
  }
1012
 
 
 
 
 
 
1013
  public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
1014
  {
1015
  if ($this->extensionInitialized) {
1022
  /**
1023
  * Gets the registered Node Visitors.
1024
  *
1025
+ * @return Twig_NodeVisitorInterface[]
1026
  *
1027
  * @internal
1028
  */
1039
  * Registers a Filter.
1040
  *
1041
  * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance
1042
+ * @param Twig_FilterInterface|Twig_SimpleFilter $filter
1043
  */
1044
  public function addFilter($name, $filter = null)
1045
  {
1115
  *
1116
  * Be warned that this method cannot return filters defined with registerUndefinedFilterCallback.
1117
  *
1118
+ * @return Twig_FilterInterface[]
1119
  *
1120
  * @see registerUndefinedFilterCallback
1121
  *
1159
  /**
1160
  * Gets the registered Tests.
1161
  *
1162
+ * @return Twig_TestInterface[]
1163
  *
1164
  * @internal
1165
  */
1198
  * Registers a Function.
1199
  *
1200
  * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance
1201
+ * @param Twig_FunctionInterface|Twig_SimpleFunction $function
1202
  */
1203
  public function addFunction($name, $function = null)
1204
  {
1274
  *
1275
  * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
1276
  *
1277
+ * @return Twig_FunctionInterface[]
1278
  *
1279
  * @see registerUndefinedFunctionCallback
1280
  *
vendor/twig/twig/lib/Twig/ExpressionParser.php CHANGED
@@ -344,7 +344,12 @@ class Twig_ExpressionParser
344
 
345
  return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line);
346
  case 'block':
347
- return new Twig_Node_Expression_BlockReference($this->parseArguments()->getNode(0), false, $line);
 
 
 
 
 
348
  case 'attribute':
349
  $args = $this->parseArguments();
350
  if (count($args) < 2) {
344
 
345
  return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line);
346
  case 'block':
347
+ $args = $this->parseArguments();
348
+ if (count($args) < 1) {
349
+ throw new Twig_Error_Syntax('The "block" function takes one argument (the block name).', $line, $this->parser->getStream()->getSourceContext()->getName());
350
+ }
351
+
352
+ return new Twig_Node_Expression_BlockReference($args->getNode(0), count($args) > 1 ? $args->getNode(1) : null, $line);
353
  case 'attribute':
354
  $args = $this->parseArguments();
355
  if (count($args) < 2) {
vendor/twig/twig/lib/Twig/Extension/Core.php CHANGED
@@ -132,6 +132,7 @@ class Twig_Extension_Core extends Twig_Extension
132
  new Twig_TokenParser_Flush(),
133
  new Twig_TokenParser_Do(),
134
  new Twig_TokenParser_Embed(),
 
135
  );
136
  }
137
 
@@ -275,7 +276,7 @@ class Twig_Extension_Core extends Twig_Extension
275
  /**
276
  * Cycles over a value.
277
  *
278
- * @param ArrayAccess|array $values An array or an ArrayAccess instance
279
  * @param int $position The cycle position
280
  *
281
  * @return string The next value in the cycle
@@ -295,8 +296,8 @@ function twig_cycle($values, $position)
295
  * - a random character from a string
296
  * - a random integer between 0 and the integer parameter.
297
  *
298
- * @param Twig_Environment $env A Twig_Environment instance
299
- * @param Traversable|array|int|string $values The values to pick a random item from
300
  *
301
  * @throws Twig_Error_Runtime When $values is an empty array (does not apply to an empty string which is returned as is).
302
  *
@@ -355,7 +356,7 @@ function twig_random(Twig_Environment $env, $values = null)
355
  * {{ post.published_at|date("m/d/Y") }}
356
  * </pre>
357
  *
358
- * @param Twig_Environment $env A Twig_Environment instance
359
  * @param DateTime|DateTimeInterface|DateInterval|string $date A date
360
  * @param string|null $format The target format, null to use the default
361
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
@@ -383,7 +384,7 @@ function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $
383
  * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
384
  * </pre>
385
  *
386
- * @param Twig_Environment $env A Twig_Environment instance
387
  * @param DateTime|string $date A date
388
  * @param string $modifier A modifier string
389
  *
@@ -409,7 +410,7 @@ function twig_date_modify_filter(Twig_Environment $env, $date, $modifier)
409
  * {% endif %}
410
  * </pre>
411
  *
412
- * @param Twig_Environment $env A Twig_Environment instance
413
  * @param DateTime|DateTimeInterface|string|null $date A date
414
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
415
  *
@@ -511,7 +512,7 @@ function twig_round($value, $precision = 0, $method = 'common')
511
  * be used. Supplying any of the parameters will override the defaults set in the
512
  * environment object.
513
  *
514
- * @param Twig_Environment $env A Twig_Environment instance
515
  * @param mixed $number A float/int/string of the number to format
516
  * @param int $decimal The number of decimal points to display.
517
  * @param string $decimalPoint The character(s) to use for the decimal point.
@@ -640,7 +641,7 @@ function twig_array_merge($arr1, $arr2)
640
  /**
641
  * Slices a variable.
642
  *
643
- * @param Twig_Environment $env A Twig_Environment instance
644
  * @param mixed $item A variable
645
  * @param int $start Start of the slice
646
  * @param int $length Size of the slice
@@ -682,7 +683,7 @@ function twig_slice(Twig_Environment $env, $item, $start, $length = null, $prese
682
  /**
683
  * Returns the first element of the item.
684
  *
685
- * @param Twig_Environment $env A Twig_Environment instance
686
  * @param mixed $item A variable
687
  *
688
  * @return mixed The first element of the item
@@ -697,7 +698,7 @@ function twig_first(Twig_Environment $env, $item)
697
  /**
698
  * Returns the last element of the item.
699
  *
700
- * @param Twig_Environment $env A Twig_Environment instance
701
  * @param mixed $item A variable
702
  *
703
  * @return mixed The last element of the item
@@ -753,7 +754,7 @@ function twig_join_filter($value, $glue = '')
753
  * {# returns [aa, bb, cc] #}
754
  * </pre>
755
  *
756
- * @param Twig_Environment $env A Twig_Environment instance
757
  * @param string $value A string
758
  * @param string $delimiter The delimiter
759
  * @param int $limit The limit
@@ -833,7 +834,7 @@ function twig_get_array_keys_filter($array)
833
  /**
834
  * Reverses a variable.
835
  *
836
- * @param Twig_Environment $env A Twig_Environment instance
837
  * @param array|Traversable|string $item An array, a Traversable instance, or a string
838
  * @param bool $preserveKeys Whether to preserve key or not
839
  *
@@ -909,7 +910,7 @@ function twig_in_filter($value, $compare)
909
  /**
910
  * Escapes a string.
911
  *
912
- * @param Twig_Environment $env A Twig_Environment instance
913
  * @param mixed $string The value to be escaped
914
  * @param string $strategy The escaping strategy
915
  * @param string $charset The charset
@@ -990,7 +991,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
990
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
991
  }
992
 
993
- if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) {
994
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
995
  }
996
 
@@ -1007,7 +1008,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1007
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
1008
  }
1009
 
1010
- if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) {
1011
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1012
  }
1013
 
@@ -1024,7 +1025,7 @@ function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html',
1024
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
1025
  }
1026
 
1027
- if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) {
1028
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1029
  }
1030
 
@@ -1188,7 +1189,7 @@ if (function_exists('mb_get_info')) {
1188
  /**
1189
  * Returns the length of a variable.
1190
  *
1191
- * @param Twig_Environment $env A Twig_Environment instance
1192
  * @param mixed $thing A variable
1193
  *
1194
  * @return int The length of the value
@@ -1201,7 +1202,7 @@ if (function_exists('mb_get_info')) {
1201
  /**
1202
  * Converts a string to uppercase.
1203
  *
1204
- * @param Twig_Environment $env A Twig_Environment instance
1205
  * @param string $string A string
1206
  *
1207
  * @return string The uppercased string
@@ -1218,7 +1219,7 @@ if (function_exists('mb_get_info')) {
1218
  /**
1219
  * Converts a string to lowercase.
1220
  *
1221
- * @param Twig_Environment $env A Twig_Environment instance
1222
  * @param string $string A string
1223
  *
1224
  * @return string The lowercased string
@@ -1235,7 +1236,7 @@ if (function_exists('mb_get_info')) {
1235
  /**
1236
  * Returns a titlecased string.
1237
  *
1238
- * @param Twig_Environment $env A Twig_Environment instance
1239
  * @param string $string A string
1240
  *
1241
  * @return string The titlecased string
@@ -1252,7 +1253,7 @@ if (function_exists('mb_get_info')) {
1252
  /**
1253
  * Returns a capitalized string.
1254
  *
1255
- * @param Twig_Environment $env A Twig_Environment instance
1256
  * @param string $string A string
1257
  *
1258
  * @return string The capitalized string
@@ -1271,7 +1272,7 @@ else {
1271
  /**
1272
  * Returns the length of a variable.
1273
  *
1274
- * @param Twig_Environment $env A Twig_Environment instance
1275
  * @param mixed $thing A variable
1276
  *
1277
  * @return int The length of the value
@@ -1284,7 +1285,7 @@ else {
1284
  /**
1285
  * Returns a titlecased string.
1286
  *
1287
- * @param Twig_Environment $env A Twig_Environment instance
1288
  * @param string $string A string
1289
  *
1290
  * @return string The titlecased string
@@ -1297,7 +1298,7 @@ else {
1297
  /**
1298
  * Returns a capitalized string.
1299
  *
1300
- * @param Twig_Environment $env A Twig_Environment instance
1301
  * @param string $string A string
1302
  *
1303
  * @return string The capitalized string
@@ -1452,6 +1453,23 @@ function twig_constant($constant, $object = null)
1452
  return constant($constant);
1453
  }
1454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1455
  /**
1456
  * Batches item.
1457
  *
132
  new Twig_TokenParser_Flush(),
133
  new Twig_TokenParser_Do(),
134
  new Twig_TokenParser_Embed(),
135
+ new Twig_TokenParser_With(),
136
  );
137
  }
138
 
276
  /**
277
  * Cycles over a value.
278
  *
279
+ * @param ArrayAccess|array $values
280
  * @param int $position The cycle position
281
  *
282
  * @return string The next value in the cycle
296
  * - a random character from a string
297
  * - a random integer between 0 and the integer parameter.
298
  *
299
+ * @param Twig_Environment $env
300
+ * @param Traversable|array|int|float|string $values The values to pick a random item from
301
  *
302
  * @throws Twig_Error_Runtime When $values is an empty array (does not apply to an empty string which is returned as is).
303
  *
356
  * {{ post.published_at|date("m/d/Y") }}
357
  * </pre>
358
  *
359
+ * @param Twig_Environment $env
360
  * @param DateTime|DateTimeInterface|DateInterval|string $date A date
361
  * @param string|null $format The target format, null to use the default
362
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
384
  * {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
385
  * </pre>
386
  *
387
+ * @param Twig_Environment $env
388
  * @param DateTime|string $date A date
389
  * @param string $modifier A modifier string
390
  *
410
  * {% endif %}
411
  * </pre>
412
  *
413
+ * @param Twig_Environment $env
414
  * @param DateTime|DateTimeInterface|string|null $date A date
415
  * @param DateTimeZone|string|null|false $timezone The target timezone, null to use the default, false to leave unchanged
416
  *
512
  * be used. Supplying any of the parameters will override the defaults set in the
513
  * environment object.
514
  *
515
+ * @param Twig_Environment $env
516
  * @param mixed $number A float/int/string of the number to format
517
  * @param int $decimal The number of decimal points to display.
518
  * @param string $decimalPoint The character(s) to use for the decimal point.
641
  /**
642
  * Slices a variable.
643
  *
644
+ * @param Twig_Environment $env
645
  * @param mixed $item A variable
646
  * @param int $start Start of the slice
647
  * @param int $length Size of the slice
683
  /**
684
  * Returns the first element of the item.
685
  *
686
+ * @param Twig_Environment $env
687
  * @param mixed $item A variable
688
  *
689
  * @return mixed The first element of the item
698
  /**
699
  * Returns the last element of the item.
700
  *
701
+ * @param Twig_Environment $env
702
  * @param mixed $item A variable
703
  *
704
  * @return mixed The last element of the item
754
  * {# returns [aa, bb, cc] #}
755
  * </pre>
756
  *
757
+ * @param Twig_Environment $env
758
  * @param string $value A string
759
  * @param string $delimiter The delimiter
760
  * @param int $limit The limit
834
  /**
835
  * Reverses a variable.
836
  *
837
+ * @param Twig_Environment $env
838
  * @param array|Traversable|string $item An array, a Traversable instance, or a string
839
  * @param bool $preserveKeys Whether to preserve key or not
840
  *
910
  /**
911
  * Escapes a string.
912
  *
913
+ * @param Twig_Environment $env
914
  * @param mixed $string The value to be escaped
915
  * @param string $strategy The escaping strategy
916
  * @param string $charset The charset
991
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
992
  }
993
 
994
+ if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
995
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
996
  }
997
 
1008
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
1009
  }
1010
 
1011
+ if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1012
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1013
  }
1014
 
1025
  $string = twig_convert_encoding($string, 'UTF-8', $charset);
1026
  }
1027
 
1028
+ if (0 == strlen($string) ? false : 1 !== preg_match('/^./su', $string)) {
1029
  throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.');
1030
  }
1031
 
1189
  /**
1190
  * Returns the length of a variable.
1191
  *
1192
+ * @param Twig_Environment $env
1193
  * @param mixed $thing A variable
1194
  *
1195
  * @return int The length of the value
1202
  /**
1203
  * Converts a string to uppercase.
1204
  *
1205
+ * @param Twig_Environment $env
1206
  * @param string $string A string
1207
  *
1208
  * @return string The uppercased string
1219
  /**
1220
  * Converts a string to lowercase.
1221
  *
1222
+ * @param Twig_Environment $env
1223
  * @param string $string A string
1224
  *
1225
  * @return string The lowercased string
1236
  /**
1237
  * Returns a titlecased string.
1238
  *
1239
+ * @param Twig_Environment $env
1240
  * @param string $string A string
1241
  *
1242
  * @return string The titlecased string
1253
  /**
1254
  * Returns a capitalized string.
1255
  *
1256
+ * @param Twig_Environment $env
1257
  * @param string $string A string
1258
  *
1259
  * @return string The capitalized string
1272
  /**
1273
  * Returns the length of a variable.
1274
  *
1275
+ * @param Twig_Environment $env
1276
  * @param mixed $thing A variable
1277
  *
1278
  * @return int The length of the value
1285
  /**
1286
  * Returns a titlecased string.
1287
  *
1288
+ * @param Twig_Environment $env
1289
  * @param string $string A string
1290
  *
1291
  * @return string The titlecased string
1298
  /**
1299
  * Returns a capitalized string.
1300
  *
1301
+ * @param Twig_Environment $env
1302
  * @param string $string A string
1303
  *
1304
  * @return string The capitalized string
1453
  return constant($constant);
1454
  }
1455
 
1456
+ /**
1457
+ * Checks if a constant exists.
1458
+ *
1459
+ * @param string $constant The name of the constant
1460
+ * @param null|object $object The object to get the constant from
1461
+ *
1462
+ * @return bool
1463
+ */
1464
+ function twig_constant_is_defined($constant, $object = null)
1465
+ {
1466
+ if (null !== $object) {
1467
+ $constant = get_class($object).'::'.$constant;
1468
+ }
1469
+
1470
+ return defined($constant);
1471
+ }
1472
+
1473
  /**
1474
  * Batches item.
1475
  *
vendor/twig/twig/lib/Twig/Extension/Escaper.php CHANGED
@@ -13,8 +13,6 @@ class Twig_Extension_Escaper extends Twig_Extension
13
  protected $defaultStrategy;
14
 
15
  /**
16
- * Constructor.
17
- *
18
  * @param string|false|callable $defaultStrategy An escaping strategy
19
  *
20
  * @see setDefaultStrategy()
13
  protected $defaultStrategy;
14
 
15
  /**
 
 
16
  * @param string|false|callable $defaultStrategy An escaping strategy
17
  *
18
  * @see setDefaultStrategy()
vendor/twig/twig/lib/Twig/Extension/StringLoader.php CHANGED
@@ -33,7 +33,7 @@ class Twig_Extension_StringLoader extends Twig_Extension
33
  * @param Twig_Environment $env A Twig_Environment instance
34
  * @param string $template A template as a string or object implementing __toString()
35
  *
36
- * @return Twig_Template A Twig_Template instance
37
  */
38
  function twig_template_from_string(Twig_Environment $env, $template)
39
  {
33
  * @param Twig_Environment $env A Twig_Environment instance
34
  * @param string $template A template as a string or object implementing __toString()
35
  *
36
+ * @return Twig_Template
37
  */
38
  function twig_template_from_string(Twig_Environment $env, $template)
39
  {
vendor/twig/twig/lib/Twig/ExtensionInterface.php CHANGED
@@ -21,8 +21,6 @@ interface Twig_ExtensionInterface
21
  *
22
  * This is where you can load some file that contains filter functions for instance.
23
  *
24
- * @param Twig_Environment $environment The current Twig_Environment instance
25
- *
26
  * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
27
  */
28
  public function initRuntime(Twig_Environment $environment);
@@ -37,7 +35,7 @@ interface Twig_ExtensionInterface
37
  /**
38
  * Returns the node visitor instances to add to the existing list.
39
  *
40
- * @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
41
  */
42
  public function getNodeVisitors();
43
 
21
  *
22
  * This is where you can load some file that contains filter functions for instance.
23
  *
 
 
24
  * @deprecated since 1.23 (to be removed in 2.0), implement Twig_Extension_InitRuntimeInterface instead
25
  */
26
  public function initRuntime(Twig_Environment $environment);
35
  /**
36
  * Returns the node visitor instances to add to the existing list.
37
  *
38
+ * @return Twig_NodeVisitorInterface[]
39
  */
40
  public function getNodeVisitors();
41
 
vendor/twig/twig/lib/Twig/LexerInterface.php CHANGED
@@ -24,7 +24,7 @@ interface Twig_LexerInterface
24
  * @param string|Twig_Source $code The source code
25
  * @param string $name A unique identifier for the source code
26
  *
27
- * @return Twig_TokenStream A token stream instance
28
  *
29
  * @throws Twig_Error_Syntax When the code is syntactically wrong
30
  */
24
  * @param string|Twig_Source $code The source code
25
  * @param string $name A unique identifier for the source code
26
  *
27
+ * @return Twig_TokenStream
28
  *
29
  * @throws Twig_Error_Syntax When the code is syntactically wrong
30
  */
vendor/twig/twig/lib/Twig/Loader/Array.php CHANGED
@@ -26,11 +26,9 @@ class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
26
  protected $templates = array();
27
 
28
  /**
29
- * Constructor.
30
- *
31
  * @param array $templates An array of templates (keys are the names, and values are the source code)
32
  */
33
- public function __construct(array $templates)
34
  {
35
  $this->templates = $templates;
36
  }
26
  protected $templates = array();
27
 
28
  /**
 
 
29
  * @param array $templates An array of templates (keys are the names, and values are the source code)
30
  */
31
+ public function __construct(array $templates = array())
32
  {
33
  $this->templates = $templates;
34
  }
vendor/twig/twig/lib/Twig/Loader/Chain.php CHANGED
@@ -20,9 +20,7 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
20
  protected $loaders = array();
21
 
22
  /**
23
- * Constructor.
24
- *
25
- * @param Twig_LoaderInterface[] $loaders An array of loader instances
26
  */
27
  public function __construct(array $loaders = array())
28
  {
@@ -31,11 +29,6 @@ class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterf
31
  }
32
  }
33
 
34
- /**
35
- * Adds a loader instance.
36
- *
37
- * @param Twig_LoaderInterface $loader A Loader instance
38
- */
39
  public function addLoader(Twig_LoaderInterface $loader)
40
  {
41
  $this->loaders[] = $loader;
20
  protected $loaders = array();
21
 
22
  /**
23
+ * @param Twig_LoaderInterface[] $loaders
 
 
24
  */
25
  public function __construct(array $loaders = array())
26
  {
29
  }
30
  }
31
 
 
 
 
 
 
32
  public function addLoader(Twig_LoaderInterface $loader)
33
  {
34
  $this->loaders[] = $loader;
vendor/twig/twig/lib/Twig/Loader/Filesystem.php CHANGED
@@ -26,8 +26,6 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
26
  private $rootPath;
27
 
28
  /**
29
- * Constructor.
30
- *
31
  * @param string|array $paths A path or an array of paths where to look for templates
32
  * @param string|null $rootPath The root path common to all relative paths (null for getcwd())
33
  */
26
  private $rootPath;
27
 
28
  /**
 
 
29
  * @param string|array $paths A path or an array of paths where to look for templates
30
  * @param string|null $rootPath The root path common to all relative paths (null for getcwd())
31
  */
vendor/twig/twig/lib/Twig/Node.php CHANGED
@@ -128,7 +128,7 @@ class Twig_Node implements Twig_NodeInterface
128
  */
129
  public function getLine()
130
  {
131
- @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateName() instead.', E_USER_DEPRECATED);
132
 
133
  return $this->lineno;
134
  }
@@ -139,11 +139,7 @@ class Twig_Node implements Twig_NodeInterface
139
  }
140
 
141
  /**
142
- * Returns true if the attribute is defined.
143
- *
144
- * @param string $name The attribute name
145
- *
146
- * @return bool true if the attribute is defined, false otherwise
147
  */
148
  public function hasAttribute($name)
149
  {
@@ -151,10 +147,6 @@ class Twig_Node implements Twig_NodeInterface
151
  }
152
 
153
  /**
154
- * Gets an attribute value by name.
155
- *
156
- * @param string $name
157
- *
158
  * @return mixed
159
  */
160
  public function getAttribute($name)
@@ -167,8 +159,6 @@ class Twig_Node implements Twig_NodeInterface
167
  }
168
 
169
  /**
170
- * Sets an attribute by name to a value.
171
- *
172
  * @param string $name
173
  * @param mixed $value
174
  */
@@ -177,21 +167,12 @@ class Twig_Node implements Twig_NodeInterface
177
  $this->attributes[$name] = $value;
178
  }
179
 
180
- /**
181
- * Removes an attribute by name.
182
- *
183
- * @param string $name
184
- */
185
  public function removeAttribute($name)
186
  {
187
  unset($this->attributes[$name]);
188
  }
189
 
190
  /**
191
- * Returns true if the node with the given name exists.
192
- *
193
- * @param string $name
194
- *
195
  * @return bool
196
  */
197
  public function hasNode($name)
@@ -200,10 +181,6 @@ class Twig_Node implements Twig_NodeInterface
200
  }
201
 
202
  /**
203
- * Gets a node by name.
204
- *
205
- * @param string $name
206
- *
207
  * @return Twig_Node
208
  */
209
  public function getNode($name)
@@ -215,12 +192,6 @@ class Twig_Node implements Twig_NodeInterface
215
  return $this->nodes[$name];
216
  }
217
 
218
- /**
219
- * Sets a node.
220
- *
221
- * @param string $name
222
- * @param Twig_Node $node
223
- */
224
  public function setNode($name, $node = null)
225
  {
226
  if (!$node instanceof Twig_NodeInterface) {
@@ -230,11 +201,6 @@ class Twig_Node implements Twig_NodeInterface
230
  $this->nodes[$name] = $node;
231
  }
232
 
233
- /**
234
- * Removes a node by name.
235
- *
236
- * @param string $name
237
- */
238
  public function removeNode($name)
239
  {
240
  unset($this->nodes[$name]);
128
  */
129
  public function getLine()
130
  {
131
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getTemplateLine() instead.', E_USER_DEPRECATED);
132
 
133
  return $this->lineno;
134
  }
139
  }
140
 
141
  /**
142
+ * @return bool
 
 
 
 
143
  */
144
  public function hasAttribute($name)
145
  {
147
  }
148
 
149
  /**
 
 
 
 
150
  * @return mixed
151
  */
152
  public function getAttribute($name)
159
  }
160
 
161
  /**
 
 
162
  * @param string $name
163
  * @param mixed $value
164
  */
167
  $this->attributes[$name] = $value;
168
  }
169
 
 
 
 
 
 
170
  public function removeAttribute($name)
171
  {
172
  unset($this->attributes[$name]);
173
  }
174
 
175
  /**
 
 
 
 
176
  * @return bool
177
  */
178
  public function hasNode($name)
181
  }
182
 
183
  /**
 
 
 
 
184
  * @return Twig_Node
185
  */
186
  public function getNode($name)
192
  return $this->nodes[$name];
193
  }
194
 
 
 
 
 
 
 
195
  public function setNode($name, $node = null)
196
  {
197
  if (!$node instanceof Twig_NodeInterface) {
201
  $this->nodes[$name] = $node;
202
  }
203
 
 
 
 
 
 
204
  public function removeNode($name)
205
  {
206
  unset($this->nodes[$name]);
vendor/twig/twig/lib/Twig/Node/Expression/Array.php CHANGED
@@ -43,7 +43,7 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression
43
  foreach ($this->getKeyValuePairs() as $pair) {
44
  // we compare the string representation of the keys
45
  // to avoid comparing the line numbers which are not relevant here.
46
- if ((string) $key == (string) $pair['key']) {
47
  return true;
48
  }
49
  }
43
  foreach ($this->getKeyValuePairs() as $pair) {
44
  // we compare the string representation of the keys
45
  // to avoid comparing the line numbers which are not relevant here.
46
+ if ((string) $key === (string) $pair['key']) {
47
  return true;
48
  }
49
  }
vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php CHANGED
@@ -12,6 +12,10 @@ class Twig_Node_Expression_Binary_Power extends Twig_Node_Expression_Binary
12
  {
13
  public function compile(Twig_Compiler $compiler)
14
  {
 
 
 
 
15
  $compiler
16
  ->raw('pow(')
17
  ->subcompile($this->getNode('left'))
12
  {
13
  public function compile(Twig_Compiler $compiler)
14
  {
15
+ if (PHP_VERSION_ID >= 50600) {
16
+ return parent::compile($compiler);
17
+ }
18
+
19
  $compiler
20
  ->raw('pow(')
21
  ->subcompile($this->getNode('left'))
vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php CHANGED
@@ -17,30 +17,75 @@
17
  */
18
  class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
19
  {
20
- public function __construct(Twig_NodeInterface $name, $asString = false, $lineno, $tag = null)
 
 
 
21
  {
22
- parent::__construct(array('name' => $name), array('as_string' => $asString, 'output' => false), $lineno, $tag);
 
 
 
 
 
 
 
 
 
 
 
23
  }
24
 
25
  public function compile(Twig_Compiler $compiler)
26
  {
27
- if ($this->getAttribute('as_string')) {
28
- $compiler->raw('(string) ');
 
 
 
 
 
 
 
 
 
 
29
  }
 
30
 
31
- if ($this->getAttribute('output')) {
32
- $compiler
33
- ->addDebugInfo($this)
34
- ->write('$this->displayBlock(')
35
- ->subcompile($this->getNode('name'))
36
- ->raw(", \$context, \$blocks);\n")
37
- ;
38
  } else {
39
  $compiler
40
- ->raw('$this->renderBlock(')
41
- ->subcompile($this->getNode('name'))
42
- ->raw(', $context, $blocks)')
 
 
 
 
43
  ;
44
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  }
46
  }
17
  */
18
  class Twig_Node_Expression_BlockReference extends Twig_Node_Expression
19
  {
20
+ /**
21
+ * @param Twig_Node|null $template
22
+ */
23
+ public function __construct(Twig_NodeInterface $name, $template = null, $lineno, $tag = null)
24
  {
25
+ if (is_bool($template)) {
26
+ @trigger_error(sprintf('The %s method "$asString" argument is deprecated since version 1.28 and will be removed in 2.0.', __METHOD__), E_USER_DEPRECATED);
27
+
28
+ $template = null;
29
+ }
30
+
31
+ $nodes = array('name' => $name);
32
+ if (null !== $template) {
33
+ $nodes['template'] = $template;
34
+ }
35
+
36
+ parent::__construct($nodes, array('is_defined_test' => false, 'output' => false), $lineno, $tag);
37
  }
38
 
39
  public function compile(Twig_Compiler $compiler)
40
  {
41
+ if ($this->getAttribute('is_defined_test')) {
42
+ $this->compileTemplateCall($compiler, 'hasBlock');
43
+ } else {
44
+ if ($this->getAttribute('output')) {
45
+ $compiler->addDebugInfo($this);
46
+
47
+ $this
48
+ ->compileTemplateCall($compiler, 'displayBlock')
49
+ ->raw(";\n");
50
+ } else {
51
+ $this->compileTemplateCall($compiler, 'renderBlock');
52
+ }
53
  }
54
+ }
55
 
56
+ private function compileTemplateCall(Twig_Compiler $compiler, $method)
57
+ {
58
+ if (!$this->hasNode('template')) {
59
+ $compiler->write('$this');
 
 
 
60
  } else {
61
  $compiler
62
+ ->write('$this->loadTemplate(')
63
+ ->subcompile($this->getNode('template'))
64
+ ->raw(', ')
65
+ ->repr($this->getTemplateName())
66
+ ->raw(', ')
67
+ ->repr($this->getTemplateLine())
68
+ ->raw(')')
69
  ;
70
  }
71
+
72
+ $compiler->raw(sprintf('->%s', $method));
73
+ $this->compileBlockArguments($compiler);
74
+
75
+ return $compiler;
76
+ }
77
+
78
+ private function compileBlockArguments(Twig_Compiler $compiler)
79
+ {
80
+ $compiler
81
+ ->raw('(')
82
+ ->subcompile($this->getNode('name'))
83
+ ->raw(', $context');
84
+
85
+ if (!$this->hasNode('template')) {
86
+ $compiler->raw(', $blocks');
87
+ }
88
+
89
+ return $compiler->raw(')');
90
  }
91
  }
vendor/twig/twig/lib/Twig/Node/Expression/Call.php CHANGED
@@ -146,7 +146,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
146
  throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
147
  }
148
 
149
- if (!empty($missingArguments)) {
150
  throw new Twig_Error_Syntax(sprintf(
151
  'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
152
  $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
@@ -218,7 +218,7 @@ abstract class Twig_Node_Expression_Call extends Twig_Node_Expression
218
 
219
  private function getCallableParameters($callable, $isVariadic)
220
  {
221
- list($r, $_) = $this->reflectCallable($callable);
222
  if (null === $r) {
223
  return array();
224
  }
146
  throw new Twig_Error_Syntax(sprintf('Argument "%s" is defined twice for %s "%s".', $name, $callType, $callName));
147
  }
148
 
149
+ if (count($missingArguments)) {
150
  throw new Twig_Error_Syntax(sprintf(
151
  'Argument "%s" could not be assigned for %s "%s(%s)" because it is mapped to an internal PHP function which cannot determine default value for optional argument%s "%s".',
152
  $name, $callType, $callName, implode(', ', $names), count($missingArguments) > 1 ? 's' : '', implode('", "', $missingArguments))
218
 
219
  private function getCallableParameters($callable, $isVariadic)
220
  {
221
+ list($r) = $this->reflectCallable($callable);
222
  if (null === $r) {
223
  return array();
224
  }
vendor/twig/twig/lib/Twig/Node/Expression/Function.php CHANGED
@@ -12,7 +12,7 @@ class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
12
  {
13
  public function __construct($name, Twig_NodeInterface $arguments, $lineno)
14
  {
15
- parent::__construct(array('arguments' => $arguments), array('name' => $name), $lineno);
16
  }
17
 
18
  public function compile(Twig_Compiler $compiler)
@@ -27,7 +27,12 @@ class Twig_Node_Expression_Function extends Twig_Node_Expression_Call
27
  $this->setAttribute('needs_context', $function->needsContext());
28
  $this->setAttribute('arguments', $function->getArguments());
29
  if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
30
- $this->setAttribute('callable', $function->getCallable());
 
 
 
 
 
31
  }
32
  if ($function instanceof Twig_SimpleFunction) {
33
  $this->setAttribute('is_variadic', $function->isVariadic());
12
  {
13
  public function __construct($name, Twig_NodeInterface $arguments, $lineno)
14
  {
15
+ parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno);
16
  }
17
 
18
  public function compile(Twig_Compiler $compiler)
27
  $this->setAttribute('needs_context', $function->needsContext());
28
  $this->setAttribute('arguments', $function->getArguments());
29
  if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
30
+ $callable = $function->getCallable();
31
+ if ('constant' === $name && $this->getAttribute('is_defined_test')) {
32
+ $callable = 'twig_constant_is_defined';
33
+ }
34
+
35
+ $this->setAttribute('callable', $callable);
36
  }
37
  if ($function instanceof Twig_SimpleFunction) {
38
  $this->setAttribute('is_variadic', $function->isVariadic());
vendor/twig/twig/lib/Twig/Node/Expression/Name.php CHANGED
@@ -43,10 +43,20 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression
43
  ->raw(']')
44
  ;
45
  } else {
46
- // remove the non-PHP 5.4 version when PHP 5.3 support is dropped
47
- // as the non-optimized version is just a workaround for slow ternary operator
48
- // when the context has a lot of variables
49
- if (PHP_VERSION_ID >= 50400) {
 
 
 
 
 
 
 
 
 
 
50
  // PHP 5.4 ternary operator performance was optimized
51
  $compiler
52
  ->raw('(isset($context[')
43
  ->raw(']')
44
  ;
45
  } else {
46
+ if (PHP_VERSION_ID >= 70000) {
47
+ // use PHP 7 null coalescing operator
48
+ $compiler
49
+ ->raw('($context[')
50
+ ->string($name)
51
+ ->raw('] ?? ')
52
+ ;
53
+
54
+ if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) {
55
+ $compiler->raw('null)');
56
+ } else {
57
+ $compiler->raw('$this->getContext($context, ')->string($name)->raw('))');
58
+ }
59
+ } elseif (PHP_VERSION_ID >= 50400) {
60
  // PHP 5.4 ternary operator performance was optimized
61
  $compiler
62
  ->raw('(isset($context[')
vendor/twig/twig/lib/Twig/Node/Expression/NullCoalesce.php CHANGED
@@ -20,4 +20,27 @@ class Twig_Node_Expression_NullCoalesce extends Twig_Node_Expression_Conditional
20
 
21
  parent::__construct($test, $left, $right, $lineno);
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  }
20
 
21
  parent::__construct($test, $left, $right, $lineno);
22
  }
23
+
24
+ public function compile(Twig_Compiler $compiler)
25
+ {
26
+ /*
27
+ * This optimizes only one case. PHP 7 also supports more complex expressions
28
+ * that can return null. So, for instance, if log is defined, log("foo") ?? "..." works,
29
+ * but log($a["foo"]) ?? "..." does not if $a["foo"] is not defined. More advanced
30
+ * cases might be implemented as an optimizer node visitor, but has not been done
31
+ * as benefits are probably not worth the added complexity.
32
+ */
33
+ if (PHP_VERSION_ID >= 70000 && $this->getNode('expr2') instanceof Twig_Node_Expression_Name) {
34
+ $this->getNode('expr2')->setAttribute('always_defined', true);
35
+ $compiler
36
+ ->raw('((')
37
+ ->subcompile($this->getNode('expr2'))
38
+ ->raw(') ?? (')
39
+ ->subcompile($this->getNode('expr3'))
40
+ ->raw('))')
41
+ ;
42
+ } else {
43
+ parent::compile($compiler);
44
+ }
45
+ }
46
  }
vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php CHANGED
@@ -29,8 +29,11 @@ class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test
29
  $node->setAttribute('is_defined_test', true);
30
  } elseif ($node instanceof Twig_Node_Expression_GetAttr) {
31
  $node->setAttribute('is_defined_test', true);
32
-
33
  $this->changeIgnoreStrictCheck($node);
 
 
 
 
34
  } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) {
35
  $node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine());
36
  } else {
29
  $node->setAttribute('is_defined_test', true);
30
  } elseif ($node instanceof Twig_Node_Expression_GetAttr) {
31
  $node->setAttribute('is_defined_test', true);
 
32
  $this->changeIgnoreStrictCheck($node);
33
+ } elseif ($node instanceof Twig_Node_Expression_BlockReference) {
34
+ $node->setAttribute('is_defined_test', true);
35
+ } elseif ($node instanceof Twig_Node_Expression_Function && 'constant' === $node->getAttribute('name')) {
36
+ $node->setAttribute('is_defined_test', true);
37
  } elseif ($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array) {
38
  $node = new Twig_Node_Expression_Constant(true, $node->getTemplateLine());
39
  } else {
vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php CHANGED
@@ -36,11 +36,9 @@ class Twig_Node_SandboxedPrint extends Twig_Node_Print
36
  *
37
  * This is mostly needed when another visitor adds filters (like the escaper one).
38
  *
39
- * @param Twig_Node $node A Node
40
- *
41
  * @return Twig_Node
42
  */
43
- protected function removeNodeFilter($node)
44
  {
45
  if ($node instanceof Twig_Node_Expression_Filter) {
46
  return $this->removeNodeFilter($node->getNode('node'));
36
  *
37
  * This is mostly needed when another visitor adds filters (like the escaper one).
38
  *
 
 
39
  * @return Twig_Node
40
  */
41
+ protected function removeNodeFilter(Twig_Node $node)
42
  {
43
  if ($node instanceof Twig_Node_Expression_Filter) {
44
  return $this->removeNodeFilter($node->getNode('node'));
vendor/twig/twig/lib/Twig/Node/With.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) 2016 Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Represents a nested "with" scope.
14
+ *
15
+ * @author Fabien Potencier <fabien@symfony.com>
16
+ */
17
+ class Twig_Node_With extends Twig_Node
18
+ {
19
+ public function __construct(Twig_Node $body, Twig_Node $variables = null, $only = false, $lineno, $tag = null)
20
+ {
21
+ $nodes = array('body' => $body);
22
+ if (null !== $variables) {
23
+ $nodes['variables'] = $variables;
24
+ }
25
+
26
+ parent::__construct($nodes, array('only' => (bool) $only), $lineno, $tag);
27
+ }
28
+
29
+ public function compile(Twig_Compiler $compiler)
30
+ {
31
+ $compiler->addDebugInfo($this);
32
+
33
+ if ($this->hasNode('variables')) {
34
+ $varsName = $compiler->getVarName();
35
+ $compiler
36
+ ->write(sprintf('$%s = ', $varsName))
37
+ ->subcompile($this->getNode('variables'))
38
+ ->raw(";\n")
39
+ ->write(sprintf("if (!is_array(\$%s)) {\n", $varsName))
40
+ ->indent()
41
+ ->write("throw new Twig_Error_Runtime('Variables passed to the \"with\" tag must be a hash.');\n")
42
+ ->outdent()
43
+ ->write("}\n")
44
+ ;
45
+
46
+ if ($this->getAttribute('only')) {
47
+ $compiler->write("\$context = array('_parent' => \$context);\n");
48
+ } else {
49
+ $compiler->write("\$context['_parent'] = \$context;\n");
50
+ }
51
+
52
+ $compiler->write(sprintf("\$context = array_merge(\$context, \$%s);\n", $varsName));
53
+ } else {
54
+ $compiler->write("\$context['_parent'] = \$context;\n");
55
+ }
56
+
57
+ $compiler
58
+ ->subcompile($this->getNode('body'))
59
+ ->write("\$context = \$context['_parent'];\n")
60
+ ;
61
+ }
62
+ }
vendor/twig/twig/lib/Twig/NodeInterface.php CHANGED
@@ -20,8 +20,6 @@ interface Twig_NodeInterface extends Countable, IteratorAggregate
20
  {
21
  /**
22
  * Compiles the node to PHP.
23
- *
24
- * @param Twig_Compiler $compiler A Twig_Compiler instance
25
  */
26
  public function compile(Twig_Compiler $compiler);
27
 
20
  {
21
  /**
22
  * Compiles the node to PHP.
 
 
23
  */
24
  public function compile(Twig_Compiler $compiler);
25
 
vendor/twig/twig/lib/Twig/NodeTraverser.php CHANGED
@@ -22,10 +22,8 @@ class Twig_NodeTraverser
22
  protected $visitors = array();
23
 
24
  /**
25
- * Constructor.
26
- *
27
- * @param Twig_Environment $env A Twig_Environment instance
28
- * @param Twig_NodeVisitorInterface[] $visitors An array of Twig_NodeVisitorInterface instances
29
  */
30
  public function __construct(Twig_Environment $env, array $visitors = array())
31
  {
@@ -35,11 +33,6 @@ class Twig_NodeTraverser
35
  }
36
  }
37
 
38
- /**
39
- * Adds a visitor.
40
- *
41
- * @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance
42
- */
43
  public function addVisitor(Twig_NodeVisitorInterface $visitor)
44
  {
45
  if (!isset($this->visitors[$visitor->getPriority()])) {
@@ -52,8 +45,6 @@ class Twig_NodeTraverser
52
  /**
53
  * Traverses a node and calls the registered visitors.
54
  *
55
- * @param Twig_NodeInterface $node A Twig_NodeInterface instance
56
- *
57
  * @return Twig_NodeInterface
58
  */
59
  public function traverse(Twig_NodeInterface $node)
22
  protected $visitors = array();
23
 
24
  /**
25
+ * @param Twig_Environment $env
26
+ * @param Twig_NodeVisitorInterface[] $visitors
 
 
27
  */
28
  public function __construct(Twig_Environment $env, array $visitors = array())
29
  {
33
  }
34
  }
35
 
 
 
 
 
 
36
  public function addVisitor(Twig_NodeVisitorInterface $visitor)
37
  {
38
  if (!isset($this->visitors[$visitor->getPriority()])) {
45
  /**
46
  * Traverses a node and calls the registered visitors.
47
  *
 
 
48
  * @return Twig_NodeInterface
49
  */
50
  public function traverse(Twig_NodeInterface $node)
vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php CHANGED
@@ -34,8 +34,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
34
  protected $inABody = false;
35
 
36
  /**
37
- * Constructor.
38
- *
39
  * @param int $optimizers The optimizer mode
40
  */
41
  public function __construct($optimizers = -1)
@@ -127,9 +125,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
127
  *
128
  * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
129
  *
130
- * @param Twig_NodeInterface $node A Node
131
- * @param Twig_Environment $env The current Twig environment
132
- *
133
  * @return Twig_NodeInterface
134
  */
135
  protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
@@ -138,13 +133,14 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
138
  return $node;
139
  }
140
 
 
141
  if (
142
- $node->getNode('expr') instanceof Twig_Node_Expression_BlockReference ||
143
- $node->getNode('expr') instanceof Twig_Node_Expression_Parent
144
  ) {
145
- $node->getNode('expr')->setAttribute('output', true);
146
 
147
- return $node->getNode('expr');
148
  }
149
 
150
  return $node;
@@ -153,9 +149,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
153
  /**
154
  * Removes "raw" filters.
155
  *
156
- * @param Twig_NodeInterface $node A Node
157
- * @param Twig_Environment $env The current Twig environment
158
- *
159
  * @return Twig_NodeInterface
160
  */
161
  protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
@@ -169,9 +162,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
169
 
170
  /**
171
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
172
- *
173
- * @param Twig_NodeInterface $node A Node
174
- * @param Twig_Environment $env The current Twig environment
175
  */
176
  protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
177
  {
@@ -236,9 +226,6 @@ class Twig_NodeVisitor_Optimizer extends Twig_BaseNodeVisitor
236
 
237
  /**
238
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
239
- *
240
- * @param Twig_NodeInterface $node A Node
241
- * @param Twig_Environment $env The current Twig environment
242
  */
243
  protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
244
  {
34
  protected $inABody = false;
35
 
36
  /**
 
 
37
  * @param int $optimizers The optimizer mode
38
  */
39
  public function __construct($optimizers = -1)
125
  *
126
  * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()"
127
  *
 
 
 
128
  * @return Twig_NodeInterface
129
  */
130
  protected function optimizePrintNode(Twig_NodeInterface $node, Twig_Environment $env)
133
  return $node;
134
  }
135
 
136
+ $exprNode = $node->getNode('expr');
137
  if (
138
+ $exprNode instanceof Twig_Node_Expression_BlockReference ||
139
+ $exprNode instanceof Twig_Node_Expression_Parent
140
  ) {
141
+ $exprNode->setAttribute('output', true);
142
 
143
+ return $exprNode;
144
  }
145
 
146
  return $node;
149
  /**
150
  * Removes "raw" filters.
151
  *
 
 
 
152
  * @return Twig_NodeInterface
153
  */
154
  protected function optimizeRawFilter(Twig_NodeInterface $node, Twig_Environment $env)
162
 
163
  /**
164
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
 
 
 
165
  */
166
  protected function enterOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
167
  {
226
 
227
  /**
228
  * Optimizes "for" tag by removing the "loop" variable creation whenever possible.
 
 
 
229
  */
230
  protected function leaveOptimizeFor(Twig_NodeInterface $node, Twig_Environment $env)
231
  {
vendor/twig/twig/lib/Twig/NodeVisitorInterface.php CHANGED
@@ -19,9 +19,6 @@ interface Twig_NodeVisitorInterface
19
  /**
20
  * Called before child nodes are visited.
21
  *
22
- * @param Twig_NodeInterface $node The node to visit
23
- * @param Twig_Environment $env The Twig environment instance
24
- *
25
  * @return Twig_NodeInterface The modified node
26
  */
27
  public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
@@ -29,9 +26,6 @@ interface Twig_NodeVisitorInterface
29
  /**
30
  * Called after child nodes are visited.
31
  *
32
- * @param Twig_NodeInterface $node The node to visit
33
- * @param Twig_Environment $env The Twig environment instance
34
- *
35
  * @return Twig_NodeInterface|false The modified node or false if the node must be removed
36
  */
37
  public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
19
  /**
20
  * Called before child nodes are visited.
21
  *
 
 
 
22
  * @return Twig_NodeInterface The modified node
23
  */
24
  public function enterNode(Twig_NodeInterface $node, Twig_Environment $env);
26
  /**
27
  * Called after child nodes are visited.
28
  *
 
 
 
29
  * @return Twig_NodeInterface|false The modified node or false if the node must be removed
30
  */
31
  public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env);
vendor/twig/twig/lib/Twig/Parser.php CHANGED
@@ -32,11 +32,6 @@ class Twig_Parser implements Twig_ParserInterface
32
  protected $traits;
33
  protected $embeddedTemplates = array();
34
 
35
- /**
36
- * Constructor.
37
- *
38
- * @param Twig_Environment $env A Twig_Environment instance
39
- */
40
  public function __construct(Twig_Environment $env)
41
  {
42
  $this->env = $env;
@@ -346,9 +341,7 @@ class Twig_Parser implements Twig_ParserInterface
346
  }
347
 
348
  /**
349
- * Gets the expression parser.
350
- *
351
- * @return Twig_ExpressionParser The expression parser
352
  */
353
  public function getExpressionParser()
354
  {
@@ -366,9 +359,7 @@ class Twig_Parser implements Twig_ParserInterface
366
  }
367
 
368
  /**
369
- * Gets the token stream.
370
- *
371
- * @return Twig_TokenStream The token stream
372
  */
373
  public function getStream()
374
  {
@@ -376,9 +367,7 @@ class Twig_Parser implements Twig_ParserInterface
376
  }
377
 
378
  /**
379
- * Gets the current token.
380
- *
381
- * @return Twig_Token The current token
382
  */
383
  public function getCurrentToken()
384
  {
32
  protected $traits;
33
  protected $embeddedTemplates = array();
34
 
 
 
 
 
 
35
  public function __construct(Twig_Environment $env)
36
  {
37
  $this->env = $env;
341
  }
342
 
343
  /**
344
+ * @return Twig_ExpressionParser
 
 
345
  */
346
  public function getExpressionParser()
347
  {
359
  }
360
 
361
  /**
362
+ * @return Twig_TokenStream
 
 
363
  */
364
  public function getStream()
365
  {
367
  }
368
 
369
  /**
370
+ * @return Twig_Token
 
 
371
  */
372
  public function getCurrentToken()
373
  {
vendor/twig/twig/lib/Twig/ParserInterface.php CHANGED
@@ -21,9 +21,7 @@ interface Twig_ParserInterface
21
  /**
22
  * Converts a token stream to a node tree.
23
  *
24
- * @param Twig_TokenStream $stream A token stream instance
25
- *
26
- * @return Twig_Node_Module A node tree
27
  *
28
  * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
29
  */
21
  /**
22
  * Converts a token stream to a node tree.
23
  *
24
+ * @return Twig_Node_Module
 
 
25
  *
26
  * @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
27
  */
vendor/twig/twig/lib/Twig/Profiler/NodeVisitor/Profiler.php CHANGED
@@ -41,14 +41,14 @@ class Twig_Profiler_NodeVisitor_Profiler extends Twig_BaseNodeVisitor
41
  } elseif ($node instanceof Twig_Node_Block) {
42
  $varName = $this->getVarName();
43
  $node->setNode('body', new Twig_Node_Body(array(
44
- new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getTemplateName(), $varName),
45
  $node->getNode('body'),
46
  new Twig_Profiler_Node_LeaveProfile($varName),
47
  )));
48
  } elseif ($node instanceof Twig_Node_Macro) {
49
  $varName = $this->getVarName();
50
  $node->setNode('body', new Twig_Node_Body(array(
51
- new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getTemplateName(), $varName),
52
  $node->getNode('body'),
53
  new Twig_Profiler_Node_LeaveProfile($varName),
54
  )));
41
  } elseif ($node instanceof Twig_Node_Block) {
42
  $varName = $this->getVarName();
43
  $node->setNode('body', new Twig_Node_Body(array(
44
+ new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::BLOCK, $node->getAttribute('name'), $varName),
45
  $node->getNode('body'),
46
  new Twig_Profiler_Node_LeaveProfile($varName),
47
  )));
48
  } elseif ($node instanceof Twig_Node_Macro) {
49
  $varName = $this->getVarName();
50
  $node->setNode('body', new Twig_Node_Body(array(
51
+ new Twig_Profiler_Node_EnterProfile($this->extensionName, Twig_Profiler_Profile::MACRO, $node->getAttribute('name'), $varName),
52
  $node->getNode('body'),
53
  new Twig_Profiler_Node_LeaveProfile($varName),
54
  )));
vendor/twig/twig/lib/Twig/Template.php CHANGED
@@ -13,10 +13,19 @@
13
  /**
14
  * Default base class for compiled templates.
15
  *
 
 
 
 
16
  * @author Fabien Potencier <fabien@symfony.com>
 
 
17
  */
18
  abstract class Twig_Template implements Twig_TemplateInterface
19
  {
 
 
 
20
  protected static $cache = array();
21
 
22
  protected $parent;
@@ -25,11 +34,6 @@ abstract class Twig_Template implements Twig_TemplateInterface
25
  protected $blocks = array();
26
  protected $traits = array();
27
 
28
- /**
29
- * Constructor.
30
- *
31
- * @param Twig_Environment $env A Twig_Environment instance
32
- */
33
  public function __construct(Twig_Environment $env)
34
  {
35
  $this->env = $env;
@@ -268,44 +272,70 @@ abstract class Twig_Template implements Twig_TemplateInterface
268
  }
269
 
270
  /**
271
- * Returns whether a block exists or not.
272
- *
273
- * This method is for internal use only and should never be called
274
- * directly.
275
  *
276
- * This method does only return blocks defined in the current template
277
- * or defined in "used" traits.
278
  *
279
- * It does not return blocks from parent templates as the parent
280
- * template name can be dynamic, which is only known based on the
281
- * current context.
282
- *
283
- * @param string $name The block name
284
  *
285
  * @return bool true if the block exists, false otherwise
286
  *
287
  * @internal
288
  */
289
- public function hasBlock($name)
290
  {
291
- return isset($this->blocks[(string) $name]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  }
293
 
294
  /**
295
- * Returns all block names.
296
  *
297
- * This method is for internal use only and should never be called
298
- * directly.
299
  *
300
- * @return array An array of block names
 
301
  *
302
- * @see hasBlock
303
  *
304
  * @internal
305
  */
306
- public function getBlockNames()
307
  {
308
- return array_keys($this->blocks);
 
 
 
 
 
 
 
 
 
 
 
 
309
  }
310
 
311
  protected function loadTemplate($template, $templateName = null, $line = null, $index = null)
@@ -319,6 +349,10 @@ abstract class Twig_Template implements Twig_TemplateInterface
319
  return $template;
320
  }
321
 
 
 
 
 
322
  return $this->env->loadTemplate($template, $index);
323
  } catch (Twig_Error $e) {
324
  if (!$e->getTemplateName()) {
@@ -347,8 +381,6 @@ abstract class Twig_Template implements Twig_TemplateInterface
347
  *
348
  * @return array An array of blocks
349
  *
350
- * @see hasBlock
351
- *
352
  * @internal
353
  */
354
  public function getBlocks()
@@ -467,6 +499,8 @@ abstract class Twig_Template implements Twig_TemplateInterface
467
  * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
468
  *
469
  * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
 
 
470
  */
471
  protected function getAttribute($object, $item, array $arguments = array(), $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
472
  {
@@ -474,7 +508,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
474
  if (self::METHOD_CALL !== $type) {
475
  $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
476
 
477
- if ((is_array($object) && array_key_exists($arrayItem, $object))
478
  || ($object instanceof ArrayAccess && isset($object[$arrayItem]))
479
  ) {
480
  if ($isDefinedTest) {
@@ -555,37 +589,57 @@ abstract class Twig_Template implements Twig_TemplateInterface
555
  $class = get_class($object);
556
 
557
  // object method
558
- if (!isset(self::$cache[$class]['methods'])) {
559
  // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates
560
  if ($object instanceof self) {
561
  $ref = new ReflectionClass($class);
562
  $methods = array();
563
 
564
  foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) {
565
- $methodName = strtolower($refMethod->name);
566
-
567
  // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
568
- if ('getenvironment' !== $methodName) {
569
- $methods[$methodName] = true;
570
  }
571
  }
572
-
573
- self::$cache[$class]['methods'] = $methods;
574
  } else {
575
- self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object)));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  }
 
577
  }
578
 
579
  $call = false;
580
- $lcItem = strtolower($item);
581
- if (isset(self::$cache[$class]['methods'][$lcItem])) {
582
- $method = (string) $item;
583
- } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) {
584
- $method = 'get'.$item;
585
- } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) {
586
- $method = 'is'.$item;
587
- } elseif (isset(self::$cache[$class]['methods']['__call'])) {
588
- $method = (string) $item;
589
  $call = true;
590
  } else {
591
  if ($isDefinedTest) {
@@ -596,7 +650,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
596
  return;
597
  }
598
 
599
- throw new Twig_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, get_class($object)), -1, $this->getTemplateName());
600
  }
601
 
602
  if ($isDefinedTest) {
@@ -610,7 +664,11 @@ abstract class Twig_Template implements Twig_TemplateInterface
610
  // Some objects throw exceptions when they have __call, and the method we try
611
  // to call is not supported. If ignoreStrictCheck is true, we should return null.
612
  try {
613
- $ret = call_user_func_array(array($object, $method), $arguments);
 
 
 
 
614
  } catch (BadMethodCallException $e) {
615
  if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
616
  return;
@@ -618,9 +676,19 @@ abstract class Twig_Template implements Twig_TemplateInterface
618
  throw $e;
619
  }
620
 
621
- // useful when calling a template method from a template
622
- // this is not supported but unfortunately heavily used in the Symfony profiler
623
  if ($object instanceof Twig_TemplateInterface) {
 
 
 
 
 
 
 
 
 
 
 
624
  return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset());
625
  }
626
 
13
  /**
14
  * Default base class for compiled templates.
15
  *
16
+ * This class is an implementation detail of how template compilation currently
17
+ * works, which might change. It should never be used directly. Use $twig->load()
18
+ * instead, which returns an instance of Twig_TemplateWrapper.
19
+ *
20
  * @author Fabien Potencier <fabien@symfony.com>
21
+ *
22
+ * @internal
23
  */
24
  abstract class Twig_Template implements Twig_TemplateInterface
25
  {
26
+ /**
27
+ * @internal
28
+ */
29
  protected static $cache = array();
30
 
31
  protected $parent;
34
  protected $blocks = array();
35
  protected $traits = array();
36
 
 
 
 
 
 
37
  public function __construct(Twig_Environment $env)
38
  {
39
  $this->env = $env;
272
  }
273
 
274
  /**
275
+ * Returns whether a block exists or not in the current context of the template.
 
 
 
276
  *
277
+ * This method checks blocks defined in the current template
278
+ * or defined in "used" traits or defined in parent templates.
279
  *
280
+ * @param string $name The block name
281
+ * @param array $context The context
282
+ * @param array $blocks The current set of blocks
 
 
283
  *
284
  * @return bool true if the block exists, false otherwise
285
  *
286
  * @internal
287
  */
288
+ public function hasBlock($name, array $context = null, array $blocks = array())
289
  {
290
+ if (null === $context) {
291
+ @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
292
+
293
+ return isset($this->blocks[(string) $name]);
294
+ }
295
+
296
+ if (isset($blocks[$name])) {
297
+ return $blocks[$name][0] instanceof self;
298
+ }
299
+
300
+ if (isset($this->blocks[$name])) {
301
+ return true;
302
+ }
303
+
304
+ if (false !== $parent = $this->getParent($context)) {
305
+ return $parent->hasBlock($name, $context);
306
+ }
307
+
308
+ return false;
309
  }
310
 
311
  /**
312
+ * Returns all block names in the current context of the template.
313
  *
314
+ * This method checks blocks defined in the current template
315
+ * or defined in "used" traits or defined in parent templates.
316
  *
317
+ * @param array $context The context
318
+ * @param array $blocks The current set of blocks
319
  *
320
+ * @return array An array of block names
321
  *
322
  * @internal
323
  */
324
+ public function getBlockNames(array $context = null, array $blocks = array())
325
  {
326
+ if (null === $context) {
327
+ @trigger_error('The '.__METHOD__.' method is internal and should never be called; calling it directly is deprecated since version 1.28 and won\'t be possible anymore in 2.0.', E_USER_DEPRECATED);
328
+
329
+ return array_keys($this->blocks);
330
+ }
331
+
332
+ $names = array_merge(array_keys($blocks), array_keys($this->blocks));
333
+
334
+ if (false !== $parent = $this->getParent($context)) {
335
+ $names = array_merge($names, $parent->getBlockNames($context));
336
+ }
337
+
338
+ return array_unique($names);
339
  }
340
 
341
  protected function loadTemplate($template, $templateName = null, $line = null, $index = null)
349
  return $template;
350
  }
351
 
352
+ if ($template instanceof Twig_TemplateWrapper) {
353
+ return $template;
354
+ }
355
+
356
  return $this->env->loadTemplate($template, $index);
357
  } catch (Twig_Error $e) {
358
  if (!$e->getTemplateName()) {
381
  *
382
  * @return array An array of blocks
383
  *
 
 
384
  * @internal
385
  */
386
  public function getBlocks()
499
  * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true
500
  *
501
  * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false
502
+ *
503
+ * @internal
504
  */
505
  protected function getAttribute($object, $item, array $arguments = array(), $type = self::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
506
  {
508
  if (self::METHOD_CALL !== $type) {
509
  $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
510
 
511
+ if ((is_array($object) && (isset($object[$arrayItem]) || array_key_exists($arrayItem, $object)))
512
  || ($object instanceof ArrayAccess && isset($object[$arrayItem]))
513
  ) {
514
  if ($isDefinedTest) {
589
  $class = get_class($object);
590
 
591
  // object method
592
+ if (!isset(self::$cache[$class])) {
593
  // get_class_methods returns all methods accessible in the scope, but we only want public ones to be accessible in templates
594
  if ($object instanceof self) {
595
  $ref = new ReflectionClass($class);
596
  $methods = array();
597
 
598
  foreach ($ref->getMethods(ReflectionMethod::IS_PUBLIC) as $refMethod) {
 
 
599
  // Accessing the environment from templates is forbidden to prevent untrusted changes to the environment
600
+ if ('getenvironment' !== strtolower($refMethod->name)) {
601
+ $methods[] = $refMethod->name;
602
  }
603
  }
 
 
604
  } else {
605
+ $methods = get_class_methods($object);
606
+ }
607
+ // sort values to have consistent behavior, so that "get" methods win precedence over "is" methods
608
+ sort($methods);
609
+
610
+ $cache = array();
611
+
612
+ foreach ($methods as $method) {
613
+ $cache[$method] = $method;
614
+ $cache[$lcName = strtolower($method)] = $method;
615
+
616
+ if ('g' === $lcName[0] && 0 === strpos($lcName, 'get')) {
617
+ $name = substr($method, 3);
618
+ $lcName = substr($lcName, 3);
619
+ } elseif ('i' === $lcName[0] && 0 === strpos($lcName, 'is')) {
620
+ $name = substr($method, 2);
621
+ $lcName = substr($lcName, 2);
622
+ } else {
623
+ continue;
624
+ }
625
+
626
+ if (!isset($cache[$name])) {
627
+ $cache[$name] = $method;
628
+ }
629
+ if (!isset($cache[$lcName])) {
630
+ $cache[$lcName] = $method;
631
+ }
632
  }
633
+ self::$cache[$class] = $cache;
634
  }
635
 
636
  $call = false;
637
+ if (isset(self::$cache[$class][$item])) {
638
+ $method = self::$cache[$class][$item];
639
+ } elseif (isset(self::$cache[$class][$lcItem = strtolower($item)])) {
640
+ $method = self::$cache[$class][$lcItem];
641
+ } elseif (isset(self::$cache[$class]['__call'])) {
642
+ $method = $item;
 
 
 
643
  $call = true;
644
  } else {
645
  if ($isDefinedTest) {
650
  return;
651
  }
652
 
653
+ throw new Twig_Error_Runtime(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getTemplateName());
654
  }
655
 
656
  if ($isDefinedTest) {
664
  // Some objects throw exceptions when they have __call, and the method we try
665
  // to call is not supported. If ignoreStrictCheck is true, we should return null.
666
  try {
667
+ if (!$arguments) {
668
+ $ret = $object->$method();
669
+ } else {
670
+ $ret = call_user_func_array(array($object, $method), $arguments);
671
+ }
672
  } catch (BadMethodCallException $e) {
673
  if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
674
  return;
676
  throw $e;
677
  }
678
 
679
+ // @deprecated in 1.28
 
680
  if ($object instanceof Twig_TemplateInterface) {
681
+ $self = $object->getTemplateName() === $this->getTemplateName();
682
+ $message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $method, $object->getTemplateName(), $this->getTemplateName());
683
+ if ('renderBlock' === $method || 'displayBlock' === $method) {
684
+ $message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template');
685
+ } elseif ('hasBlock' === $method) {
686
+ $message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template');
687
+ } elseif ('render' === $method || 'display' === $method) {
688
+ $message .= sprintf(' Use include("%s") instead).', $object->getTemplateName());
689
+ }
690
+ @trigger_error($message, E_USER_DEPRECATED);
691
+
692
  return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset());
693
  }
694
 
vendor/twig/twig/lib/Twig/TemplateInterface.php CHANGED
@@ -42,7 +42,7 @@ interface Twig_TemplateInterface
42
  /**
43
  * Returns the bound environment for this template.
44
  *
45
- * @return Twig_Environment The current environment
46
  */
47
  public function getEnvironment();
48
  }
42
  /**
43
  * Returns the bound environment for this template.
44
  *
45
+ * @return Twig_Environment
46
  */
47
  public function getEnvironment();
48
  }
vendor/twig/twig/lib/Twig/TemplateWrapper.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) 2016 Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Exposes a template to userland.
14
+ *
15
+ * @author Fabien Potencier <fabien@symfony.com>
16
+ */
17
+ final class Twig_TemplateWrapper
18
+ {
19
+ private $env;
20
+ private $template;
21
+
22
+ /**
23
+ * This method is for internal use only and should never be called
24
+ * directly (use Twig_Environment::load() instead).
25
+ *
26
+ * @internal
27
+ */
28
+ public function __construct(Twig_Environment $env, Twig_Template $template)
29
+ {
30
+ $this->env = $env;
31
+ $this->template = $template;
32
+ }
33
+
34
+ /**
35
+ * Renders the template.
36
+ *
37
+ * @param array $context An array of parameters to pass to the template
38
+ *
39
+ * @return string The rendered template
40
+ */
41
+ public function render($context = array())
42
+ {
43
+ return $this->template->render($context);
44
+ }
45
+
46
+ /**
47
+ * Displays the template.
48
+ *
49
+ * @param array $context An array of parameters to pass to the template
50
+ */
51
+ public function display($context = array())
52
+ {
53
+ $this->template->display($context);
54
+ }
55
+
56
+ /**
57
+ * Checks if a block is defined.
58
+ *
59
+ * @param string $name The block name
60
+ * @param array $context An array of parameters to pass to the template
61
+ *
62
+ * @return bool
63
+ */
64
+ public function hasBlock($name, $context = array())
65
+ {
66
+ return $this->template->hasBlock($name, $context);
67
+ }
68
+
69
+ /**
70
+ * Returns defined block names in the template.
71
+ *
72
+ * @param array $context An array of parameters to pass to the template
73
+ *
74
+ * @return string[] An array of defined template block names
75
+ */
76
+ public function getBlockNames($context = array())
77
+ {
78
+ return $this->template->getBlockNames($context);
79
+ }
80
+
81
+ /**
82
+ * Renders a template block.
83
+ *
84
+ * @param string $name The block name to render
85
+ * @param array $context An array of parameters to pass to the template
86
+ *
87
+ * @return string The rendered block
88
+ */
89
+ public function renderBlock($name, $context = array())
90
+ {
91
+ $context = $this->env->mergeGlobals($context);
92
+ $level = ob_get_level();
93
+ ob_start();
94
+ try {
95
+ $this->template->displayBlock($name, $context);
96
+ } catch (Exception $e) {
97
+ while (ob_get_level() > $level) {
98
+ ob_end_clean();
99
+ }
100
+
101
+ throw $e;
102
+ } catch (Throwable $e) {
103
+ while (ob_get_level() > $level) {
104
+ ob_end_clean();
105
+ }
106
+
107
+ throw $e;
108
+ }
109
+
110
+ return ob_get_clean();
111
+ }
112
+
113
+ /**
114
+ * Displays a template block.
115
+ *
116
+ * @param string $name The block name to render
117
+ * @param array $context An array of parameters to pass to the template
118
+ */
119
+ public function displayBlock($name, $context = array())
120
+ {
121
+ $this->template->displayBlock($name, $this->env->mergeGlobals($context));
122
+ }
123
+
124
+ /**
125
+ * @return Twig_Source
126
+ */
127
+ public function getSourceContext()
128
+ {
129
+ return $this->template->getSourceContext();
130
+ }
131
+ }
vendor/twig/twig/lib/Twig/Test/NodeTestCase.php CHANGED
@@ -46,6 +46,10 @@ abstract class Twig_Test_NodeTestCase extends PHPUnit_Framework_TestCase
46
  {
47
  $line = $line > 0 ? "// line {$line}\n" : '';
48
 
 
 
 
 
49
  if (PHP_VERSION_ID >= 50400) {
50
  return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
51
  }
46
  {
47
  $line = $line > 0 ? "// line {$line}\n" : '';
48
 
49
+ if (PHP_VERSION_ID >= 70000) {
50
+ return sprintf('%s($context["%s"] ?? null)', $line, $name, $name);
51
+ }
52
+
53
  if (PHP_VERSION_ID >= 50400) {
54
  return sprintf('%s(isset($context["%s"]) ? $context["%s"] : null)', $line, $name, $name);
55
  }
vendor/twig/twig/lib/Twig/Token.php CHANGED
@@ -36,8 +36,6 @@ class Twig_Token
36
  const INTERPOLATION_END_TYPE = 11;
37
 
38
  /**
39
- * Constructor.
40
- *
41
  * @param int $type The type of the token
42
  * @param string $value The token value
43
  * @param int $lineno The line position in the source
@@ -49,11 +47,6 @@ class Twig_Token
49
  $this->lineno = $lineno;
50
  }
51
 
52
- /**
53
- * Returns a string representation of the token.
54
- *
55
- * @return string A string representation of the token
56
- */
57
  public function __toString()
58
  {
59
  return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value);
@@ -63,9 +56,9 @@ class Twig_Token
63
  * Tests the current token for a type and/or a value.
64
  *
65
  * Parameters may be:
66
- * * just type
67
- * * type and value (or array of possible values)
68
- * * just value (or array of possible values) (NAME_TYPE is used as type)
69
  *
70
  * @param array|int $type The type to test
71
  * @param array|string|null $values The token value
@@ -87,9 +80,7 @@ class Twig_Token
87
  }
88
 
89
  /**
90
- * Gets the line.
91
- *
92
- * @return int The source line
93
  */
94
  public function getLine()
95
  {
@@ -97,9 +88,7 @@ class Twig_Token
97
  }
98
 
99
  /**
100
- * Gets the token type.
101
- *
102
- * @return int The token type
103
  */
104
  public function getType()
105
  {
@@ -107,9 +96,7 @@ class Twig_Token
107
  }
108
 
109
  /**
110
- * Gets the token value.
111
- *
112
- * @return string The token value
113
  */
114
  public function getValue()
115
  {
@@ -174,7 +161,7 @@ class Twig_Token
174
  }
175
 
176
  /**
177
- * Returns the english representation of a given type.
178
  *
179
  * @param int $type The type as an integer
180
  *
36
  const INTERPOLATION_END_TYPE = 11;
37
 
38
  /**
 
 
39
  * @param int $type The type of the token
40
  * @param string $value The token value
41
  * @param int $lineno The line position in the source
47
  $this->lineno = $lineno;
48
  }
49
 
 
 
 
 
 
50
  public function __toString()
51
  {
52
  return sprintf('%s(%s)', self::typeToString($this->type, true), $this->value);
56
  * Tests the current token for a type and/or a value.
57
  *
58
  * Parameters may be:
59
+ * * just type
60
+ * * type and value (or array of possible values)
61
+ * * just value (or array of possible values) (NAME_TYPE is used as type)
62
  *
63
  * @param array|int $type The type to test
64
  * @param array|string|null $values The token value
80
  }
81
 
82
  /**
83
+ * @return int
 
 
84
  */
85
  public function getLine()
86
  {
88
  }
89
 
90
  /**
91
+ * @return int
 
 
92
  */
93
  public function getType()
94
  {
96
  }
97
 
98
  /**
99
+ * @return string
 
 
100
  */
101
  public function getValue()
102
  {
161
  }
162
 
163
  /**
164
+ * Returns the English representation of a given type.
165
  *
166
  * @param int $type The type as an integer
167
  *
vendor/twig/twig/lib/Twig/TokenParser.php CHANGED
@@ -23,8 +23,6 @@ abstract class Twig_TokenParser implements Twig_TokenParserInterface
23
 
24
  /**
25
  * Sets the parser associated with this token parser.
26
- *
27
- * @param Twig_Parser $parser A Twig_Parser instance
28
  */
29
  public function setParser(Twig_Parser $parser)
30
  {
23
 
24
  /**
25
  * Sets the parser associated with this token parser.
 
 
26
  */
27
  public function setParser(Twig_Parser $parser)
28
  {
vendor/twig/twig/lib/Twig/TokenParser/Filter.php CHANGED
@@ -23,7 +23,7 @@ class Twig_TokenParser_Filter extends Twig_TokenParser
23
  public function parse(Twig_Token $token)
24
  {
25
  $name = $this->parser->getVarName();
26
- $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), true, $token->getLine(), $this->getTag());
27
 
28
  $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
29
  $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
23
  public function parse(Twig_Token $token)
24
  {
25
  $name = $this->parser->getVarName();
26
+ $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), null, $token->getLine(), $this->getTag());
27
 
28
  $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag());
29
  $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE);
vendor/twig/twig/lib/Twig/TokenParser/With.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) 2016 Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ /**
13
+ * Creates a nested scope.
14
+ *
15
+ * @author Fabien Potencier <fabien@symfony.com>
16
+ */
17
+ class Twig_TokenParser_With extends Twig_TokenParser
18
+ {
19
+ public function parse(Twig_Token $token)
20
+ {
21
+ $stream = $this->parser->getStream();
22
+
23
+ $variables = null;
24
+ $only = false;
25
+ if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
26
+ $variables = $this->parser->getExpressionParser()->parseExpression();
27
+ $only = $stream->nextIf(Twig_Token::NAME_TYPE, 'only');
28
+ }
29
+
30
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
31
+
32
+ $body = $this->parser->subparse(array($this, 'decideWithEnd'), true);
33
+
34
+ $stream->expect(Twig_Token::BLOCK_END_TYPE);
35
+
36
+ return new Twig_Node_With($body, $variables, $only, $token->getLine(), $this->getTag());
37
+ }
38
+
39
+ public function decideWithEnd(Twig_Token $token)
40
+ {
41
+ return $token->test('endwith');
42
+ }
43
+
44
+ public function getTag()
45
+ {
46
+ return 'with';
47
+ }
48
+ }
vendor/twig/twig/lib/Twig/TokenParserBroker.php CHANGED
@@ -24,8 +24,6 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
24
  protected $brokers = array();
25
 
26
  /**
27
- * Constructor.
28
- *
29
  * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
30
  * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances
31
  * @param bool $triggerDeprecationError
@@ -50,21 +48,11 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
50
  }
51
  }
52
 
53
- /**
54
- * Adds a TokenParser.
55
- *
56
- * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
57
- */
58
  public function addTokenParser(Twig_TokenParserInterface $parser)
59
  {
60
  $this->parsers[$parser->getTag()] = $parser;
61
  }
62
 
63
- /**
64
- * Removes a TokenParser.
65
- *
66
- * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
67
- */
68
  public function removeTokenParser(Twig_TokenParserInterface $parser)
69
  {
70
  $name = $parser->getTag();
@@ -73,21 +61,11 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface
73
  }
74
  }
75
 
76
- /**
77
- * Adds a TokenParserBroker.
78
- *
79
- * @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance
80
- */
81
  public function addTokenParserBroker(Twig_TokenParserBroker $broker)
82
  {
83
  $this->brokers[] = $broker;
84
  }
85
 
86
- /**
87
- * Removes a TokenParserBroker.
88
- *
89
- * @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance
90
- */
91
  public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
92
  {
93
  if (false !== $pos = array_search($broker, $this->brokers)) {
24
  protected $brokers = array();
25
 
26
  /**
 
 
27
  * @param array|Traversable $parsers A Traversable of Twig_TokenParserInterface instances
28
  * @param array|Traversable $brokers A Traversable of Twig_TokenParserBrokerInterface instances
29
  * @param bool $triggerDeprecationError
48
  }
49
  }
50
 
 
 
 
 
 
51
  public function addTokenParser(Twig_TokenParserInterface $parser)
52
  {
53
  $this->parsers[$parser->getTag()] = $parser;
54
  }
55
 
 
 
 
 
 
56
  public function removeTokenParser(Twig_TokenParserInterface $parser)
57
  {
58
  $name = $parser->getTag();
61
  }
62
  }
63
 
 
 
 
 
 
64
  public function addTokenParserBroker(Twig_TokenParserBroker $broker)
65
  {
66
  $this->brokers[] = $broker;
67
  }
68
 
 
 
 
 
 
69
  public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
70
  {
71
  if (false !== $pos = array_search($broker, $this->brokers)) {
vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php CHANGED
@@ -26,14 +26,12 @@ interface Twig_TokenParserBrokerInterface
26
  *
27
  * @param string $tag A tag name
28
  *
29
- * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found
30
  */
31
  public function getTokenParser($tag);
32
 
33
  /**
34
  * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
35
- *
36
- * @param Twig_ParserInterface $parser A Twig_ParserInterface interface
37
  */
38
  public function setParser(Twig_ParserInterface $parser);
39
 
26
  *
27
  * @param string $tag A tag name
28
  *
29
+ * @return Twig_TokenParserInterface|null A Twig_TokenParserInterface or null if no suitable TokenParser was found
30
  */
31
  public function getTokenParser($tag);
32
 
33
  /**
34
  * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of.
 
 
35
  */
36
  public function setParser(Twig_ParserInterface $parser);
37
 
vendor/twig/twig/lib/Twig/TokenParserInterface.php CHANGED
@@ -18,17 +18,13 @@ interface Twig_TokenParserInterface
18
  {
19
  /**
20
  * Sets the parser associated with this token parser.
21
- *
22
- * @param Twig_Parser $parser A Twig_Parser instance
23
  */
24
  public function setParser(Twig_Parser $parser);
25
 
26
  /**
27
  * Parses a token and returns a node.
28
  *
29
- * @param Twig_Token $token A Twig_Token instance
30
- *
31
- * @return Twig_NodeInterface A Twig_NodeInterface instance
32
  *
33
  * @throws Twig_Error_Syntax
34
  */
18
  {
19
  /**
20
  * Sets the parser associated with this token parser.
 
 
21
  */
22
  public function setParser(Twig_Parser $parser);
23
 
24
  /**
25
  * Parses a token and returns a node.
26
  *
27
+ * @return Twig_NodeInterface
 
 
28
  *
29
  * @throws Twig_Error_Syntax
30
  */
vendor/twig/twig/lib/Twig/TokenStream.php CHANGED
@@ -24,8 +24,6 @@ class Twig_TokenStream
24
  private $source;
25
 
26
  /**
27
- * Constructor.
28
- *
29
  * @param array $tokens An array of tokens
30
  * @param string|null $name The name of the template which tokens are associated with
31
  * @param string|null $source The source code associated with the tokens
@@ -47,11 +45,6 @@ class Twig_TokenStream
47
  $this->filename = $this->source->getName();
48
  }
49
 
50
- /**
51
- * Returns a string representation of the token stream.
52
- *
53
- * @return string
54
- */
55
  public function __toString()
56
  {
57
  return implode("\n", $this->tokens);
@@ -148,8 +141,6 @@ class Twig_TokenStream
148
  }
149
 
150
  /**
151
- * Gets the current token.
152
- *
153
  * @return Twig_Token
154
  */
155
  public function getCurrent()
24
  private $source;
25
 
26
  /**
 
 
27
  * @param array $tokens An array of tokens
28
  * @param string|null $name The name of the template which tokens are associated with
29
  * @param string|null $source The source code associated with the tokens
45
  $this->filename = $this->source->getName();
46
  }
47
 
 
 
 
 
 
48
  public function __toString()
49
  {
50
  return implode("\n", $this->tokens);
141
  }
142
 
143
  /**
 
 
144
  * @return Twig_Token
145
  */
146
  public function getCurrent()
vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php CHANGED
@@ -28,7 +28,7 @@ class Twig_Util_DeprecationCollector
28
  * @param string $dir A directory where templates are stored
29
  * @param string $ext Limit the loaded templates by extension
30
  *
31
- * @return array() An array of deprecations
32
  */
33
  public function collectDir($dir, $ext = '.twig')
34
  {
@@ -46,7 +46,7 @@ class Twig_Util_DeprecationCollector
46
  *
47
  * @param Iterator $iterator An iterator of templates (where keys are template names and values the contents of the template)
48
  *
49
- * @return array() An array of deprecations
50
  */
51
  public function collect(Iterator $iterator)
52
  {
28
  * @param string $dir A directory where templates are stored
29
  * @param string $ext Limit the loaded templates by extension
30
  *
31
+ * @return array An array of deprecations
32
  */
33
  public function collectDir($dir, $ext = '.twig')
34
  {
46
  *
47
  * @param Iterator $iterator An iterator of templates (where keys are template names and values the contents of the template)
48
  *
49
+ * @return array An array of deprecations
50
  */
51
  public function collect(Iterator $iterator)
52
  {
vendor/twig/twig/phpunit.xml.dist CHANGED
@@ -17,6 +17,14 @@
17
  </testsuite>
18
  </testsuites>
19
 
 
 
 
 
 
 
 
 
20
  <filter>
21
  <whitelist>
22
  <directory suffix=".php">./lib/Twig/</directory>
17
  </testsuite>
18
  </testsuites>
19
 
20
+ <php>
21
+ <ini name="error_reporting" value="-1" />
22
+ </php>
23
+
24
+ <listeners>
25
+ <listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
26
+ </listeners>
27
+
28
  <filter>
29
  <whitelist>
30
  <directory suffix=".php">./lib/Twig/</directory>
vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php CHANGED
@@ -217,7 +217,9 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
217
  ->will($this->returnValue(0));
218
  $loader->expects($this->never())
219
  ->method('isFresh');
220
- $cache->expects($this->never())
 
 
221
  ->method('load');
222
 
223
  $twig->loadTemplate($templateName);
@@ -245,7 +247,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
245
  $loader->expects($this->once())
246
  ->method('isFresh')
247
  ->will($this->returnValue(true));
248
- $cache->expects($this->once())
249
  ->method('load');
250
 
251
  $twig->loadTemplate($templateName);
@@ -271,7 +273,9 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
271
  $loader->expects($this->once())
272
  ->method('isFresh')
273
  ->will($this->returnValue(false));
274
- $cache->expects($this->never())
 
 
275
  ->method('load');
276
 
277
  $twig->loadTemplate($templateName);
@@ -642,6 +646,7 @@ class Twig_Tests_EnvironmentTest_Runtime
642
  }
643
  }
644
 
 
645
  interface Twig_EnvironmentTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface
646
  {
647
  }
217
  ->will($this->returnValue(0));
218
  $loader->expects($this->never())
219
  ->method('isFresh');
220
+ $cache->expects($this->once())
221
+ ->method('write');
222
+ $cache->expects($this->once())
223
  ->method('load');
224
 
225
  $twig->loadTemplate($templateName);
247
  $loader->expects($this->once())
248
  ->method('isFresh')
249
  ->will($this->returnValue(true));
250
+ $cache->expects($this->atLeastOnce())
251
  ->method('load');
252
 
253
  $twig->loadTemplate($templateName);
273
  $loader->expects($this->once())
274
  ->method('isFresh')
275
  ->will($this->returnValue(false));
276
+ $cache->expects($this->once())
277
+ ->method('write');
278
+ $cache->expects($this->once())
279
  ->method('load');
280
 
281
  $twig->loadTemplate($templateName);
646
  }
647
  }
648
 
649
+ // to be removed in 2.0
650
  interface Twig_EnvironmentTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface
651
  {
652
  }
vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/power.test ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ Twig parses power expressions
3
+ --TEMPLATE--
4
+ {{ 2**3 }}
5
+ {{ (-2)**3 }}
6
+ {{ (-2)**(-3) }}
7
+ {{ a ** a }}
8
+ {{ a ** b }}
9
+ {{ b ** a }}
10
+ {{ b ** b }}
11
+ --DATA--
12
+ return array('a' => 4, 'b' => -2);
13
+ --EXPECT--
14
+ 8
15
+ -8
16
+ -0.125
17
+ 256
18
+ 0.0625
19
+ 16
20
+ 0.25
vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_with_template.test ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "block" function with a template argument
3
+ --TEMPLATE--
4
+ {{ block('foo', 'included.twig') }}
5
+ {{ block('foo', included_loaded) }}
6
+ {{ block('foo', included_loaded_internal) }}
7
+ {% set output = block('foo', 'included.twig') %}
8
+ {{ output }}
9
+ {% block foo %}NOT FOO{% endblock %}
10
+ --TEMPLATE(included.twig)--
11
+ {% block foo %}FOO{% endblock %}
12
+ --DATA--
13
+ return array(
14
+ 'included_loaded' => $twig->load('included.twig'),
15
+ 'included_loaded_internal' => $twig->loadTemplate('included.twig'),
16
+ )
17
+ --EXPECT--
18
+ FOO
19
+ FOO
20
+ FOO
21
+ FOO
22
+ NOT FOO
vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block_without_name.test ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "block" function without arguments
3
+ --TEMPLATE--
4
+ {% extends 'base.twig' %}
5
+ {% block bar %}BAR{% endblock %}
6
+ --TEMPLATE(base.twig)--
7
+ {% block foo %}{{ block() }}{% endblock %}
8
+ {% block bar %}BAR_BASE{% endblock %}
9
+ --DATA--
10
+ return array()
11
+ --EXCEPTION--
12
+ Twig_Error_Syntax: The "block" function takes one argument (the block name) in "base.twig" at line 2.
vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test CHANGED
@@ -1,7 +1,7 @@
1
  --TEST--
2
  "date" function
3
  --TEMPLATE--
4
- {{ date() == date('now') ? 'OK' : 'KO' }}
5
  {{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
6
  {{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
7
  {{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
1
  --TEST--
2
  "date" function
3
  --TEMPLATE--
4
+ {{ date().format('r') == date('now').format('r') ? 'OK' : 'KO' }}
5
  {{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
6
  {{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
7
  {{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }}
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/basic.test ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "with" tag
3
+ --TEMPLATE--
4
+ {% with %}
5
+ {% set bar = 'BAZ' %}
6
+ {{ foo }}{{ bar }}
7
+ {% endwith %}
8
+ {{ foo }}{{ bar }}
9
+ --DATA--
10
+ return array('foo' => 'foo', 'bar' => 'bar')
11
+ --EXPECT--
12
+ fooBAZ
13
+ foobar
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/expression.test ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "with" tag with expression
3
+ --TEMPLATE--
4
+ {% with {foo: 'foo', bar: 'BAZ'} %}
5
+ {{ foo }}{{ bar }}
6
+ {% endwith %}
7
+ --DATA--
8
+ return array('foo' => 'baz')
9
+ --EXPECT--
10
+ fooBAZ
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/nested.test ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ nested "with" tags
3
+ --TEMPLATE--
4
+ {% set foo, bar = 'foo', 'bar' %}
5
+ {% with {bar: 'BAZ'} %}
6
+ {% with {foo: 'FOO'} %}
7
+ {{ foo }}{{ bar }}
8
+ {% endwith %}
9
+ {% endwith %}
10
+ {{ foo }}{{ bar }}
11
+ --DATA--
12
+ return array()
13
+ --EXPECT--
14
+ FOOBAZ
15
+ foobar
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_no_hash.test ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "with" tag with an expression that is not a hash
3
+ --TEMPLATE--
4
+ {% with vars %}
5
+ {{ foo }}{{ bar }}
6
+ {% endwith %}
7
+ --DATA--
8
+ return array('vars' => 'no-hash')
9
+ --EXCEPTION--
10
+ Twig_Error_Runtime: Variables passed to the "with" tag must be a hash in "index.twig" at line 2.
vendor/twig/twig/test/Twig/Tests/Fixtures/tags/with/with_only.test ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "with" tag with expression and only
3
+ --TEMPLATE--
4
+ {% with {foo: 'foo', bar: 'BAZ'} only %}
5
+ {{ foo }}{{ bar }}{{ baz }}
6
+ {% endwith %}
7
+ --DATA--
8
+ return array('foo' => 'baz', 'baz' => 'baz')
9
+ --EXCEPTION--
10
+ Twig_Error_Runtime: Variable "baz" does not exist in "index.twig" at line 3.
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_attribute.test ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "defined" support for attribute
3
+ --TEMPLATE--
4
+ {{ attribute(nested, "definedVar") is defined ? 'ok' : 'ko' }}
5
+ {{ attribute(nested, "undefinedVar") is not defined ? 'ok' : 'ko' }}
6
+ {{ attribute(nested, definedVarName) is defined ? 'ok' : 'ko' }}
7
+ {{ attribute(nested, undefinedVarName) is not defined ? 'ok' : 'ko' }}
8
+ --DATA--
9
+ return array(
10
+ 'nested' => array(
11
+ 'definedVar' => 'defined',
12
+ ),
13
+ 'definedVarName' => 'definedVar',
14
+ 'undefinedVarName' => 'undefinedVar',
15
+ );
16
+ --EXPECT--
17
+ ok
18
+ ok
19
+ ok
20
+ ok
21
+ --DATA--
22
+ return array(
23
+ 'nested' => array(
24
+ 'definedVar' => 'defined',
25
+ ),
26
+ 'definedVarName' => 'definedVar',
27
+ 'undefinedVarName' => 'undefinedVar',
28
+ );
29
+ --CONFIG--
30
+ return array('strict_variables' => false)
31
+ --EXPECT--
32
+ ok
33
+ ok
34
+ ok
35
+ ok
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "defined" support for blocks
3
+ --TEMPLATE--
4
+ {% extends 'parent' %}
5
+ {% block icon %}icon{% endblock %}
6
+ {% block body %}
7
+ {{ parent() }}
8
+ {{ block('foo') is defined ? 'ok' : 'ko' }}
9
+ {{ block('footer') is defined ? 'ok' : 'ko' }}
10
+ {{ block('icon') is defined ? 'ok' : 'ko' }}
11
+ {{ block('block1') is defined ? 'ok' : 'ko' }}
12
+ {%- embed 'embed' %}
13
+ {% block content %}content{% endblock %}
14
+ {% endembed %}
15
+ {% endblock %}
16
+ {% use 'blocks' %}
17
+ --TEMPLATE(parent)--
18
+ {% block body %}
19
+ {{ block('icon') is defined ? 'ok' : 'ko' -}}
20
+ {% endblock %}
21
+ {% block footer %}{% endblock %}
22
+ --TEMPLATE(embed)--
23
+ {{ block('icon') is defined ? 'ok' : 'ko' }}
24
+ {{ block('content') is defined ? 'ok' : 'ko' }}
25
+ {{ block('block1') is defined ? 'ok' : 'ko' }}
26
+ --TEMPLATE(blocks)--
27
+ {% block block1 %}{%endblock %}
28
+ --DATA--
29
+ return array()
30
+ --EXPECT--
31
+ ok
32
+ ko
33
+ ok
34
+ ok
35
+ ok
36
+ ko
37
+ ok
38
+ ko
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks_with_template.test ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "defined" support for blocks with a template argument
3
+ --TEMPLATE--
4
+ {{ block('foo', 'included.twig') is defined ? 'ok' : 'ko' }}
5
+ {{ block('foo', included_loaded) is defined ? 'ok' : 'ko' }}
6
+ {{ block('foo', included_loaded_internal) is defined ? 'ok' : 'ko' }}
7
+ --TEMPLATE(included.twig)--
8
+ {% block foo %}FOO{% endblock %}
9
+ --DATA--
10
+ return array(
11
+ 'included_loaded' => $twig->load('included.twig'),
12
+ 'included_loaded_internal' => $twig->loadTemplate('included.twig'),
13
+ )
14
+ --EXPECT--
15
+ ok
16
+ ok
17
+ ok
vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_constants.test ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ --TEST--
2
+ "defined" support for constants
3
+ --TEMPLATE--
4
+ {{ constant('DATE_W3C') is defined ? 'ok' : 'ko' }}
5
+ {{ constant('ARRAY_AS_PROPS', object) is defined ? 'ok' : 'ko' }}
6
+ {{ constant('FOOBAR') is not defined ? 'ok' : 'ko' }}
7
+ {{ constant('FOOBAR', object) is not defined ? 'ok' : 'ko' }}
8
+ --DATA--
9
+ return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi')));
10
+ --EXPECT--
11
+ ok
12
+ ok
13
+ ok
14
+ ok
vendor/twig/twig/test/Twig/Tests/NativeExtensionTest.php CHANGED
@@ -11,6 +11,9 @@
11
 
12
  class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase
13
  {
 
 
 
14
  public function testGetProperties()
15
  {
16
  if (defined('HHVM_VERSION')) {
11
 
12
  class Twig_Tests_NativeExtensionTest extends PHPUnit_Framework_TestCase
13
  {
14
+ /**
15
+ * @requires PHP 5.3
16
+ */
17
  public function testGetProperties()
18
  {
19
  if (defined('HHVM_VERSION')) {
vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php CHANGED
@@ -26,8 +26,16 @@ class Twig_Tests_Node_Expression_NameTest extends Twig_Test_NodeTestCase
26
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true));
27
  $env1 = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => false));
28
 
 
 
 
 
 
 
 
 
29
  return array(
30
- array($node, "// line 1\n".(PHP_VERSION_ID >= 50400 ? '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))' : '$this->getContext($context, "foo")'), $env),
31
  array($node, $this->getVariableGetter('foo', 1), $env1),
32
  array($context, "// line 1\n\$context"),
33
  );
26
  $env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => true));
27
  $env1 = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock(), array('strict_variables' => false));
28
 
29
+ if (PHP_VERSION_ID >= 70000) {
30
+ $output = '($context["foo"] ?? $this->getContext($context, "foo"))';
31
+ } elseif (PHP_VERSION_ID >= 50400) {
32
+ $output = '(isset($context["foo"]) ? $context["foo"] : $this->getContext($context, "foo"))';
33
+ } else {
34
+ $output = '$this->getContext($context, "foo")';
35
+ }
36
+
37
  return array(
38
+ array($node, "// line 1\n".$output, $env),
39
  array($node, $this->getVariableGetter('foo', 1), $env1),
40
  array($context, "// line 1\n\$context"),
41
  );
vendor/twig/twig/test/Twig/Tests/Node/Expression/NullCoalesceTest.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ class Twig_Tests_Node_Expression_NullCoalesceTest extends Twig_Test_NodeTestCase
13
+ {
14
+ public function getTests()
15
+ {
16
+ $tests = array();
17
+
18
+ $left = new Twig_Node_Expression_Name('foo', 1);
19
+ $right = new Twig_Node_Expression_Constant(2, 1);
20
+ $node = new Twig_Node_Expression_NullCoalesce($left, $right, 1);
21
+ if (PHP_VERSION_ID >= 70000) {
22
+ $tests[] = array($node, "((// line 1\n\$context[\"foo\"]) ?? (2))");
23
+ } elseif (PHP_VERSION_ID >= 50400) {
24
+ $tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === (isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)))) ? ((isset(\$context[\"foo\"]) ? \$context[\"foo\"] : null)) : (2))");
25
+ } else {
26
+ $tests[] = array($node, "(((// line 1\narray_key_exists(\"foo\", \$context) && !(null === \$this->getContext(\$context, \"foo\")))) ? (\$this->getContext(\$context, \"foo\")) : (2))");
27
+ }
28
+
29
+ return $tests;
30
+ }
31
+ }
vendor/twig/twig/test/Twig/Tests/TemplateTest.php CHANGED
@@ -130,11 +130,16 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
130
 
131
  /**
132
  * @dataProvider getGetAttributeWithTemplateAsObject
 
133
  */
134
  public function testGetAttributeWithTemplateAsObject($useExt)
135
  {
136
- $template = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), $useExt);
137
- $template1 = new Twig_TemplateTest(new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock()), false);
 
 
 
 
138
 
139
  $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
140
  $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
@@ -167,6 +172,67 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
167
  return $bools;
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  /**
171
  * @dataProvider getTestsDependingOnExtensionAvailability
172
  */
@@ -279,6 +345,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
279
  'null' => null,
280
  '1' => 1,
281
  'bar' => true,
 
282
  '09' => '09',
283
  '+4' => '+4',
284
  );
@@ -307,6 +374,7 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
307
  array(true, 1, 1.0),
308
  array(true, null, 'null'),
309
  array(true, true, 'bar'),
 
310
  array(true, '09', '09'),
311
  array(true, '+4', '+4'),
312
  );
@@ -387,9 +455,9 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
387
 
388
  // tests when input is not an array or object
389
  $tests = array_merge($tests, array(
390
- array(false, null, 42, 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a integer variable ("42").'),
391
- array(false, null, 'string', 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string").'),
392
- array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty.'),
393
  ));
394
 
395
  // add twig_template_get_attributes tests
@@ -409,12 +477,14 @@ class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase
409
  class Twig_TemplateTest extends Twig_Template
410
  {
411
  protected $useExtGetAttribute = false;
 
412
 
413
- public function __construct(Twig_Environment $env, $useExtGetAttribute = false)
414
  {
415
  parent::__construct($env);
416
  $this->useExtGetAttribute = $useExtGetAttribute;
417
  self::$cache = array();
 
418
  }
419
 
420
  public function getZero()
@@ -439,6 +509,7 @@ class Twig_TemplateTest extends Twig_Template
439
 
440
  public function getTemplateName()
441
  {
 
442
  }
443
 
444
  public function getDebugInfo()
@@ -446,13 +517,9 @@ class Twig_TemplateTest extends Twig_Template
446
  return array();
447
  }
448
 
449
- public function getSource()
450
- {
451
- return '';
452
- }
453
-
454
  protected function doGetParent(array $context)
455
  {
 
456
  }
457
 
458
  protected function doDisplay(array $context, array $blocks = array())
@@ -479,6 +546,7 @@ class Twig_TemplateArrayAccessObject implements ArrayAccess
479
  'null' => null,
480
  '1' => 1,
481
  'bar' => true,
 
482
  '09' => '09',
483
  '+4' => '+4',
484
  );
@@ -511,6 +579,7 @@ class Twig_TemplateMagicPropertyObject
511
  'null' => null,
512
  '1' => 1,
513
  'bar' => true,
 
514
  '09' => '09',
515
  '+4' => '+4',
516
  );
@@ -542,6 +611,7 @@ class Twig_TemplatePropertyObject
542
  public $zero = 0;
543
  public $null = null;
544
  public $bar = true;
 
545
 
546
  protected $protected = 'protected';
547
  }
@@ -618,6 +688,16 @@ class Twig_TemplateMethodObject
618
  return true;
619
  }
620
 
 
 
 
 
 
 
 
 
 
 
621
  protected function getProtected()
622
  {
623
  return 'protected';
@@ -687,3 +767,8 @@ class CExtDisablingNodeVisitor implements Twig_NodeVisitorInterface
687
  return 0;
688
  }
689
  }
 
 
 
 
 
130
 
131
  /**
132
  * @dataProvider getGetAttributeWithTemplateAsObject
133
+ * @group legacy
134
  */
135
  public function testGetAttributeWithTemplateAsObject($useExt)
136
  {
137
+ // to be removed in 2.0
138
+ $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
139
+ //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock());
140
+
141
+ $template = new Twig_TemplateTest($twig, $useExt, 'index.twig');
142
+ $template1 = new Twig_TemplateTest($twig, false, 'index1.twig');
143
 
144
  $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
145
  $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
172
  return $bools;
173
  }
174
 
175
+ /**
176
+ * @group legacy
177
+ * @expectedDeprecation Calling "getString" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
178
+ * @expectedDeprecation Calling "getString" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
179
+ * @expectedDeprecation Calling "getTrue" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
180
+ * @expectedDeprecation Calling "getTrue" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
181
+ * @expectedDeprecation Calling "getZero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
182
+ * @expectedDeprecation Calling "getZero" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
183
+ * @expectedDeprecation Calling "getEmpty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
184
+ * @expectedDeprecation Calling "getEmpty" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0.
185
+ * @expectedDeprecation Calling "renderBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
186
+ * @expectedDeprecation Calling "displayBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name") instead).
187
+ * @expectedDeprecation Calling "hasBlock" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name") is defined" instead).
188
+ * @expectedDeprecation Calling "render" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
189
+ * @expectedDeprecation Calling "display" on template "index.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index.twig") instead).
190
+ * @expectedDeprecation Calling "renderBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
191
+ * @expectedDeprecation Calling "displayBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use block("name", template) instead).
192
+ * @expectedDeprecation Calling "hasBlock" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use "block("name", template) is defined" instead).
193
+ * @expectedDeprecation Calling "render" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
194
+ * @expectedDeprecation Calling "display" on template "index1.twig" from template "index.twig" is deprecated since version 1.28 and won't be supported anymore in 2.0. Use include("index1.twig") instead).
195
+ */
196
+ public function testGetAttributeWithTemplateAsObjectForDeprecations()
197
+ {
198
+ // to be removed in 2.0
199
+ $twig = new Twig_Environment($this->getMockBuilder('Twig_TemplateTestLoaderInterface')->getMock());
200
+ //$twig = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface', 'Twig_SourceContextLoaderInterface')->getMock());
201
+
202
+ $template = new Twig_TemplateTest($twig, false, 'index.twig');
203
+ $template1 = new Twig_TemplateTest($twig, false, 'index1.twig');
204
+
205
+ $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'string'));
206
+ $this->assertEquals('some_string', $template->getAttribute($template1, 'string'));
207
+
208
+ $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'true'));
209
+ $this->assertEquals('1', $template->getAttribute($template1, 'true'));
210
+
211
+ $this->assertInstanceof('Twig_Markup', $template->getAttribute($template1, 'zero'));
212
+ $this->assertEquals('0', $template->getAttribute($template1, 'zero'));
213
+
214
+ $this->assertNotInstanceof('Twig_Markup', $template->getAttribute($template1, 'empty'));
215
+ $this->assertSame('', $template->getAttribute($template1, 'empty'));
216
+
217
+ // trigger some deprecation notice messages to check them with @expectedDeprecation
218
+ $template->getAttribute($template, 'renderBlock', array('name', array()));
219
+ $template->getAttribute($template, 'displayBlock', array('name', array()));
220
+ $template->getAttribute($template, 'hasBlock', array('name', array()));
221
+ $template->getAttribute($template, 'render', array(array()));
222
+ $template->getAttribute($template, 'display', array(array()));
223
+
224
+ $template->getAttribute($template1, 'renderBlock', array('name', array()));
225
+ $template->getAttribute($template1, 'displayBlock', array('name', array()));
226
+ $template->getAttribute($template1, 'hasBlock', array('name', array()));
227
+ $template->getAttribute($template1, 'render', array(array()));
228
+ $template->getAttribute($template1, 'display', array(array()));
229
+
230
+ $this->assertFalse($template->getAttribute($template1, 'env', array(), Twig_Template::ANY_CALL, true));
231
+ $this->assertFalse($template->getAttribute($template1, 'environment', array(), Twig_Template::ANY_CALL, true));
232
+ $this->assertFalse($template->getAttribute($template1, 'getEnvironment', array(), Twig_Template::METHOD_CALL, true));
233
+ $this->assertFalse($template->getAttribute($template1, 'displayWithErrorHandling', array(), Twig_Template::METHOD_CALL, true));
234
+ }
235
+
236
  /**
237
  * @dataProvider getTestsDependingOnExtensionAvailability
238
  */
345
  'null' => null,
346
  '1' => 1,
347
  'bar' => true,
348
+ 'baz' => 'baz',
349
  '09' => '09',
350
  '+4' => '+4',
351
  );
374
  array(true, 1, 1.0),
375
  array(true, null, 'null'),
376
  array(true, true, 'bar'),
377
+ array(true, 'baz', 'baz'),
378
  array(true, '09', '09'),
379
  array(true, '+4', '+4'),
380
  );
455
 
456
  // tests when input is not an array or object
457
  $tests = array_merge($tests, array(
458
+ array(false, null, 42, 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a integer variable ("42") in "index.twig".'),
459
+ array(false, null, 'string', 'a', array(), $anyType, false, 'Impossible to access an attribute ("a") on a string variable ("string") in "index.twig".'),
460
+ array(false, null, array(), 'a', array(), $anyType, false, 'Key "a" does not exist as the array is empty in "index.twig".'),
461
  ));
462
 
463
  // add twig_template_get_attributes tests
477
  class Twig_TemplateTest extends Twig_Template
478
  {
479
  protected $useExtGetAttribute = false;
480
+ private $name;
481
 
482
+ public function __construct(Twig_Environment $env, $useExtGetAttribute = false, $name = 'index.twig')
483
  {
484
  parent::__construct($env);
485
  $this->useExtGetAttribute = $useExtGetAttribute;
486
  self::$cache = array();
487
+ $this->name = $name;
488
  }
489
 
490
  public function getZero()
509
 
510
  public function getTemplateName()
511
  {
512
+ return $this->name;
513
  }
514
 
515
  public function getDebugInfo()
517
  return array();
518
  }
519
 
 
 
 
 
 
520
  protected function doGetParent(array $context)
521
  {
522
+ return false;
523
  }
524
 
525
  protected function doDisplay(array $context, array $blocks = array())
546
  'null' => null,
547
  '1' => 1,
548
  'bar' => true,
549
+ 'baz' => 'baz',
550
  '09' => '09',
551
  '+4' => '+4',
552
  );
579
  'null' => null,
580
  '1' => 1,
581
  'bar' => true,
582
+ 'baz' => 'baz',
583
  '09' => '09',
584
  '+4' => '+4',
585
  );
611
  public $zero = 0;
612
  public $null = null;
613
  public $bar = true;
614
+ public $baz = 'baz';
615
 
616
  protected $protected = 'protected';
617
  }
688
  return true;
689
  }
690
 
691
+ public function isBaz()
692
+ {
693
+ return 'should never be returned';
694
+ }
695
+
696
+ public function getBaz()
697
+ {
698
+ return 'baz';
699
+ }
700
+
701
  protected function getProtected()
702
  {
703
  return 'protected';
767
  return 0;
768
  }
769
  }
770
+
771
+ // to be removed in 2.0
772
+ interface Twig_TemplateTestLoaderInterface extends Twig_LoaderInterface, Twig_SourceContextLoaderInterface
773
+ {
774
+ }
vendor/twig/twig/test/Twig/Tests/TemplateWrapperTest.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of Twig.
5
+ *
6
+ * (c) Fabien Potencier
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+ class Twig_Tests_TemplateWrapperTest extends PHPUnit_Framework_TestCase
12
+ {
13
+ public function testHasGetBlocks()
14
+ {
15
+ $twig = new Twig_Environment(new Twig_Loader_Array(array(
16
+ 'index' => '{% block foo %}{% endblock %}',
17
+ 'index_with_use' => '{% use "imported" %}{% block foo %}{% endblock %}',
18
+ 'index_with_extends' => '{% extends "extended" %}{% block foo %}{% endblock %}',
19
+ 'imported' => '{% block imported %}{% endblock %}',
20
+ 'extended' => '{% block extended %}{% endblock %}',
21
+ )));
22
+
23
+ $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index'));
24
+ $this->assertTrue($wrapper->hasBlock('foo'));
25
+ $this->assertFalse($wrapper->hasBlock('bar'));
26
+ $this->assertEquals(array('foo'), $wrapper->getBlockNames());
27
+
28
+ $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_use'));
29
+ $this->assertTrue($wrapper->hasBlock('foo'));
30
+ $this->assertTrue($wrapper->hasBlock('imported'));
31
+ $this->assertEquals(array('imported', 'foo'), $wrapper->getBlockNames());
32
+
33
+ $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index_with_extends'));
34
+ $this->assertTrue($wrapper->hasBlock('foo'));
35
+ $this->assertTrue($wrapper->hasBlock('extended'));
36
+ $this->assertEquals(array('foo', 'extended'), $wrapper->getBlockNames());
37
+ }
38
+
39
+ public function testRenderBlock()
40
+ {
41
+ $twig = new Twig_Environment(new Twig_Loader_Array(array(
42
+ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
43
+ )));
44
+ $twig->addGlobal('bar', 'BAR');
45
+
46
+ $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index'));
47
+ $this->assertEquals('FOOBAR', $wrapper->renderBlock('foo', array('foo' => 'FOO')));
48
+ }
49
+
50
+ public function testDisplayBlock()
51
+ {
52
+ $twig = new Twig_Environment(new Twig_Loader_Array(array(
53
+ 'index' => '{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
54
+ )));
55
+ $twig->addGlobal('bar', 'BAR');
56
+
57
+ $wrapper = new Twig_TemplateWrapper($twig, $twig->loadTemplate('index'));
58
+
59
+ ob_start();
60
+ $wrapper->displayBlock('foo', array('foo' => 'FOO'));
61
+
62
+ $this->assertEquals('FOOBAR', ob_get_clean());
63
+ }
64
+ }