├── README.MD ├── composer.json ├── drush.services.yml ├── potx.admin.inc ├── potx.drush.inc ├── potx.inc ├── potx.info.yml ├── potx.local.inc ├── potx.module ├── src └── Commands │ └── PotxCommands.php ├── tests ├── LanguageManager.php ├── TestConstraint.php ├── drupal8 │ ├── broken_twig.html.twig │ ├── config │ │ ├── install │ │ │ ├── broken_yaml.yml │ │ │ └── test.settings.yml │ │ ├── optional │ │ │ └── test.settings.yml │ │ └── schema │ │ │ ├── test.data_types.schema.yml │ │ │ ├── test.schema.yml │ │ │ ├── test.sequences.schema.yml │ │ │ └── test.variables.schema.yml │ └── core │ │ └── config │ │ └── schema │ │ ├── core.data_types.schema.yml │ │ ├── core.entity.schema.yml │ │ ├── core.extension.schema.yml │ │ └── core.menu.schema.yml ├── potx.test ├── potx_test.js ├── potx_test_5.module ├── potx_test_6.info ├── potx_test_6.module ├── potx_test_7.module ├── potx_test_8.breakpoints.yml ├── potx_test_8.html.twig ├── potx_test_8.info.yml ├── potx_test_8.links.action.yml ├── potx_test_8.links.contextual.yml ├── potx_test_8.links.menu.yml ├── potx_test_8.links.task.yml ├── potx_test_8.module.txt ├── potx_test_8.permissions.yml ├── potx_test_8.routing.yml ├── potx_test_8 │ ├── potx_test_8.test.yml │ └── yaml_translation_patterns.yml └── potx_test_yml │ ├── broken_yaml.yml │ ├── potx_test_8.test2.yml │ ├── test_folder │ └── potx_test_8.test3.yml │ └── yaml_translation_patterns.yml ├── vendor ├── Symfony │ └── Component │ │ └── Yaml │ │ ├── CHANGELOG.md │ │ ├── Dumper.php │ │ ├── Escaper.php │ │ ├── Exception │ │ ├── DumpException.php │ │ ├── ExceptionInterface.php │ │ ├── ParseException.php │ │ └── RuntimeException.php │ │ ├── Inline.php │ │ ├── LICENSE │ │ ├── Parser.php │ │ ├── README.md │ │ ├── Tests │ │ ├── DumperTest.php │ │ ├── Fixtures │ │ │ ├── YtsAnchorAlias.yml │ │ │ ├── YtsBasicTests.yml │ │ │ ├── YtsBlockMapping.yml │ │ │ ├── YtsDocumentSeparator.yml │ │ │ ├── YtsErrorTests.yml │ │ │ ├── YtsFlowCollections.yml │ │ │ ├── YtsFoldedScalars.yml │ │ │ ├── YtsNullsAndEmpties.yml │ │ │ ├── YtsSpecificationExamples.yml │ │ │ ├── YtsTypeTransfers.yml │ │ │ ├── embededPhp.yml │ │ │ ├── escapedCharacters.yml │ │ │ ├── index.yml │ │ │ ├── sfComments.yml │ │ │ ├── sfCompact.yml │ │ │ ├── sfMergeKey.yml │ │ │ ├── sfObjects.yml │ │ │ ├── sfQuotes.yml │ │ │ ├── sfTests.yml │ │ │ └── unindentedCollections.yml │ │ ├── InlineTest.php │ │ ├── ParserTest.php │ │ └── YamlTest.php │ │ ├── Unescaper.php │ │ ├── Yaml.php │ │ ├── composer.json │ │ └── phpunit.xml.dist └── Twig │ ├── Autoloader.php │ ├── BaseNodeVisitor.php │ ├── Cache │ ├── Filesystem.php │ └── Null.php │ ├── CacheInterface.php │ ├── Compiler.php │ ├── CompilerInterface.php │ ├── Environment.php │ ├── Error.php │ ├── Error │ ├── Loader.php │ ├── Runtime.php │ └── Syntax.php │ ├── ExistsLoaderInterface.php │ ├── ExpressionParser.php │ ├── Extension.php │ ├── Extension │ ├── Core.php │ ├── Debug.php │ ├── Escaper.php │ ├── GlobalsInterface.php │ ├── InitRuntimeInterface.php │ ├── Optimizer.php │ ├── Profiler.php │ ├── Sandbox.php │ ├── Staging.php │ └── StringLoader.php │ ├── ExtensionInterface.php │ ├── FileExtensionEscapingStrategy.php │ ├── Filter.php │ ├── Filter │ ├── Function.php │ ├── Method.php │ └── Node.php │ ├── FilterCallableInterface.php │ ├── FilterInterface.php │ ├── Function.php │ ├── Function │ ├── Function.php │ ├── Method.php │ └── Node.php │ ├── FunctionCallableInterface.php │ ├── FunctionInterface.php │ ├── Lexer.php │ ├── LexerInterface.php │ ├── Loader │ ├── Array.php │ ├── Chain.php │ ├── Filesystem.php │ └── String.php │ ├── LoaderInterface.php │ ├── Markup.php │ ├── Node.php │ ├── Node │ ├── AutoEscape.php │ ├── Block.php │ ├── BlockReference.php │ ├── Body.php │ ├── CheckSecurity.php │ ├── Do.php │ ├── Embed.php │ ├── Expression.php │ ├── Expression │ │ ├── Array.php │ │ ├── AssignName.php │ │ ├── Binary.php │ │ ├── Binary │ │ │ ├── Add.php │ │ │ ├── And.php │ │ │ ├── BitwiseAnd.php │ │ │ ├── BitwiseOr.php │ │ │ ├── BitwiseXor.php │ │ │ ├── Concat.php │ │ │ ├── Div.php │ │ │ ├── EndsWith.php │ │ │ ├── Equal.php │ │ │ ├── FloorDiv.php │ │ │ ├── Greater.php │ │ │ ├── GreaterEqual.php │ │ │ ├── In.php │ │ │ ├── Less.php │ │ │ ├── LessEqual.php │ │ │ ├── Matches.php │ │ │ ├── Mod.php │ │ │ ├── Mul.php │ │ │ ├── NotEqual.php │ │ │ ├── NotIn.php │ │ │ ├── Or.php │ │ │ ├── Power.php │ │ │ ├── Range.php │ │ │ ├── StartsWith.php │ │ │ └── Sub.php │ │ ├── BlockReference.php │ │ ├── Call.php │ │ ├── Conditional.php │ │ ├── Constant.php │ │ ├── ExtensionReference.php │ │ ├── Filter.php │ │ ├── Filter │ │ │ └── Default.php │ │ ├── Function.php │ │ ├── GetAttr.php │ │ ├── MethodCall.php │ │ ├── Name.php │ │ ├── Parent.php │ │ ├── TempName.php │ │ ├── Test.php │ │ ├── Test │ │ │ ├── Constant.php │ │ │ ├── Defined.php │ │ │ ├── Divisibleby.php │ │ │ ├── Even.php │ │ │ ├── Null.php │ │ │ ├── Odd.php │ │ │ └── Sameas.php │ │ ├── Unary.php │ │ └── Unary │ │ │ ├── Neg.php │ │ │ ├── Not.php │ │ │ └── Pos.php │ ├── Flush.php │ ├── For.php │ ├── ForLoop.php │ ├── If.php │ ├── Import.php │ ├── Include.php │ ├── Macro.php │ ├── Module.php │ ├── Print.php │ ├── Sandbox.php │ ├── SandboxedPrint.php │ ├── Set.php │ ├── SetTemp.php │ ├── Spaceless.php │ └── Text.php │ ├── NodeInterface.php │ ├── NodeOutputInterface.php │ ├── NodeTraverser.php │ ├── NodeVisitor │ ├── Escaper.php │ ├── Optimizer.php │ ├── SafeAnalysis.php │ └── Sandbox.php │ ├── NodeVisitorInterface.php │ ├── Parser.php │ ├── ParserInterface.php │ ├── Profiler │ ├── Dumper │ │ ├── Blackfire.php │ │ ├── Html.php │ │ └── Text.php │ ├── Node │ │ ├── EnterProfile.php │ │ └── LeaveProfile.php │ ├── NodeVisitor │ │ └── Profiler.php │ └── Profile.php │ ├── Sandbox │ ├── SecurityError.php │ ├── SecurityNotAllowedFilterError.php │ ├── SecurityNotAllowedFunctionError.php │ ├── SecurityNotAllowedTagError.php │ ├── SecurityPolicy.php │ └── SecurityPolicyInterface.php │ ├── SimpleFilter.php │ ├── SimpleFunction.php │ ├── SimpleTest.php │ ├── Template.php │ ├── TemplateInterface.php │ ├── Test.php │ ├── Test │ ├── Function.php │ ├── IntegrationTestCase.php │ ├── Method.php │ ├── Node.php │ └── NodeTestCase.php │ ├── TestCallableInterface.php │ ├── TestInterface.php │ ├── Token.php │ ├── TokenParser.php │ ├── TokenParser │ ├── AutoEscape.php │ ├── Block.php │ ├── Do.php │ ├── Embed.php │ ├── Extends.php │ ├── Filter.php │ ├── Flush.php │ ├── For.php │ ├── From.php │ ├── If.php │ ├── Import.php │ ├── Include.php │ ├── Macro.php │ ├── Sandbox.php │ ├── Set.php │ ├── Spaceless.php │ └── Use.php │ ├── TokenParserBroker.php │ ├── TokenParserBrokerInterface.php │ ├── TokenParserInterface.php │ ├── TokenStream.php │ └── Util │ ├── DeprecationCollector.php │ └── TemplateDirIterator.php └── yaml_translation_patterns.yml /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kgaut/potx", 3 | "description": "Translation template extractor port for Drupal 8", 4 | "keywords": ["l10n","drupal8","drupal"], 5 | "license": "GPL-2.0-or-later", 6 | "homepage": "https://mespronos.net", 7 | "require": { 8 | "composer/installers": "~1.0" 9 | }, 10 | "extra": { 11 | "installer-name": "potx", 12 | "drush": { 13 | "services": { 14 | "drush.services.yml": "^9" 15 | } 16 | } 17 | }, 18 | "type":"drupal-module" 19 | } 20 | -------------------------------------------------------------------------------- /drush.services.yml: -------------------------------------------------------------------------------- 1 | services: 2 | potx.commands: 3 | class: \Drupal\potx\Commands\PotxCommands 4 | tags: 5 | - { name: drush.command } 6 | -------------------------------------------------------------------------------- /potx.info.yml: -------------------------------------------------------------------------------- 1 | name: Translation template extractor 2 | description: Provides a web interface and an API to extract translatable text from the sources of installed components. 3 | core: 8.x 4 | package: Multilingual 5 | version: 8.x-1.x-dev 6 | dependencies: 7 | - locale 8 | type: module 9 | -------------------------------------------------------------------------------- /tests/LanguageManager.php: -------------------------------------------------------------------------------- 1 | array('Test English language', 'Test localized language'), 16 | ); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tests/TestConstraint.php: -------------------------------------------------------------------------------- 1 | 15 | 'node/add/blog', 16 | 'title' => t('Test menu item in 5'), 17 | 'description' => t('This is a test menu item in 5'), 18 | 'access' => user_access('access content'), 19 | 'callback' => 'potx_test_5_page', 20 | ); 21 | $items[] = array('path' => 22 | 'test-empty-t', 23 | 'title' => t(''), 24 | ); 25 | } 26 | return $items; 27 | } 28 | 29 | function potx_test_5_page() { 30 | t('This is a test string.'); 31 | format_plural($count, '1 test string', '@count test strings'); 32 | watchdog('test watchdog type', 'My watchdog message'); 33 | 34 | st('Installer only test string'); 35 | $t('Dynamic callback test string'); 36 | 37 | t('Test string in context', array(), array('context' => 'Test context')); 38 | format_plural($count, '1 test string in context', '@count test strings in context', array(), array('context' => 'Test context')); 39 | t(''); 40 | 41 | st('Installer string in context', array(), array('context' => 'Installer context')); 42 | $t('Dynamic string in context', array(), array('context' => 'Dynamic context')); 43 | } 44 | 45 | function potx_test_5_perm() { 46 | return array('test potx permission', 'one more test potx permission', ''); 47 | } 48 | 49 | function potx_test_5_permission() { 50 | return array( 51 | 'test potx permission' => array( 52 | 'title' => t('Test potx permission'), 53 | 'description' => t('Test potx permission description'), 54 | ), 55 | 'one more test potx permission' => array( 56 | 'title' => t('One more test potx permission'), 57 | 'description' => t('One more test potx permission description'), 58 | ), 59 | ); 60 | } 61 | -------------------------------------------------------------------------------- /tests/potx_test_6.info: -------------------------------------------------------------------------------- 1 | name = Translation template extractor tester 2 | description = Test description 3 | package = Test package 4 | version = 6.x 5 | core = 6.x 6 | hidden = TRUE 7 | -------------------------------------------------------------------------------- /tests/potx_test_6.module: -------------------------------------------------------------------------------- 1 | 'Test menu item', 15 | 'description' => 'This is a test menu item', 16 | 'page callback' => 'potx_test_6_page', 17 | ); 18 | $items['translate/test-empty'] = array( 19 | 'title' => '', 20 | ); 21 | $items['translate/test-empty']['description'] = 'Test menu item description'; 22 | return $items; 23 | } 24 | 25 | /** 26 | * Implementation of hook_menu_alter() 27 | */ 28 | function potx_test_6_menu_alter(&$items) { 29 | $items['translate/test-empty']['description'] = 'Test menu item description altered (1)'; 30 | $items['translate/test-empty'] = array_merge( 31 | $items['translate/test-empty'], 32 | array( 33 | 'title' => 'Test menu item title altered', 34 | 'description' => 'Test menu item description altered (2)', 35 | ) 36 | ); 37 | } 38 | 39 | function potx_test_6_page() { 40 | t('This is a test string.'); 41 | format_plural($count, '1 test string', '@count test strings'); 42 | format_plural($count); 43 | format_plural(); 44 | watchdog('test watchdog type', 'My watchdog message'); 45 | 46 | st('Installer only test string'); 47 | $t('Dynamic callback test string'); 48 | 49 | t('Test string in context', array(), array('context' => 'Test context')); 50 | format_plural($count, '1 test string in context', '@count test strings in context', array(), array('context' => 'Test context')); 51 | t(''); 52 | 53 | st('Installer string in context', array(), array('context' => 'Installer context')); 54 | $t('Dynamic string in context', array(), array('context' => 'Dynamic context')); 55 | } 56 | 57 | function potx_test_6_perm() { 58 | return array('test potx permission', 'one more test potx permission', ''); 59 | } 60 | 61 | function potx_test_6_permission() { 62 | return array( 63 | 'test potx permission' => array( 64 | 'title' => t('Test potx permission'), 65 | 'description' => t('Test potx permission description'), 66 | ), 67 | 'one more test potx permission' => array( 68 | 'title' => t('One more test potx permission'), 69 | 'description' => t('One more test potx permission description'), 70 | ), 71 | ); 72 | } 73 | -------------------------------------------------------------------------------- /tests/potx_test_7.module: -------------------------------------------------------------------------------- 1 | 'Test menu item', 15 | 'description' => 'This is a test menu item', 16 | 'page callback' => 'potx_test_7_page', 17 | ); 18 | $items['translate/test-empty'] = array( 19 | 'title' => '', 20 | ); 21 | $items['translate/test-empty']['description'] = 'Test menu item description'; 22 | return $items; 23 | } 24 | 25 | /** 26 | * Implementation of hook_menu_alter() 27 | */ 28 | function potx_test_7_menu_alter(&$items) { 29 | $items['translate/test-empty']['description'] = 'Test menu item description altered (1)'; 30 | $items['translate/test-empty'] = array_merge( 31 | $items['translate/test-empty'], 32 | array( 33 | 'title' => 'Test menu item title altered', 34 | 'description' => 'Test menu item description altered (2)', 35 | ) 36 | ); 37 | } 38 | 39 | function potx_test_7_page() { 40 | t('This is a test string.'); 41 | format_plural($count, '1 test string', '@count test strings'); 42 | watchdog('test watchdog type', 'My watchdog message'); 43 | 44 | st('Installer only test string'); 45 | $t('Dynamic callback test string'); 46 | 47 | t('Test string in context', array(), array('context' => 'Test context')); 48 | format_plural($count, '1 test string in context', '@count test strings in context', array(), array('context' => 'Test context')); 49 | t(''); 50 | 51 | st('Installer string in context', array(), array('context' => 'Installer context')); 52 | $t('Dynamic string in context', array(), array('context' => 'Dynamic context')); 53 | } 54 | 55 | function potx_test_7_perm() { 56 | return array('test potx permission', 'one more test potx permission', ''); 57 | } 58 | 59 | function potx_test_7_permission() { 60 | return array( 61 | 'test potx permission' => array( 62 | 'title' => t('Test potx permission'), 63 | 'description' => t('Test potx permission description'), 64 | ), 65 | 'one more test potx permission' => array( 66 | 'title' => t('One more test potx permission'), 67 | 'description' => t('One more test potx permission description'), 68 | ), 69 | ); 70 | } 71 | -------------------------------------------------------------------------------- /tests/potx_test_8.breakpoints.yml: -------------------------------------------------------------------------------- 1 | potx_test_8.mobile: 2 | label: Mobile 3 | mediaQuery: '(min-width: 0px)' 4 | weight: 0 5 | potx_test_8.standard: 6 | label: Standard 7 | mediaQuery: '(min-width: 560px)' 8 | weight: 1 9 | multipliers: 10 | - 2x 11 | group: 'Some breakpoint group' 12 | -------------------------------------------------------------------------------- /tests/potx_test_8.info.yml: -------------------------------------------------------------------------------- 1 | name: Translation template extractor tester 2 | type: module 3 | description: 'Test description' 4 | package: Test package 5 | version: 8.x 6 | core: 8.x 7 | hidden: true 8 | dependencies: 9 | - potx 10 | -------------------------------------------------------------------------------- /tests/potx_test_8.links.action.yml: -------------------------------------------------------------------------------- 1 | test_translation_action: 2 | route_name: build_translation_test 3 | title: 'Local action translation test' 4 | appears_on: 5 | - build_translation_test 6 | test_translation_action_with_context: 7 | route_name: build_translation_test 8 | title: 'Local action translation with context test' 9 | title_context: 'Local action context' 10 | appears_on: 11 | - build_translation_test 12 | -------------------------------------------------------------------------------- /tests/potx_test_8.links.contextual.yml: -------------------------------------------------------------------------------- 1 | test_contextual_link: 2 | title: 'Test Contextual link' 3 | route_name: 'build_translation_test' 4 | group: 'potx_test_8' 5 | 6 | test_contextual_link_with_context: 7 | title: 'Test Contextual link with context' 8 | title_context: 'Contextual Context' 9 | route_name: 'build_translation_in_context' 10 | group: 'potx_test_8' 11 | -------------------------------------------------------------------------------- /tests/potx_test_8.links.menu.yml: -------------------------------------------------------------------------------- 1 | potx_test_8.admin_overview: 2 | title: 'Test menu link title' 3 | description: 'Test menu link description.' 4 | route_name: potx_test_8.admin_overview 5 | parent: system.admin_config_services 6 | weight: 10 7 | potx_test_8.page_last: 8 | title: 'Test menu link title with context' 9 | title_context: 'Menu item context' 10 | weight: 5 11 | route_name: potx_test_8.page_last 12 | -------------------------------------------------------------------------------- /tests/potx_test_8.links.task.yml: -------------------------------------------------------------------------------- 1 | potx_test_8.test_tab: 2 | route_name: build_translation_test 3 | title: 'Local task translation test' 4 | tab_root_id: potx_test_8.test_tab 5 | weight: 0 6 | potx_test_8.test_tab_with_context: 7 | route_name: build_translation_in_context 8 | title: 'Local task translation with context test' 9 | title_context: 'Local task context' 10 | tab_root_id: potx_test_8.test_tab 11 | weight: 0 12 | -------------------------------------------------------------------------------- /tests/potx_test_8.permissions.yml: -------------------------------------------------------------------------------- 1 | 'potx_test_8 permission a': 2 | title: 'Title potx_test_8_a' 3 | description: 'Description: potx_test_8_a' 4 | 5 | potx_test_8_permission_b: 'Title potx_test_8_b' 6 | 7 | permission_callbacks: 8 | - some_callback 9 | -------------------------------------------------------------------------------- /tests/potx_test_8.routing.yml: -------------------------------------------------------------------------------- 1 | build_translation_test: 2 | pattern: '/admin/config/build_translation_test' 3 | defaults: 4 | _content: '\Drupal\potx\Controller\TranslationController::buildTranslationTest' 5 | _title: 'Build translation test' 6 | requirements: 7 | _permission: 'none' 8 | 9 | build_alternative_translations: 10 | pattern: '/admin/config/build_alternative_translation' 11 | defaults: 12 | _content: '\Drupal\potx\Controller\TranslationController::buildAlternativeTranslation' 13 | _title: 'Build alternative translation' 14 | requirements: 15 | _permission: 'none' 16 | 17 | build_translation_in_context: 18 | pattern: '/admin/config/build_translation_in_context' 19 | defaults: 20 | _content: '\Drupal\potx\Controller\TranslationController::buildTranslationInContext' 21 | _title: 'Translation title in context' 22 | _title_context: 'Title context' 23 | requirements: 24 | _permission: 'none' 25 | -------------------------------------------------------------------------------- /tests/potx_test_8/potx_test_8.test.yml: -------------------------------------------------------------------------------- 1 | name: 'Test custom yaml translatable' 2 | test_data: 3 | test_key: 1 4 | test_label: 'Test custom yaml translatable with context' 5 | label_context: 'Yaml translatable context' 6 | -------------------------------------------------------------------------------- /tests/potx_test_8/yaml_translation_patterns.yml: -------------------------------------------------------------------------------- 1 | translation_patterns: 2 | - matches: 'potx_test_8.*.yml' 3 | translatable_keys: 4 | - name 5 | - key: test_label 6 | context: label_context 7 | 8 | -------------------------------------------------------------------------------- /tests/potx_test_yml/broken_yaml.yml: -------------------------------------------------------------------------------- 1 | --- 2 | test: "Broken Yaml" -------------------------------------------------------------------------------- /tests/potx_test_yml/potx_test_8.test2.yml: -------------------------------------------------------------------------------- 1 | name: 'Not translatable string' 2 | trans: 'Translatable string' 3 | test_data: 4 | test_field: 'Test custom yaml translatable field with context' 5 | field_context: 'Yaml translatable context' 6 | -------------------------------------------------------------------------------- /tests/potx_test_yml/test_folder/potx_test_8.test3.yml: -------------------------------------------------------------------------------- 1 | trans: 'Translatable string inside directory' 2 | -------------------------------------------------------------------------------- /tests/potx_test_yml/yaml_translation_patterns.yml: -------------------------------------------------------------------------------- 1 | translation_patterns: 2 | - matches: 'potx_test_8.*.yml' 3 | translatable_keys: 4 | - trans 5 | - key: test_field 6 | context: field_context 7 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | CHANGELOG 2 | ========= 3 | 4 | 2.1.0 5 | ----- 6 | 7 | * Yaml::parse() does not evaluate loaded files as PHP files by default 8 | anymore (call Yaml::enablePhpParsing() to get back the old behavior) 9 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Exception/DumpException.php: -------------------------------------------------------------------------------- 1 | 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 | namespace Symfony\Component\Yaml\Exception; 13 | 14 | /** 15 | * Exception class thrown when an error occurs during dumping. 16 | * 17 | * @author Fabien Potencier 18 | * 19 | * @api 20 | */ 21 | class DumpException extends RuntimeException 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 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 | namespace Symfony\Component\Yaml\Exception; 13 | 14 | /** 15 | * Exception interface for all exceptions thrown by the component. 16 | * 17 | * @author Fabien Potencier 18 | * 19 | * @api 20 | */ 21 | interface ExceptionInterface 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Exception/RuntimeException.php: -------------------------------------------------------------------------------- 1 | 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 | namespace Symfony\Component\Yaml\Exception; 13 | 14 | /** 15 | * Exception class thrown when an error occurs during parsing. 16 | * 17 | * @author Romain Neutron 18 | * 19 | * @api 20 | */ 21 | class RuntimeException extends \RuntimeException implements ExceptionInterface 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2013 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/README.md: -------------------------------------------------------------------------------- 1 | Yaml Component 2 | ============== 3 | 4 | YAML implements most of the YAML 1.2 specification. 5 | 6 | use Symfony\Component\Yaml\Yaml; 7 | 8 | $array = Yaml::parse($file); 9 | 10 | print Yaml::dump($array); 11 | 12 | Resources 13 | --------- 14 | 15 | You can run the unit tests with the following command: 16 | 17 | $ cd path/to/Symfony/Component/Yaml/ 18 | $ composer.phar install --dev 19 | $ phpunit 20 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Simple Alias Example 3 | brief: > 4 | If you need to refer to the same item of data twice, 5 | you can give that item an alias. The alias is a plain 6 | string, starting with an ampersand. The item may then 7 | be referred to by the alias throughout your document 8 | by using an asterisk before the name of the alias. 9 | This is called an anchor. 10 | yaml: | 11 | - &showell Steve 12 | - Clark 13 | - Brian 14 | - Oren 15 | - *showell 16 | php: | 17 | array('Steve', 'Clark', 'Brian', 'Oren', 'Steve') 18 | 19 | --- 20 | test: Alias of a Mapping 21 | brief: > 22 | An alias can be used on any item of data, including 23 | sequences, mappings, and other complex data types. 24 | yaml: | 25 | - &hello 26 | Meat: pork 27 | Starch: potato 28 | - banana 29 | - *hello 30 | php: | 31 | array(array('Meat'=>'pork', 'Starch'=>'potato'), 'banana', array('Meat'=>'pork', 'Starch'=>'potato')) 32 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml: -------------------------------------------------------------------------------- 1 | --- 2 | test: One Element Mapping 3 | brief: | 4 | A mapping with one key/value pair 5 | yaml: | 6 | foo: bar 7 | php: | 8 | array('foo' => 'bar') 9 | --- 10 | test: Multi Element Mapping 11 | brief: | 12 | More than one key/value pair 13 | yaml: | 14 | red: baron 15 | white: walls 16 | blue: berries 17 | php: | 18 | array( 19 | 'red' => 'baron', 20 | 'white' => 'walls', 21 | 'blue' => 'berries', 22 | ) 23 | --- 24 | test: Values aligned 25 | brief: | 26 | Often times human editors of documents will align the values even 27 | though YAML emitters generally don't. 28 | yaml: | 29 | red: baron 30 | white: walls 31 | blue: berries 32 | php: | 33 | array( 34 | 'red' => 'baron', 35 | 'white' => 'walls', 36 | 'blue' => 'berries', 37 | ) 38 | --- 39 | test: Colons aligned 40 | brief: | 41 | Spaces can come before the ': ' key/value separator. 42 | yaml: | 43 | red : baron 44 | white : walls 45 | blue : berries 46 | php: | 47 | array( 48 | 'red' => 'baron', 49 | 'white' => 'walls', 50 | 'blue' => 'berries', 51 | ) 52 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Trailing Document Separator 3 | todo: true 4 | brief: > 5 | You can separate YAML documents 6 | with a string of three dashes. 7 | yaml: | 8 | - foo: 1 9 | bar: 2 10 | --- 11 | more: stuff 12 | python: | 13 | [ 14 | [ { 'foo': 1, 'bar': 2 } ], 15 | { 'more': 'stuff' } 16 | ] 17 | ruby: | 18 | [ { 'foo' => 1, 'bar' => 2 } ] 19 | 20 | --- 21 | test: Leading Document Separator 22 | todo: true 23 | brief: > 24 | You can explicity give an opening 25 | document separator to your YAML stream. 26 | yaml: | 27 | --- 28 | - foo: 1 29 | bar: 2 30 | --- 31 | more: stuff 32 | python: | 33 | [ 34 | [ {'foo': 1, 'bar': 2}], 35 | {'more': 'stuff'} 36 | ] 37 | ruby: | 38 | [ { 'foo' => 1, 'bar' => 2 } ] 39 | 40 | --- 41 | test: YAML Header 42 | todo: true 43 | brief: > 44 | The opening separator can contain directives 45 | to the YAML parser, such as the version 46 | number. 47 | yaml: | 48 | --- %YAML:1.0 49 | foo: 1 50 | bar: 2 51 | php: | 52 | array('foo' => 1, 'bar' => 2) 53 | documents: 1 54 | 55 | --- 56 | test: Red Herring Document Separator 57 | brief: > 58 | Separators included in blocks or strings 59 | are treated as blocks or strings, as the 60 | document separator should have no indentation 61 | preceding it. 62 | yaml: | 63 | foo: | 64 | --- 65 | php: | 66 | array('foo' => "---\n") 67 | 68 | --- 69 | test: Multiple Document Separators in Block 70 | brief: > 71 | This technique allows you to embed other YAML 72 | documents within literal blocks. 73 | yaml: | 74 | foo: | 75 | --- 76 | foo: bar 77 | --- 78 | yo: baz 79 | bar: | 80 | fooness 81 | php: | 82 | array( 83 | 'foo' => "---\nfoo: bar\n---\nyo: baz\n", 84 | 'bar' => "fooness\n" 85 | ) 86 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml: -------------------------------------------------------------------------------- 1 | --- 2 | test: Missing value for hash item 3 | todo: true 4 | brief: | 5 | Third item in this hash doesn't have a value 6 | yaml: | 7 | okay: value 8 | also okay: ~ 9 | causes error because no value specified 10 | last key: value okay here too 11 | python-error: causes error because no value specified 12 | 13 | --- 14 | test: Not indenting enough 15 | brief: | 16 | There was a bug in PyYaml where it was off by one 17 | in the indentation check. It was allowing the YAML 18 | below. 19 | # This is actually valid YAML now. Someone should tell showell. 20 | yaml: | 21 | foo: 22 | firstline: 1 23 | secondline: 2 24 | php: | 25 | array('foo' => null, 'firstline' => 1, 'secondline' => 2) 26 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml: -------------------------------------------------------------------------------- 1 | --- 2 | test: Simple Inline Array 3 | brief: > 4 | Sequences can be contained on a 5 | single line, using the inline syntax. 6 | Separate each entry with commas and 7 | enclose in square brackets. 8 | yaml: | 9 | seq: [ a, b, c ] 10 | php: | 11 | array('seq' => array('a', 'b', 'c')) 12 | --- 13 | test: Simple Inline Hash 14 | brief: > 15 | Mapping can also be contained on 16 | a single line, using the inline 17 | syntax. Each key-value pair is 18 | separated by a colon, with a comma 19 | between each entry in the mapping. 20 | Enclose with curly braces. 21 | yaml: | 22 | hash: { name: Steve, foo: bar } 23 | php: | 24 | array('hash' => array('name' => 'Steve', 'foo' => 'bar')) 25 | --- 26 | test: Multi-line Inline Collections 27 | todo: true 28 | brief: > 29 | Both inline sequences and inline mappings 30 | can span multiple lines, provided that you 31 | indent the additional lines. 32 | yaml: | 33 | languages: [ Ruby, 34 | Perl, 35 | Python ] 36 | websites: { YAML: yaml.org, 37 | Ruby: ruby-lang.org, 38 | Python: python.org, 39 | Perl: use.perl.org } 40 | php: | 41 | array( 42 | 'languages' => array('Ruby', 'Perl', 'Python'), 43 | 'websites' => array( 44 | 'YAML' => 'yaml.org', 45 | 'Ruby' => 'ruby-lang.org', 46 | 'Python' => 'python.org', 47 | 'Perl' => 'use.perl.org' 48 | ) 49 | ) 50 | --- 51 | test: Commas in Values (not in the spec!) 52 | todo: true 53 | brief: > 54 | List items in collections are delimited by commas, but 55 | there must be a space after each comma. This allows you 56 | to add numbers without quoting. 57 | yaml: | 58 | attendances: [ 45,123, 70,000, 17,222 ] 59 | php: | 60 | array('attendances' => array(45123, 70000, 17222)) 61 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Empty Sequence 3 | brief: > 4 | You can represent the empty sequence 5 | with an empty inline sequence. 6 | yaml: | 7 | empty: [] 8 | php: | 9 | array('empty' => array()) 10 | --- 11 | test: Empty Mapping 12 | brief: > 13 | You can represent the empty mapping 14 | with an empty inline mapping. 15 | yaml: | 16 | empty: {} 17 | php: | 18 | array('empty' => array()) 19 | --- 20 | test: Empty Sequence as Entire Document 21 | yaml: | 22 | [] 23 | php: | 24 | array() 25 | --- 26 | test: Empty Mapping as Entire Document 27 | yaml: | 28 | {} 29 | php: | 30 | array() 31 | --- 32 | test: Null as Document 33 | yaml: | 34 | ~ 35 | php: | 36 | null 37 | --- 38 | test: Empty String 39 | brief: > 40 | You can represent an empty string 41 | with a pair of quotes. 42 | yaml: | 43 | '' 44 | php: | 45 | '' 46 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml: -------------------------------------------------------------------------------- 1 | value: 2 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/index.yml: -------------------------------------------------------------------------------- 1 | - escapedCharacters 2 | - sfComments 3 | - sfCompact 4 | - sfTests 5 | - sfObjects 6 | - sfMergeKey 7 | - sfQuotes 8 | - YtsAnchorAlias 9 | - YtsBasicTests 10 | - YtsBlockMapping 11 | - YtsDocumentSeparator 12 | - YtsErrorTests 13 | - YtsFlowCollections 14 | - YtsFoldedScalars 15 | - YtsNullsAndEmpties 16 | - YtsSpecificationExamples 17 | - YtsTypeTransfers 18 | - unindentedCollections 19 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Comments at the end of a line 3 | brief: > 4 | Comments at the end of a line 5 | yaml: | 6 | ex1: "foo # bar" 7 | ex2: "foo # bar" # comment 8 | ex3: 'foo # bar' # comment 9 | ex4: foo # comment 10 | php: | 11 | array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo') 12 | --- 13 | test: Comments in the middle 14 | brief: > 15 | Comments in the middle 16 | yaml: | 17 | foo: 18 | # some comment 19 | # some comment 20 | bar: foo 21 | # some comment 22 | # some comment 23 | php: | 24 | array('foo' => array('bar' => 'foo')) 25 | --- 26 | test: Comments on a hash line 27 | brief: > 28 | Comments on a hash line 29 | yaml: | 30 | foo: # a comment 31 | foo: bar # a comment 32 | php: | 33 | array('foo' => array('foo' => 'bar')) 34 | --- 35 | test: 'Value starting with a #' 36 | brief: > 37 | 'Value starting with a #' 38 | yaml: | 39 | foo: '#bar' 40 | php: | 41 | array('foo' => '#bar') 42 | --- 43 | test: Document starting with a comment and a separator 44 | brief: > 45 | Commenting before document start is allowed 46 | yaml: | 47 | # document comment 48 | --- 49 | foo: bar # a comment 50 | php: | 51 | array('foo' => 'bar') 52 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Simple In Place Substitution 3 | brief: > 4 | If you want to reuse an entire alias, only overwriting what is different 5 | you can use a << in place substitution. This is not part of the official 6 | YAML spec, but a widely implemented extension. See the following URL for 7 | details: http://yaml.org/type/merge.html 8 | yaml: | 9 | foo: &foo 10 | a: Steve 11 | b: Clark 12 | c: Brian 13 | bar: &bar 14 | <<: *foo 15 | x: Oren 16 | foo2: &foo2 17 | a: Ballmer 18 | ding: &dong [ fi, fei, fo, fam] 19 | check: 20 | <<: 21 | - *foo 22 | - *dong 23 | isit: tested 24 | head: 25 | <<: [ *foo , *dong , *foo2 ] 26 | php: | 27 | array('foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'), 'bar' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'x' => 'Oren'), 'foo2' => array('a' => 'Ballmer'), 'ding' => array('fi', 'fei', 'fo', 'fam'), 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'), 'head' => array('a' => 'Ballmer', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam')) 28 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Objects 3 | brief: > 4 | Comments at the end of a line 5 | yaml: | 6 | ex1: "foo # bar" 7 | ex2: "foo # bar" # comment 8 | ex3: 'foo # bar' # comment 9 | ex4: foo # comment 10 | php: | 11 | array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo') 12 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Some characters at the beginning of a string must be escaped 3 | brief: > 4 | Some characters at the beginning of a string must be escaped 5 | yaml: | 6 | foo: | bar 7 | php: | 8 | array('foo' => '| bar') 9 | --- 10 | test: A key can be a quoted string 11 | brief: > 12 | A key can be a quoted string 13 | yaml: | 14 | "foo1": bar 15 | 'foo2': bar 16 | "foo \" bar": bar 17 | 'foo '' bar': bar 18 | 'foo3: ': bar 19 | "foo4: ": bar 20 | foo5: { "foo \" bar: ": bar, 'foo '' bar: ': bar } 21 | php: | 22 | array( 23 | 'foo1' => 'bar', 24 | 'foo2' => 'bar', 25 | 'foo " bar' => 'bar', 26 | 'foo \' bar' => 'bar', 27 | 'foo3: ' => 'bar', 28 | 'foo4: ' => 'bar', 29 | 'foo5' => array( 30 | 'foo " bar: ' => 'bar', 31 | 'foo \' bar: ' => 'bar', 32 | ), 33 | ) 34 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml: -------------------------------------------------------------------------------- 1 | --- %YAML:1.0 2 | test: Unindented collection 3 | brief: > 4 | Unindented collection 5 | yaml: | 6 | collection: 7 | - item1 8 | - item2 9 | - item3 10 | php: | 11 | array('collection' => array('item1', 'item2', 'item3')) 12 | --- 13 | test: Nested unindented collection (two levels) 14 | brief: > 15 | Nested unindented collection 16 | yaml: | 17 | collection: 18 | key: 19 | - a 20 | - b 21 | - c 22 | php: | 23 | array('collection' => array('key' => array('a', 'b', 'c'))) 24 | --- 25 | test: Nested unindented collection (three levels) 26 | brief: > 27 | Nested unindented collection 28 | yaml: | 29 | collection: 30 | key: 31 | subkey: 32 | - one 33 | - two 34 | - three 35 | php: | 36 | array('collection' => array('key' => array('subkey' => array('one', 'two', 'three')))) 37 | --- 38 | test: Key/value after unindented collection (1) 39 | brief: > 40 | Key/value after unindented collection (1) 41 | yaml: | 42 | collection: 43 | key: 44 | - a 45 | - b 46 | - c 47 | foo: bar 48 | php: | 49 | array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar') 50 | --- 51 | test: Key/value after unindented collection (at the same level) 52 | brief: > 53 | Key/value after unindented collection 54 | yaml: | 55 | collection: 56 | key: 57 | - a 58 | - b 59 | - c 60 | foo: bar 61 | php: | 62 | array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar')) 63 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/Tests/YamlTest.php: -------------------------------------------------------------------------------- 1 | 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 | namespace Symfony\Component\Yaml\Tests; 13 | 14 | use Symfony\Component\Yaml\Yaml; 15 | 16 | class YamlTest extends \PHPUnit_Framework_TestCase 17 | { 18 | public function testParseAndDump() 19 | { 20 | $data = array('lorem' => 'ipsum', 'dolor' => 'sit'); 21 | $yml = Yaml::dump($data); 22 | $parsed = Yaml::parse($yml); 23 | $this->assertEquals($data, $parsed); 24 | 25 | $filename = __DIR__.'/Fixtures/index.yml'; 26 | $contents = file_get_contents($filename); 27 | $parsedByFilename = Yaml::parse($filename); 28 | $parsedByContents = Yaml::parse($contents); 29 | $this->assertEquals($parsedByFilename, $parsedByContents); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/yaml", 3 | "type": "library", 4 | "description": "Symfony Yaml Component", 5 | "keywords": [], 6 | "homepage": "http://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Fabien Potencier", 11 | "email": "fabien@symfony.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "http://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.3" 20 | }, 21 | "autoload": { 22 | "psr-0": { "Symfony\\Component\\Yaml\\": "" } 23 | }, 24 | "target-dir": "Symfony/Component/Yaml", 25 | "minimum-stability": "dev", 26 | "extra": { 27 | "branch-alias": { 28 | "dev-master": "2.3-dev" 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Yaml/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | ./Tests/ 17 | 18 | 19 | 20 | 21 | 22 | ./ 23 | 24 | ./vendor 25 | ./Tests 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /vendor/Twig/Autoloader.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated Use Composer instead. Will be removed in Twig 2.0. 20 | */ 21 | class Twig_Autoloader 22 | { 23 | /** 24 | * Registers Twig_Autoloader as an SPL autoloader. 25 | * 26 | * @param bool $prepend Whether to prepend the autoloader or not. 27 | */ 28 | public static function register($prepend = false) 29 | { 30 | @trigger_error('Using Twig_Autoloader is deprecated. Use Composer instead.', E_USER_DEPRECATED); 31 | 32 | if (PHP_VERSION_ID < 50300) { 33 | spl_autoload_register(array(__CLASS__, 'autoload')); 34 | } else { 35 | spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); 36 | } 37 | } 38 | 39 | /** 40 | * Handles autoloading of classes. 41 | * 42 | * @param string $class A class name. 43 | */ 44 | public static function autoload($class) 45 | { 46 | if (0 !== strpos($class, 'Twig')) { 47 | return; 48 | } 49 | 50 | if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { 51 | require $file; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/Twig/BaseNodeVisitor.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | abstract class Twig_BaseNodeVisitor implements Twig_NodeVisitorInterface 18 | { 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | final public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) 23 | { 24 | if (!$node instanceof Twig_Node) { 25 | throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); 26 | } 27 | 28 | return $this->doEnterNode($node, $env); 29 | } 30 | 31 | /** 32 | * {@inheritdoc} 33 | */ 34 | final public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) 35 | { 36 | if (!$node instanceof Twig_Node) { 37 | throw new LogicException('Twig_BaseNodeVisitor only supports Twig_Node instances.'); 38 | } 39 | 40 | return $this->doLeaveNode($node, $env); 41 | } 42 | 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); 52 | 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); 62 | } 63 | -------------------------------------------------------------------------------- /vendor/Twig/Cache/Null.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Cache_Null implements Twig_CacheInterface 18 | { 19 | /** 20 | * {@inheritdoc} 21 | */ 22 | public function generateKey($name, $className) 23 | { 24 | return ''; 25 | } 26 | 27 | /** 28 | * {@inheritdoc} 29 | */ 30 | public function write($key, $content) 31 | { 32 | } 33 | 34 | /** 35 | * {@inheritdoc} 36 | */ 37 | public function load($key) 38 | { 39 | } 40 | 41 | /** 42 | * {@inheritdoc} 43 | */ 44 | public function getTimestamp($key) 45 | { 46 | return 0; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /vendor/Twig/CacheInterface.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | interface Twig_CacheInterface 22 | { 23 | /** 24 | * Generates a cache key for the given template class name. 25 | * 26 | * @param string $name The template name 27 | * @param string $className The template class name 28 | * 29 | * @return string 30 | */ 31 | public function generateKey($name, $className); 32 | 33 | /** 34 | * Writes the compiled template to cache. 35 | * 36 | * @param string $key The cache key 37 | * @param string $content The template representation as a PHP class 38 | */ 39 | public function write($key, $content); 40 | 41 | /** 42 | * Loads a template from the cache. 43 | * 44 | * @param string $key The cache key 45 | */ 46 | public function load($key); 47 | 48 | /** 49 | * Returns the modification timestamp of a key. 50 | * 51 | * @param string $key The cache key 52 | * 53 | * @return int 54 | */ 55 | public function getTimestamp($key); 56 | } 57 | -------------------------------------------------------------------------------- /vendor/Twig/CompilerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_CompilerInterface 20 | { 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 | 30 | /** 31 | * Gets the current PHP code after compilation. 32 | * 33 | * @return string The PHP code 34 | */ 35 | public function getSource(); 36 | } 37 | -------------------------------------------------------------------------------- /vendor/Twig/Error/Loader.php: -------------------------------------------------------------------------------- 1 | 24 | */ 25 | class Twig_Error_Loader extends Twig_Error 26 | { 27 | public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) 28 | { 29 | parent::__construct($message, false, false, $previous); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Error/Runtime.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Runtime extends Twig_Error 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /vendor/Twig/Error/Syntax.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Error_Syntax extends Twig_Error 19 | { 20 | /** 21 | * Tweaks the error message to include suggestions. 22 | * 23 | * @param string $name The original name of the item that does not exist 24 | * @param array $items An array of possible items 25 | */ 26 | public function addSuggestions($name, array $items) 27 | { 28 | if (!$alternatives = self::computeAlternatives($name, $items)) { 29 | return; 30 | } 31 | 32 | $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives))); 33 | } 34 | 35 | /** 36 | * @internal 37 | * 38 | * To be merged with the addSuggestions() method in 2.0. 39 | */ 40 | public static function computeAlternatives($name, $items) 41 | { 42 | $alternatives = array(); 43 | foreach ($items as $item) { 44 | $lev = levenshtein($name, $item); 45 | if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { 46 | $alternatives[$item] = $lev; 47 | } 48 | } 49 | asort($alternatives); 50 | 51 | return array_keys($alternatives); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /vendor/Twig/ExistsLoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_ExistsLoaderInterface 20 | { 21 | /** 22 | * Check if we have the source code of a template, given its name. 23 | * 24 | * @param string $name The name of the template to check if we can load 25 | * 26 | * @return bool If the template source code is handled by this loader or not 27 | */ 28 | public function exists($name); 29 | } 30 | -------------------------------------------------------------------------------- /vendor/Twig/Extension.php: -------------------------------------------------------------------------------- 1 | $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), 27 | ); 28 | } 29 | 30 | public function getName() 31 | { 32 | return 'debug'; 33 | } 34 | } 35 | 36 | function twig_var_dump(Twig_Environment $env, $context) 37 | { 38 | if (!$env->isDebug()) { 39 | return; 40 | } 41 | 42 | ob_start(); 43 | 44 | $count = func_num_args(); 45 | if (2 === $count) { 46 | $vars = array(); 47 | foreach ($context as $key => $value) { 48 | if (!$value instanceof Twig_Template) { 49 | $vars[$key] = $value; 50 | } 51 | } 52 | 53 | var_dump($vars); 54 | } else { 55 | for ($i = 2; $i < $count; ++$i) { 56 | var_dump(func_get_arg($i)); 57 | } 58 | } 59 | 60 | return ob_get_clean(); 61 | } 62 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/GlobalsInterface.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | interface Twig_Extension_GlobalsInterface 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/InitRuntimeInterface.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | interface Twig_Extension_InitRuntimeInterface 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/Optimizer.php: -------------------------------------------------------------------------------- 1 | optimizers = $optimizers; 18 | } 19 | 20 | public function getNodeVisitors() 21 | { 22 | return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); 23 | } 24 | 25 | public function getName() 26 | { 27 | return 'optimizer'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/Profiler.php: -------------------------------------------------------------------------------- 1 | actives[] = $profile; 19 | } 20 | 21 | public function enter(Twig_Profiler_Profile $profile) 22 | { 23 | $this->actives[0]->addProfile($profile); 24 | array_unshift($this->actives, $profile); 25 | } 26 | 27 | public function leave(Twig_Profiler_Profile $profile) 28 | { 29 | $profile->leave(); 30 | array_shift($this->actives); 31 | 32 | if (1 === count($this->actives)) { 33 | $this->actives[0]->leave(); 34 | } 35 | } 36 | 37 | public function getNodeVisitors() 38 | { 39 | return array(new Twig_Profiler_NodeVisitor_Profiler($this->getName())); 40 | } 41 | 42 | public function getName() 43 | { 44 | return 'profiler'; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/Sandbox.php: -------------------------------------------------------------------------------- 1 | policy = $policy; 20 | $this->sandboxedGlobally = $sandboxed; 21 | } 22 | 23 | public function getTokenParsers() 24 | { 25 | return array(new Twig_TokenParser_Sandbox()); 26 | } 27 | 28 | public function getNodeVisitors() 29 | { 30 | return array(new Twig_NodeVisitor_Sandbox()); 31 | } 32 | 33 | public function enableSandbox() 34 | { 35 | $this->sandboxed = true; 36 | } 37 | 38 | public function disableSandbox() 39 | { 40 | $this->sandboxed = false; 41 | } 42 | 43 | public function isSandboxed() 44 | { 45 | return $this->sandboxedGlobally || $this->sandboxed; 46 | } 47 | 48 | public function isSandboxedGlobally() 49 | { 50 | return $this->sandboxedGlobally; 51 | } 52 | 53 | public function setSecurityPolicy(Twig_Sandbox_SecurityPolicyInterface $policy) 54 | { 55 | $this->policy = $policy; 56 | } 57 | 58 | public function getSecurityPolicy() 59 | { 60 | return $this->policy; 61 | } 62 | 63 | public function checkSecurity($tags, $filters, $functions) 64 | { 65 | if ($this->isSandboxed()) { 66 | $this->policy->checkSecurity($tags, $filters, $functions); 67 | } 68 | } 69 | 70 | public function checkMethodAllowed($obj, $method) 71 | { 72 | if ($this->isSandboxed()) { 73 | $this->policy->checkMethodAllowed($obj, $method); 74 | } 75 | } 76 | 77 | public function checkPropertyAllowed($obj, $method) 78 | { 79 | if ($this->isSandboxed()) { 80 | $this->policy->checkPropertyAllowed($obj, $method); 81 | } 82 | } 83 | 84 | public function ensureToStringAllowed($obj) 85 | { 86 | if ($this->isSandboxed() && is_object($obj)) { 87 | $this->policy->checkMethodAllowed($obj, '__toString'); 88 | } 89 | 90 | return $obj; 91 | } 92 | 93 | public function getName() 94 | { 95 | return 'sandbox'; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/Staging.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @internal 20 | */ 21 | class Twig_Extension_Staging extends Twig_Extension 22 | { 23 | protected $functions = array(); 24 | protected $filters = array(); 25 | protected $visitors = array(); 26 | protected $tokenParsers = array(); 27 | protected $globals = array(); 28 | protected $tests = array(); 29 | 30 | public function addFunction($name, $function) 31 | { 32 | $this->functions[$name] = $function; 33 | } 34 | 35 | public function getFunctions() 36 | { 37 | return $this->functions; 38 | } 39 | 40 | public function addFilter($name, $filter) 41 | { 42 | $this->filters[$name] = $filter; 43 | } 44 | 45 | public function getFilters() 46 | { 47 | return $this->filters; 48 | } 49 | 50 | public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) 51 | { 52 | $this->visitors[] = $visitor; 53 | } 54 | 55 | public function getNodeVisitors() 56 | { 57 | return $this->visitors; 58 | } 59 | 60 | public function addTokenParser(Twig_TokenParserInterface $parser) 61 | { 62 | $this->tokenParsers[] = $parser; 63 | } 64 | 65 | public function getTokenParsers() 66 | { 67 | return $this->tokenParsers; 68 | } 69 | 70 | public function addGlobal($name, $value) 71 | { 72 | $this->globals[$name] = $value; 73 | } 74 | 75 | public function getGlobals() 76 | { 77 | return $this->globals; 78 | } 79 | 80 | public function addTest($name, $test) 81 | { 82 | $this->tests[$name] = $test; 83 | } 84 | 85 | public function getTests() 86 | { 87 | return $this->tests; 88 | } 89 | 90 | public function getName() 91 | { 92 | return 'staging'; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /vendor/Twig/Extension/StringLoader.php: -------------------------------------------------------------------------------- 1 | true)), 17 | ); 18 | } 19 | 20 | public function getName() 21 | { 22 | return 'string_loader'; 23 | } 24 | } 25 | 26 | /** 27 | * Loads a template from a string. 28 | * 29 | *
30 |  * {{ include(template_from_string("Hello {{ name }}")) }}
31 |  * 
32 | * 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 | { 40 | return $env->createTemplate((string) $template); 41 | } 42 | -------------------------------------------------------------------------------- /vendor/Twig/FileExtensionEscapingStrategy.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Twig_FileExtensionEscapingStrategy 24 | { 25 | /** 26 | * Guesses the best autoescaping strategy based on the file name. 27 | * 28 | * @param string $filename The template file name 29 | * 30 | * @return string|false The escaping strategy name to use or false to disable 31 | */ 32 | public static function guess($filename) 33 | { 34 | if (in_array(substr($filename, -1), array('/', '\\'))) { 35 | return 'html'; // return html for directories 36 | } 37 | 38 | if ('.twig' === substr($filename, -5)) { 39 | $filename = substr($filename, 0, -5); 40 | } 41 | 42 | $extension = pathinfo($filename, PATHINFO_EXTENSION); 43 | 44 | switch ($extension) { 45 | case 'js': 46 | return 'js'; 47 | 48 | case 'css': 49 | return 'css'; 50 | 51 | case 'txt': 52 | return false; 53 | 54 | default: 55 | return 'html'; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /vendor/Twig/Filter.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface 24 | { 25 | protected $options; 26 | protected $arguments = array(); 27 | 28 | public function __construct(array $options = array()) 29 | { 30 | $this->options = array_merge(array( 31 | 'needs_environment' => false, 32 | 'needs_context' => false, 33 | 'pre_escape' => null, 34 | 'preserves_safety' => null, 35 | 'callable' => null, 36 | ), $options); 37 | } 38 | 39 | public function setArguments($arguments) 40 | { 41 | $this->arguments = $arguments; 42 | } 43 | 44 | public function getArguments() 45 | { 46 | return $this->arguments; 47 | } 48 | 49 | public function needsEnvironment() 50 | { 51 | return $this->options['needs_environment']; 52 | } 53 | 54 | public function needsContext() 55 | { 56 | return $this->options['needs_context']; 57 | } 58 | 59 | public function getSafe(Twig_Node $filterArgs) 60 | { 61 | if (isset($this->options['is_safe'])) { 62 | return $this->options['is_safe']; 63 | } 64 | 65 | if (isset($this->options['is_safe_callback'])) { 66 | return call_user_func($this->options['is_safe_callback'], $filterArgs); 67 | } 68 | } 69 | 70 | public function getPreservesSafety() 71 | { 72 | return $this->options['preserves_safety']; 73 | } 74 | 75 | public function getPreEscape() 76 | { 77 | return $this->options['pre_escape']; 78 | } 79 | 80 | public function getCallable() 81 | { 82 | return $this->options['callable']; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /vendor/Twig/Filter/Function.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | class Twig_Filter_Function extends Twig_Filter 24 | { 25 | protected $function; 26 | 27 | public function __construct($function, array $options = array()) 28 | { 29 | $options['callable'] = $function; 30 | 31 | parent::__construct($options); 32 | 33 | $this->function = $function; 34 | } 35 | 36 | public function compile() 37 | { 38 | return $this->function; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/Filter/Method.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | class Twig_Filter_Method extends Twig_Filter 24 | { 25 | protected $extension; 26 | protected $method; 27 | 28 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 29 | { 30 | $options['callable'] = array($extension, $method); 31 | 32 | parent::__construct($options); 33 | 34 | $this->extension = $extension; 35 | $this->method = $method; 36 | } 37 | 38 | public function compile() 39 | { 40 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/Filter/Node.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | class Twig_Filter_Node extends Twig_Filter 24 | { 25 | protected $class; 26 | 27 | public function __construct($class, array $options = array()) 28 | { 29 | parent::__construct($options); 30 | 31 | $this->class = $class; 32 | } 33 | 34 | public function getClass() 35 | { 36 | return $this->class; 37 | } 38 | 39 | public function compile() 40 | { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/FilterCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_FilterCallableInterface 22 | { 23 | public function getCallable(); 24 | } 25 | -------------------------------------------------------------------------------- /vendor/Twig/FilterInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_FilterInterface 22 | { 23 | /** 24 | * Compiles a filter. 25 | * 26 | * @return string The PHP code for the filter 27 | */ 28 | public function compile(); 29 | 30 | public function needsEnvironment(); 31 | 32 | public function needsContext(); 33 | 34 | public function getSafe(Twig_Node $filterArgs); 35 | 36 | public function getPreservesSafety(); 37 | 38 | public function getPreEscape(); 39 | 40 | public function setArguments($arguments); 41 | 42 | public function getArguments(); 43 | } 44 | -------------------------------------------------------------------------------- /vendor/Twig/Function.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface 24 | { 25 | protected $options; 26 | protected $arguments = array(); 27 | 28 | public function __construct(array $options = array()) 29 | { 30 | $this->options = array_merge(array( 31 | 'needs_environment' => false, 32 | 'needs_context' => false, 33 | 'callable' => null, 34 | ), $options); 35 | } 36 | 37 | public function setArguments($arguments) 38 | { 39 | $this->arguments = $arguments; 40 | } 41 | 42 | public function getArguments() 43 | { 44 | return $this->arguments; 45 | } 46 | 47 | public function needsEnvironment() 48 | { 49 | return $this->options['needs_environment']; 50 | } 51 | 52 | public function needsContext() 53 | { 54 | return $this->options['needs_context']; 55 | } 56 | 57 | public function getSafe(Twig_Node $functionArgs) 58 | { 59 | if (isset($this->options['is_safe'])) { 60 | return $this->options['is_safe']; 61 | } 62 | 63 | if (isset($this->options['is_safe_callback'])) { 64 | return call_user_func($this->options['is_safe_callback'], $functionArgs); 65 | } 66 | 67 | return array(); 68 | } 69 | 70 | public function getCallable() 71 | { 72 | return $this->options['callable']; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /vendor/Twig/Function/Function.php: -------------------------------------------------------------------------------- 1 | 21 | * 22 | * @deprecated since 1.12 (to be removed in 2.0) 23 | */ 24 | class Twig_Function_Function extends Twig_Function 25 | { 26 | protected $function; 27 | 28 | public function __construct($function, array $options = array()) 29 | { 30 | $options['callable'] = $function; 31 | 32 | parent::__construct($options); 33 | 34 | $this->function = $function; 35 | } 36 | 37 | public function compile() 38 | { 39 | return $this->function; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/Twig/Function/Method.php: -------------------------------------------------------------------------------- 1 | 21 | * 22 | * @deprecated since 1.12 (to be removed in 2.0) 23 | */ 24 | class Twig_Function_Method extends Twig_Function 25 | { 26 | protected $extension; 27 | protected $method; 28 | 29 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 30 | { 31 | $options['callable'] = array($extension, $method); 32 | 33 | parent::__construct($options); 34 | 35 | $this->extension = $extension; 36 | $this->method = $method; 37 | } 38 | 39 | public function compile() 40 | { 41 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/Twig/Function/Node.php: -------------------------------------------------------------------------------- 1 | 20 | * 21 | * @deprecated since 1.12 (to be removed in 2.0) 22 | */ 23 | class Twig_Function_Node extends Twig_Function 24 | { 25 | protected $class; 26 | 27 | public function __construct($class, array $options = array()) 28 | { 29 | parent::__construct($options); 30 | 31 | $this->class = $class; 32 | } 33 | 34 | public function getClass() 35 | { 36 | return $this->class; 37 | } 38 | 39 | public function compile() 40 | { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/FunctionCallableInterface.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | interface Twig_FunctionCallableInterface 22 | { 23 | public function getCallable(); 24 | } 25 | -------------------------------------------------------------------------------- /vendor/Twig/FunctionInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * 20 | * @deprecated since 1.12 (to be removed in 2.0) 21 | */ 22 | interface Twig_FunctionInterface 23 | { 24 | /** 25 | * Compiles a function. 26 | * 27 | * @return string The PHP code for the function 28 | */ 29 | public function compile(); 30 | 31 | public function needsEnvironment(); 32 | 33 | public function needsContext(); 34 | 35 | public function getSafe(Twig_Node $filterArgs); 36 | 37 | public function setArguments($arguments); 38 | 39 | public function getArguments(); 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/LexerInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_LexerInterface 20 | { 21 | /** 22 | * Tokenizes a source code. 23 | * 24 | * @param string $code The source code 25 | * @param string $filename 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 | */ 31 | public function tokenize($code, $filename = null); 32 | } 33 | -------------------------------------------------------------------------------- /vendor/Twig/Loader/String.php: -------------------------------------------------------------------------------- 1 | 29 | */ 30 | class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface 31 | { 32 | /** 33 | * {@inheritdoc} 34 | */ 35 | public function getSource($name) 36 | { 37 | return $name; 38 | } 39 | 40 | /** 41 | * {@inheritdoc} 42 | */ 43 | public function exists($name) 44 | { 45 | return true; 46 | } 47 | 48 | /** 49 | * {@inheritdoc} 50 | */ 51 | public function getCacheKey($name) 52 | { 53 | return $name; 54 | } 55 | 56 | /** 57 | * {@inheritdoc} 58 | */ 59 | public function isFresh($name, $time) 60 | { 61 | return true; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/Twig/LoaderInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_LoaderInterface 18 | { 19 | /** 20 | * Gets the source code of a template, given its name. 21 | * 22 | * @param string $name The name of the template to load 23 | * 24 | * @return string The template source code 25 | * 26 | * @throws Twig_Error_Loader When $name is not found 27 | */ 28 | public function getSource($name); 29 | 30 | /** 31 | * Gets the cache key to use for the cache for a given template name. 32 | * 33 | * @param string $name The name of the template to load 34 | * 35 | * @return string The cache key 36 | * 37 | * @throws Twig_Error_Loader When $name is not found 38 | */ 39 | public function getCacheKey($name); 40 | 41 | /** 42 | * Returns true if the template is still fresh. 43 | * 44 | * @param string $name The template name 45 | * @param int $time Timestamp of the last modification time of the 46 | * cached template 47 | * 48 | * @return bool true if the template is fresh, false otherwise 49 | * 50 | * @throws Twig_Error_Loader When $name is not found 51 | */ 52 | public function isFresh($name, $time); 53 | } 54 | -------------------------------------------------------------------------------- /vendor/Twig/Markup.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Markup implements Countable 18 | { 19 | protected $content; 20 | protected $charset; 21 | 22 | public function __construct($content, $charset) 23 | { 24 | $this->content = (string) $content; 25 | $this->charset = $charset; 26 | } 27 | 28 | public function __toString() 29 | { 30 | return $this->content; 31 | } 32 | 33 | public function count() 34 | { 35 | return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/Twig/Node/AutoEscape.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | class Twig_Node_AutoEscape extends Twig_Node 24 | { 25 | public function __construct($value, Twig_NodeInterface $body, $lineno, $tag = 'autoescape') 26 | { 27 | parent::__construct(array('body' => $body), array('value' => $value), $lineno, $tag); 28 | } 29 | 30 | public function compile(Twig_Compiler $compiler) 31 | { 32 | $compiler->subcompile($this->getNode('body')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Block.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Block extends Twig_Node 19 | { 20 | public function __construct($name, Twig_NodeInterface $body, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('body' => $body), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->addDebugInfo($this) 29 | ->write(sprintf("public function block_%s(\$context, array \$blocks = array())\n", $this->getAttribute('name')), "{\n") 30 | ->indent() 31 | ; 32 | 33 | $compiler 34 | ->subcompile($this->getNode('body')) 35 | ->outdent() 36 | ->write("}\n\n") 37 | ; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/Twig/Node/BlockReference.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct($name, $lineno, $tag = null) 21 | { 22 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->addDebugInfo($this) 29 | ->write(sprintf("\$this->displayBlock('%s', \$context, \$blocks);\n", $this->getAttribute('name'))) 30 | ; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Body.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Body extends Twig_Node 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Do.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Do extends Twig_Node 18 | { 19 | public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('expr' => $expr), array(), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->addDebugInfo($this) 28 | ->write('') 29 | ->subcompile($this->getNode('expr')) 30 | ->raw(";\n") 31 | ; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Embed.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Embed extends Twig_Node_Include 18 | { 19 | // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) 20 | public function __construct($filename, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) 21 | { 22 | parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); 23 | 24 | $this->setAttribute('filename', $filename); 25 | $this->setAttribute('index', $index); 26 | } 27 | 28 | protected function addGetTemplate(Twig_Compiler $compiler) 29 | { 30 | $compiler 31 | ->write('$this->loadTemplate(') 32 | ->string($this->getAttribute('filename')) 33 | ->raw(', ') 34 | ->repr($compiler->getFilename()) 35 | ->raw(', ') 36 | ->repr($this->getLine()) 37 | ->raw(', ') 38 | ->string($this->getAttribute('index')) 39 | ->raw(')') 40 | ; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | abstract class Twig_Node_Expression extends Twig_Node 19 | { 20 | } 21 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/AssignName.php: -------------------------------------------------------------------------------- 1 | raw('$context[') 19 | ->string($this->getAttribute('name')) 20 | ->raw(']') 21 | ; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary.php: -------------------------------------------------------------------------------- 1 | $left, 'right' => $right), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('(') 23 | ->subcompile($this->getNode('left')) 24 | ->raw(' ') 25 | ; 26 | $this->operator($compiler); 27 | $compiler 28 | ->raw(' ') 29 | ->subcompile($this->getNode('right')) 30 | ->raw(')') 31 | ; 32 | } 33 | 34 | abstract public function operator(Twig_Compiler $compiler); 35 | } 36 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Add.php: -------------------------------------------------------------------------------- 1 | raw('+'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/And.php: -------------------------------------------------------------------------------- 1 | raw('&&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/BitwiseAnd.php: -------------------------------------------------------------------------------- 1 | raw('&'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/BitwiseOr.php: -------------------------------------------------------------------------------- 1 | raw('|'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/BitwiseXor.php: -------------------------------------------------------------------------------- 1 | raw('^'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Concat.php: -------------------------------------------------------------------------------- 1 | raw('.'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Div.php: -------------------------------------------------------------------------------- 1 | raw('/'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/EndsWith.php: -------------------------------------------------------------------------------- 1 | getVarName(); 16 | $right = $compiler->getVarName(); 17 | $compiler 18 | ->raw(sprintf('(is_string($%s = ', $left)) 19 | ->subcompile($this->getNode('left')) 20 | ->raw(sprintf(') && is_string($%s = ', $right)) 21 | ->subcompile($this->getNode('right')) 22 | ->raw(sprintf(') && (\'\' === $%2$s || $%2$s === substr($%1$s, -strlen($%2$s))))', $left, $right)) 23 | ; 24 | } 25 | 26 | public function operator(Twig_Compiler $compiler) 27 | { 28 | return $compiler->raw(''); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Equal.php: -------------------------------------------------------------------------------- 1 | raw('=='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/FloorDiv.php: -------------------------------------------------------------------------------- 1 | raw('intval(floor('); 16 | parent::compile($compiler); 17 | $compiler->raw('))'); 18 | } 19 | 20 | public function operator(Twig_Compiler $compiler) 21 | { 22 | return $compiler->raw('/'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Greater.php: -------------------------------------------------------------------------------- 1 | raw('>'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/GreaterEqual.php: -------------------------------------------------------------------------------- 1 | raw('>='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/In.php: -------------------------------------------------------------------------------- 1 | raw('twig_in_filter(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw('in'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Less.php: -------------------------------------------------------------------------------- 1 | raw('<'); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/LessEqual.php: -------------------------------------------------------------------------------- 1 | raw('<='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Matches.php: -------------------------------------------------------------------------------- 1 | raw('preg_match(') 17 | ->subcompile($this->getNode('right')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('left')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw(''); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Mod.php: -------------------------------------------------------------------------------- 1 | raw('%'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Mul.php: -------------------------------------------------------------------------------- 1 | raw('*'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/NotEqual.php: -------------------------------------------------------------------------------- 1 | raw('!='); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/NotIn.php: -------------------------------------------------------------------------------- 1 | raw('!twig_in_filter(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw('not in'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Or.php: -------------------------------------------------------------------------------- 1 | raw('||'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Power.php: -------------------------------------------------------------------------------- 1 | raw('pow(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw('**'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Range.php: -------------------------------------------------------------------------------- 1 | raw('range(') 17 | ->subcompile($this->getNode('left')) 18 | ->raw(', ') 19 | ->subcompile($this->getNode('right')) 20 | ->raw(')') 21 | ; 22 | } 23 | 24 | public function operator(Twig_Compiler $compiler) 25 | { 26 | return $compiler->raw('..'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/StartsWith.php: -------------------------------------------------------------------------------- 1 | getVarName(); 16 | $right = $compiler->getVarName(); 17 | $compiler 18 | ->raw(sprintf('(is_string($%s = ', $left)) 19 | ->subcompile($this->getNode('left')) 20 | ->raw(sprintf(') && is_string($%s = ', $right)) 21 | ->subcompile($this->getNode('right')) 22 | ->raw(sprintf(') && (\'\' === $%2$s || 0 === strpos($%1$s, $%2$s)))', $left, $right)) 23 | ; 24 | } 25 | 26 | public function operator(Twig_Compiler $compiler) 27 | { 28 | return $compiler->raw(''); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Binary/Sub.php: -------------------------------------------------------------------------------- 1 | raw('-'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/BlockReference.php: -------------------------------------------------------------------------------- 1 | 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 | } 47 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Conditional.php: -------------------------------------------------------------------------------- 1 | $expr1, 'expr2' => $expr2, 'expr3' => $expr3), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('((') 23 | ->subcompile($this->getNode('expr1')) 24 | ->raw(') ? (') 25 | ->subcompile($this->getNode('expr2')) 26 | ->raw(') : (') 27 | ->subcompile($this->getNode('expr3')) 28 | ->raw('))') 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Constant.php: -------------------------------------------------------------------------------- 1 | $value), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler->repr($this->getAttribute('value')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/ExtensionReference.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression 18 | { 19 | public function __construct($name, $lineno, $tag = null) 20 | { 21 | parent::__construct(array(), array('name' => $name), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler->raw(sprintf("\$this->env->getExtension('%s')", $this->getAttribute('name'))); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Filter.php: -------------------------------------------------------------------------------- 1 | $node, 'filter' => $filterName, 'arguments' => $arguments), array(), $lineno, $tag); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $name = $this->getNode('filter')->getAttribute('value'); 22 | $filter = $compiler->getEnvironment()->getFilter($name); 23 | 24 | $this->setAttribute('name', $name); 25 | $this->setAttribute('type', 'filter'); 26 | $this->setAttribute('thing', $filter); 27 | $this->setAttribute('needs_environment', $filter->needsEnvironment()); 28 | $this->setAttribute('needs_context', $filter->needsContext()); 29 | $this->setAttribute('arguments', $filter->getArguments()); 30 | if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { 31 | $this->setAttribute('callable', $filter->getCallable()); 32 | } 33 | if ($filter instanceof Twig_SimpleFilter) { 34 | $this->setAttribute('is_variadic', $filter->isVariadic()); 35 | } 36 | 37 | $this->compileCallable($compiler); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Filter/Default.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var.foo|default('foo item on var is not defined') }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter 22 | { 23 | public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) 24 | { 25 | $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine()); 26 | 27 | if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { 28 | $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine()); 29 | $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine()); 30 | 31 | $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine()); 32 | } else { 33 | $node = $default; 34 | } 35 | 36 | parent::__construct($node, $filterName, $arguments, $lineno, $tag); 37 | } 38 | 39 | public function compile(Twig_Compiler $compiler) 40 | { 41 | $compiler->subcompile($this->getNode('node')); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Function.php: -------------------------------------------------------------------------------- 1 | $arguments), array('name' => $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $name = $this->getAttribute('name'); 21 | $function = $compiler->getEnvironment()->getFunction($name); 22 | 23 | $this->setAttribute('name', $name); 24 | $this->setAttribute('type', 'function'); 25 | $this->setAttribute('thing', $function); 26 | $this->setAttribute('needs_environment', $function->needsEnvironment()); 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()); 34 | } 35 | 36 | $this->compileCallable($compiler); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/GetAttr.php: -------------------------------------------------------------------------------- 1 | $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) { 22 | $compiler->raw('twig_template_get_attributes($this, '); 23 | } else { 24 | $compiler->raw('$this->getAttribute('); 25 | } 26 | 27 | if ($this->getAttribute('ignore_strict_check')) { 28 | $this->getNode('node')->setAttribute('ignore_strict_check', true); 29 | } 30 | 31 | $compiler->subcompile($this->getNode('node')); 32 | 33 | $compiler->raw(', ')->subcompile($this->getNode('attribute')); 34 | 35 | // only generate optional arguments when needed (to make generated code more readable) 36 | $needFourth = $this->getAttribute('ignore_strict_check'); 37 | $needThird = $needFourth || $this->getAttribute('is_defined_test'); 38 | $needSecond = $needThird || Twig_Template::ANY_CALL !== $this->getAttribute('type'); 39 | $needFirst = $needSecond || null !== $this->getNode('arguments'); 40 | 41 | if ($needFirst) { 42 | if (null !== $this->getNode('arguments')) { 43 | $compiler->raw(', ')->subcompile($this->getNode('arguments')); 44 | } else { 45 | $compiler->raw(', array()'); 46 | } 47 | } 48 | 49 | if ($needSecond) { 50 | $compiler->raw(', ')->repr($this->getAttribute('type')); 51 | } 52 | 53 | if ($needThird) { 54 | $compiler->raw(', ')->repr($this->getAttribute('is_defined_test')); 55 | } 56 | 57 | if ($needFourth) { 58 | $compiler->raw(', ')->repr($this->getAttribute('ignore_strict_check')); 59 | } 60 | 61 | $compiler->raw(')'); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/MethodCall.php: -------------------------------------------------------------------------------- 1 | $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); 16 | 17 | if ($node instanceof Twig_Node_Expression_Name) { 18 | $node->setAttribute('always_defined', true); 19 | } 20 | } 21 | 22 | public function compile(Twig_Compiler $compiler) 23 | { 24 | $compiler 25 | ->subcompile($this->getNode('node')) 26 | ->raw('->') 27 | ->raw($this->getAttribute('method')) 28 | ->raw('(') 29 | ; 30 | $first = true; 31 | foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { 32 | if (!$first) { 33 | $compiler->raw(', '); 34 | } 35 | $first = false; 36 | 37 | $compiler->subcompile($pair['value']); 38 | } 39 | $compiler->raw(')'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Parent.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Expression_Parent extends Twig_Node_Expression 19 | { 20 | public function __construct($name, $lineno, $tag = null) 21 | { 22 | parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | if ($this->getAttribute('output')) { 28 | $compiler 29 | ->addDebugInfo($this) 30 | ->write('$this->displayParentBlock(') 31 | ->string($this->getAttribute('name')) 32 | ->raw(", \$context, \$blocks);\n") 33 | ; 34 | } else { 35 | $compiler 36 | ->raw('$this->renderParentBlock(') 37 | ->string($this->getAttribute('name')) 38 | ->raw(', $context, $blocks)') 39 | ; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/TempName.php: -------------------------------------------------------------------------------- 1 | $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $compiler 21 | ->raw('$_') 22 | ->raw($this->getAttribute('name')) 23 | ->raw('_') 24 | ; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test.php: -------------------------------------------------------------------------------- 1 | $node, 'arguments' => $arguments), array('name' => $name), $lineno); 16 | } 17 | 18 | public function compile(Twig_Compiler $compiler) 19 | { 20 | $name = $this->getAttribute('name'); 21 | $test = $compiler->getEnvironment()->getTest($name); 22 | 23 | $this->setAttribute('name', $name); 24 | $this->setAttribute('type', 'test'); 25 | $this->setAttribute('thing', $test); 26 | if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) { 27 | $this->setAttribute('callable', $test->getCallable()); 28 | } 29 | if ($test instanceof Twig_SimpleTest) { 30 | $this->setAttribute('is_variadic', $test->isVariadic()); 31 | } 32 | 33 | $this->compileCallable($compiler); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Constant.php: -------------------------------------------------------------------------------- 1 | 16 | * {% if post.status is constant('Post::PUBLISHED') %} 17 | * the status attribute is exactly the same as Post::PUBLISHED 18 | * {% endif %} 19 | * 20 | * 21 | * @author Fabien Potencier 22 | */ 23 | class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test 24 | { 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->raw('(') 29 | ->subcompile($this->getNode('node')) 30 | ->raw(' === constant(') 31 | ; 32 | 33 | if ($this->getNode('arguments')->hasNode(1)) { 34 | $compiler 35 | ->raw('get_class(') 36 | ->subcompile($this->getNode('arguments')->getNode(1)) 37 | ->raw(')."::".') 38 | ; 39 | } 40 | 41 | $compiler 42 | ->subcompile($this->getNode('arguments')->getNode(0)) 43 | ->raw('))') 44 | ; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Defined.php: -------------------------------------------------------------------------------- 1 | 16 | * {# defined works with variable names and variable attributes #} 17 | * {% if foo is defined %} 18 | * {# ... #} 19 | * {% endif %} 20 | * 21 | * 22 | * @author Fabien Potencier 23 | */ 24 | class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test 25 | { 26 | public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) 27 | { 28 | parent::__construct($node, $name, $arguments, $lineno); 29 | 30 | if ($node instanceof Twig_Node_Expression_Name) { 31 | $node->setAttribute('is_defined_test', true); 32 | } elseif ($node instanceof Twig_Node_Expression_GetAttr) { 33 | $node->setAttribute('is_defined_test', true); 34 | 35 | $this->changeIgnoreStrictCheck($node); 36 | } else { 37 | throw new Twig_Error_Syntax('The "defined" test only works with simple variables.', $this->getLine()); 38 | } 39 | } 40 | 41 | protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node) 42 | { 43 | $node->setAttribute('ignore_strict_check', true); 44 | 45 | if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) { 46 | $this->changeIgnoreStrictCheck($node->getNode('node')); 47 | } 48 | } 49 | 50 | public function compile(Twig_Compiler $compiler) 51 | { 52 | $compiler->subcompile($this->getNode('node')); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Divisibleby.php: -------------------------------------------------------------------------------- 1 | 16 | * {% if loop.index is divisible by(3) %} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(0 == ') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % ') 29 | ->subcompile($this->getNode('arguments')->getNode(0)) 30 | ->raw(')') 31 | ; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Even.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is even }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % 2 == 0') 29 | ->raw(')') 30 | ; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Null.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is none }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(null === ') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(')') 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Odd.php: -------------------------------------------------------------------------------- 1 | 16 | * {{ var is odd }} 17 | * 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test 22 | { 23 | public function compile(Twig_Compiler $compiler) 24 | { 25 | $compiler 26 | ->raw('(') 27 | ->subcompile($this->getNode('node')) 28 | ->raw(' % 2 == 1') 29 | ->raw(')') 30 | ; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Test/Sameas.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test 18 | { 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler 22 | ->raw('(') 23 | ->subcompile($this->getNode('node')) 24 | ->raw(' === ') 25 | ->subcompile($this->getNode('arguments')->getNode(0)) 26 | ->raw(')') 27 | ; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Unary.php: -------------------------------------------------------------------------------- 1 | $node), array(), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $compiler->raw(' '); 22 | $this->operator($compiler); 23 | $compiler->subcompile($this->getNode('node')); 24 | } 25 | 26 | abstract public function operator(Twig_Compiler $compiler); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Unary/Neg.php: -------------------------------------------------------------------------------- 1 | raw('-'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Unary/Not.php: -------------------------------------------------------------------------------- 1 | raw('!'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Expression/Unary/Pos.php: -------------------------------------------------------------------------------- 1 | raw('+'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Flush.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Flush extends Twig_Node 18 | { 19 | public function __construct($lineno, $tag) 20 | { 21 | parent::__construct(array(), array(), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->addDebugInfo($this) 28 | ->write("flush();\n") 29 | ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Node/ForLoop.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_ForLoop extends Twig_Node 18 | { 19 | public function __construct($lineno, $tag = null) 20 | { 21 | parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | if ($this->getAttribute('else')) { 27 | $compiler->write("\$context['_iterated'] = true;\n"); 28 | } 29 | 30 | if ($this->getAttribute('with_loop')) { 31 | $compiler 32 | ->write("++\$context['loop']['index0'];\n") 33 | ->write("++\$context['loop']['index'];\n") 34 | ->write("\$context['loop']['first'] = false;\n") 35 | ; 36 | 37 | if (!$this->getAttribute('ifexpr')) { 38 | $compiler 39 | ->write("if (isset(\$context['loop']['length'])) {\n") 40 | ->indent() 41 | ->write("--\$context['loop']['revindex0'];\n") 42 | ->write("--\$context['loop']['revindex'];\n") 43 | ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") 44 | ->outdent() 45 | ->write("}\n") 46 | ; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vendor/Twig/Node/If.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_If extends Twig_Node 19 | { 20 | public function __construct(Twig_NodeInterface $tests, Twig_NodeInterface $else = null, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('tests' => $tests, 'else' => $else), array(), $lineno, $tag); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler->addDebugInfo($this); 28 | for ($i = 0, $count = count($this->getNode('tests')); $i < $count; $i += 2) { 29 | if ($i > 0) { 30 | $compiler 31 | ->outdent() 32 | ->write('} elseif (') 33 | ; 34 | } else { 35 | $compiler 36 | ->write('if (') 37 | ; 38 | } 39 | 40 | $compiler 41 | ->subcompile($this->getNode('tests')->getNode($i)) 42 | ->raw(") {\n") 43 | ->indent() 44 | ->subcompile($this->getNode('tests')->getNode($i + 1)) 45 | ; 46 | } 47 | 48 | if ($this->hasNode('else') && null !== $this->getNode('else')) { 49 | $compiler 50 | ->outdent() 51 | ->write("} else {\n") 52 | ->indent() 53 | ->subcompile($this->getNode('else')) 54 | ; 55 | } 56 | 57 | $compiler 58 | ->outdent() 59 | ->write("}\n"); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Import.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Import extends Twig_Node 18 | { 19 | public function __construct(Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->addDebugInfo($this) 28 | ->write('') 29 | ->subcompile($this->getNode('var')) 30 | ->raw(' = ') 31 | ; 32 | 33 | if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) { 34 | $compiler->raw('$this'); 35 | } else { 36 | $compiler 37 | ->raw('$this->loadTemplate(') 38 | ->subcompile($this->getNode('expr')) 39 | ->raw(', ') 40 | ->repr($compiler->getFilename()) 41 | ->raw(', ') 42 | ->repr($this->getLine()) 43 | ->raw(')') 44 | ; 45 | } 46 | 47 | $compiler->raw(";\n"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Print.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) 21 | { 22 | parent::__construct(array('expr' => $expr), array(), $lineno, $tag); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->addDebugInfo($this) 29 | ->write('echo ') 30 | ->subcompile($this->getNode('expr')) 31 | ->raw(";\n") 32 | ; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Sandbox.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Node_Sandbox extends Twig_Node 18 | { 19 | public function __construct(Twig_NodeInterface $body, $lineno, $tag = null) 20 | { 21 | parent::__construct(array('body' => $body), array(), $lineno, $tag); 22 | } 23 | 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->addDebugInfo($this) 28 | ->write("\$sandbox = \$this->env->getExtension('sandbox');\n") 29 | ->write("if (!\$alreadySandboxed = \$sandbox->isSandboxed()) {\n") 30 | ->indent() 31 | ->write("\$sandbox->enableSandbox();\n") 32 | ->outdent() 33 | ->write("}\n") 34 | ->subcompile($this->getNode('body')) 35 | ->write("if (!\$alreadySandboxed) {\n") 36 | ->indent() 37 | ->write("\$sandbox->disableSandbox();\n") 38 | ->outdent() 39 | ->write("}\n") 40 | ; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Twig/Node/SandboxedPrint.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | class Twig_Node_SandboxedPrint extends Twig_Node_Print 23 | { 24 | public function compile(Twig_Compiler $compiler) 25 | { 26 | $compiler 27 | ->addDebugInfo($this) 28 | ->write('echo $this->env->getExtension(\'sandbox\')->ensureToStringAllowed(') 29 | ->subcompile($this->getNode('expr')) 30 | ->raw(");\n") 31 | ; 32 | } 33 | 34 | /** 35 | * Removes node filters. 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')); 47 | } 48 | 49 | return $node; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /vendor/Twig/Node/SetTemp.php: -------------------------------------------------------------------------------- 1 | $name), $lineno); 17 | } 18 | 19 | public function compile(Twig_Compiler $compiler) 20 | { 21 | $name = $this->getAttribute('name'); 22 | $compiler 23 | ->addDebugInfo($this) 24 | ->write('if (isset($context[') 25 | ->string($name) 26 | ->raw('])) { $_') 27 | ->raw($name) 28 | ->raw('_ = $context[') 29 | ->repr($name) 30 | ->raw(']; } else { $_') 31 | ->raw($name) 32 | ->raw("_ = null; }\n") 33 | ; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Spaceless.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class Twig_Node_Spaceless extends Twig_Node 20 | { 21 | public function __construct(Twig_NodeInterface $body, $lineno, $tag = 'spaceless') 22 | { 23 | parent::__construct(array('body' => $body), array(), $lineno, $tag); 24 | } 25 | 26 | public function compile(Twig_Compiler $compiler) 27 | { 28 | $compiler 29 | ->addDebugInfo($this) 30 | ->write("ob_start();\n") 31 | ->subcompile($this->getNode('body')) 32 | ->write("echo trim(preg_replace('/>\s+<', ob_get_clean()));\n") 33 | ; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /vendor/Twig/Node/Text.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface 19 | { 20 | public function __construct($data, $lineno) 21 | { 22 | parent::__construct(array(), array('data' => $data), $lineno); 23 | } 24 | 25 | public function compile(Twig_Compiler $compiler) 26 | { 27 | $compiler 28 | ->addDebugInfo($this) 29 | ->write('echo ') 30 | ->string($this->getAttribute('data')) 31 | ->raw(";\n") 32 | ; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/Twig/NodeInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | 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 | 28 | public function getLine(); 29 | 30 | public function getNodeTag(); 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/NodeOutputInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_NodeOutputInterface 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/Twig/NodeVisitorInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_NodeVisitorInterface 18 | { 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); 28 | 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); 38 | 39 | /** 40 | * Returns the priority for this visitor. 41 | * 42 | * Priority should be between -10 and 10 (0 is the default). 43 | * 44 | * @return int The priority level 45 | */ 46 | public function getPriority(); 47 | } 48 | -------------------------------------------------------------------------------- /vendor/Twig/ParserInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_ParserInterface 20 | { 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 | */ 30 | public function parse(Twig_TokenStream $stream); 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Profiler/Dumper/Blackfire.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Profiler_Dumper_Blackfire 16 | { 17 | public function dump(Twig_Profiler_Profile $profile) 18 | { 19 | $data = array(); 20 | $this->dumpProfile('main()', $profile, $data); 21 | $this->dumpChildren('main()', $profile, $data); 22 | 23 | $start = microtime(true); 24 | $str = << $values) { 33 | $str .= "{$name}//{$values['ct']} {$values['wt']} {$values['mu']} {$values['pmu']}\n"; 34 | } 35 | 36 | return $str; 37 | } 38 | 39 | private function dumpChildren($parent, Twig_Profiler_Profile $profile, &$data) 40 | { 41 | foreach ($profile as $p) { 42 | if ($p->isTemplate()) { 43 | $name = $p->getTemplate(); 44 | } else { 45 | $name = sprintf('%s::%s(%s)', $p->getTemplate(), $p->getType(), $p->getName()); 46 | } 47 | $this->dumpProfile(sprintf('%s==>%s', $parent, $name), $p, $data); 48 | $this->dumpChildren($name, $p, $data); 49 | } 50 | } 51 | 52 | private function dumpProfile($edge, Twig_Profiler_Profile $profile, &$data) 53 | { 54 | if (isset($data[$edge])) { 55 | $data[$edge]['ct'] += 1; 56 | $data[$edge]['wt'] += floor($profile->getDuration() * 1000000); 57 | $data[$edge]['mu'] += $profile->getMemoryUsage(); 58 | $data[$edge]['pmu'] += $profile->getPeakMemoryUsage(); 59 | } else { 60 | $data[$edge] = array( 61 | 'ct' => 1, 62 | 'wt' => floor($profile->getDuration() * 1000000), 63 | 'mu' => $profile->getMemoryUsage(), 64 | 'pmu' => $profile->getPeakMemoryUsage(), 65 | ); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/Twig/Profiler/Dumper/Html.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Profiler_Dumper_Html extends Twig_Profiler_Dumper_Text 16 | { 17 | private static $colors = array( 18 | 'block' => '#dfd', 19 | 'macro' => '#ddf', 20 | 'template' => '#ffd', 21 | 'big' => '#d44', 22 | ); 23 | 24 | public function dump(Twig_Profiler_Profile $profile) 25 | { 26 | return '
'.parent::dump($profile).'
'; 27 | } 28 | 29 | protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) 30 | { 31 | return sprintf('%s└ %s', $prefix, self::$colors['template'], $profile->getTemplate()); 32 | } 33 | 34 | protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) 35 | { 36 | return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), isset(self::$colors[$profile->getType()]) ? self::$colors[$profile->getType()] : 'auto', $profile->getName()); 37 | } 38 | 39 | protected function formatTime(Twig_Profiler_Profile $profile, $percent) 40 | { 41 | return sprintf('%.2fms/%.0f%%', $percent > 20 ? self::$colors['big'] : 'auto', $profile->getDuration() * 1000, $percent); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/Twig/Profiler/Dumper/Text.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Profiler_Dumper_Text 16 | { 17 | private $root; 18 | 19 | public function dump(Twig_Profiler_Profile $profile) 20 | { 21 | return $this->dumpProfile($profile); 22 | } 23 | 24 | protected function formatTemplate(Twig_Profiler_Profile $profile, $prefix) 25 | { 26 | return sprintf('%s└ %s', $prefix, $profile->getTemplate()); 27 | } 28 | 29 | protected function formatNonTemplate(Twig_Profiler_Profile $profile, $prefix) 30 | { 31 | return sprintf('%s└ %s::%s(%s)', $prefix, $profile->getTemplate(), $profile->getType(), $profile->getName()); 32 | } 33 | 34 | protected function formatTime(Twig_Profiler_Profile $profile, $percent) 35 | { 36 | return sprintf('%.2fms/%.0f%%', $profile->getDuration() * 1000, $percent); 37 | } 38 | 39 | private function dumpProfile(Twig_Profiler_Profile $profile, $prefix = '', $sibling = false) 40 | { 41 | if ($profile->isRoot()) { 42 | $this->root = $profile->getDuration(); 43 | $start = $profile->getName(); 44 | } else { 45 | if ($profile->isTemplate()) { 46 | $start = $this->formatTemplate($profile, $prefix); 47 | } else { 48 | $start = $this->formatNonTemplate($profile, $prefix); 49 | } 50 | $prefix .= $sibling ? '│ ' : ' '; 51 | } 52 | 53 | $percent = $this->root ? $profile->getDuration() / $this->root * 100 : 0; 54 | 55 | if ($profile->getDuration() * 1000 < 1) { 56 | $str = $start."\n"; 57 | } else { 58 | $str = sprintf("%s %s\n", $start, $this->formatTime($profile, $percent)); 59 | } 60 | 61 | $nCount = count($profile->getProfiles()); 62 | foreach ($profile as $i => $p) { 63 | $str .= $this->dumpProfile($p, $prefix, $i + 1 !== $nCount); 64 | } 65 | 66 | return $str; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vendor/Twig/Profiler/Node/EnterProfile.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Profiler_Node_EnterProfile extends Twig_Node 18 | { 19 | public function __construct($extensionName, $type, $name, $varName) 20 | { 21 | parent::__construct(array(), array('extension_name' => $extensionName, 'name' => $name, 'type' => $type, 'var_name' => $varName)); 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function compile(Twig_Compiler $compiler) 28 | { 29 | $compiler 30 | ->write(sprintf('$%s = $this->env->getExtension(', $this->getAttribute('var_name'))) 31 | ->repr($this->getAttribute('extension_name')) 32 | ->raw(");\n") 33 | ->write(sprintf('$%s->enter($%s = new Twig_Profiler_Profile($this->getTemplateName(), ', $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) 34 | ->repr($this->getAttribute('type')) 35 | ->raw(', ') 36 | ->repr($this->getAttribute('name')) 37 | ->raw("));\n\n") 38 | ; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/Profiler/Node/LeaveProfile.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Profiler_Node_LeaveProfile extends Twig_Node 18 | { 19 | public function __construct($varName) 20 | { 21 | parent::__construct(array(), array('var_name' => $varName)); 22 | } 23 | 24 | /** 25 | * {@inheritdoc} 26 | */ 27 | public function compile(Twig_Compiler $compiler) 28 | { 29 | $compiler 30 | ->write("\n") 31 | ->write(sprintf("\$%s->leave(\$%s);\n\n", $this->getAttribute('var_name'), $this->getAttribute('var_name').'_prof')) 32 | ; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/Twig/Sandbox/SecurityError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityError extends Twig_Error 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedFilterError extends Twig_Sandbox_SecurityError 18 | { 19 | private $filterName; 20 | 21 | public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->filterName = $functionName; 25 | } 26 | 27 | public function getFilterName() 28 | { 29 | return $this->filterName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedFunctionError extends Twig_Sandbox_SecurityError 18 | { 19 | private $functionName; 20 | 21 | public function __construct($message, $functionName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->functionName = $functionName; 25 | } 26 | 27 | public function getFunctionName() 28 | { 29 | return $this->functionName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Sandbox/SecurityNotAllowedTagError.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_Sandbox_SecurityNotAllowedTagError extends Twig_Sandbox_SecurityError 18 | { 19 | private $tagName; 20 | 21 | public function __construct($message, $tagName, $lineno = -1, $filename = null, Exception $previous = null) 22 | { 23 | parent::__construct($message, $lineno, $filename, $previous); 24 | $this->tagName = $tagName; 25 | } 26 | 27 | public function getTagName() 28 | { 29 | return $this->tagName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/Twig/Sandbox/SecurityPolicyInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | interface Twig_Sandbox_SecurityPolicyInterface 18 | { 19 | public function checkSecurity($tags, $filters, $functions); 20 | 21 | public function checkMethodAllowed($obj, $method); 22 | 23 | public function checkPropertyAllowed($obj, $method); 24 | } 25 | -------------------------------------------------------------------------------- /vendor/Twig/SimpleTest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class Twig_SimpleTest 18 | { 19 | protected $name; 20 | protected $callable; 21 | protected $options; 22 | 23 | public function __construct($name, $callable, array $options = array()) 24 | { 25 | $this->name = $name; 26 | $this->callable = $callable; 27 | $this->options = array_merge(array( 28 | 'is_variadic' => false, 29 | 'node_class' => 'Twig_Node_Expression_Test', 30 | 'deprecated' => false, 31 | 'alternative' => null, 32 | ), $options); 33 | } 34 | 35 | public function getName() 36 | { 37 | return $this->name; 38 | } 39 | 40 | public function getCallable() 41 | { 42 | return $this->callable; 43 | } 44 | 45 | public function getNodeClass() 46 | { 47 | return $this->options['node_class']; 48 | } 49 | 50 | public function isVariadic() 51 | { 52 | return $this->options['is_variadic']; 53 | } 54 | 55 | public function isDeprecated() 56 | { 57 | return $this->options['deprecated']; 58 | } 59 | 60 | public function getAlternative() 61 | { 62 | return $this->options['alternative']; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/Twig/TemplateInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 3.0) 18 | */ 19 | interface Twig_TemplateInterface 20 | { 21 | const ANY_CALL = 'any'; 22 | const ARRAY_CALL = 'array'; 23 | const METHOD_CALL = 'method'; 24 | 25 | /** 26 | * Renders the template with the given context and returns it as string. 27 | * 28 | * @param array $context An array of parameters to pass to the template 29 | * 30 | * @return string The rendered template 31 | */ 32 | public function render(array $context); 33 | 34 | /** 35 | * Displays the template with the given context. 36 | * 37 | * @param array $context An array of parameters to pass to the template 38 | * @param array $blocks An array of blocks to pass to the template 39 | */ 40 | public function display(array $context, array $blocks = array()); 41 | 42 | /** 43 | * Returns the bound environment for this template. 44 | * 45 | * @return Twig_Environment The current environment 46 | */ 47 | public function getEnvironment(); 48 | } 49 | -------------------------------------------------------------------------------- /vendor/Twig/Test.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface 22 | { 23 | protected $options; 24 | protected $arguments = array(); 25 | 26 | public function __construct(array $options = array()) 27 | { 28 | $this->options = array_merge(array( 29 | 'callable' => null, 30 | ), $options); 31 | } 32 | 33 | public function getCallable() 34 | { 35 | return $this->options['callable']; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/Twig/Test/Function.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Test_Function extends Twig_Test 22 | { 23 | protected $function; 24 | 25 | public function __construct($function, array $options = array()) 26 | { 27 | $options['callable'] = $function; 28 | 29 | parent::__construct($options); 30 | 31 | $this->function = $function; 32 | } 33 | 34 | public function compile() 35 | { 36 | return $this->function; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/Twig/Test/Method.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Test_Method extends Twig_Test 22 | { 23 | protected $extension; 24 | protected $method; 25 | 26 | public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) 27 | { 28 | $options['callable'] = array($extension, $method); 29 | 30 | parent::__construct($options); 31 | 32 | $this->extension = $extension; 33 | $this->method = $method; 34 | } 35 | 36 | public function compile() 37 | { 38 | return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/Test/Node.php: -------------------------------------------------------------------------------- 1 | 18 | * 19 | * @deprecated since 1.12 (to be removed in 2.0) 20 | */ 21 | class Twig_Test_Node extends Twig_Test 22 | { 23 | protected $class; 24 | 25 | public function __construct($class, array $options = array()) 26 | { 27 | parent::__construct($options); 28 | 29 | $this->class = $class; 30 | } 31 | 32 | public function getClass() 33 | { 34 | return $this->class; 35 | } 36 | 37 | public function compile() 38 | { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/Test/NodeTestCase.php: -------------------------------------------------------------------------------- 1 | assertNodeCompilation($source, $node, $environment, $isPattern); 21 | } 22 | 23 | public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null, $isPattern = false) 24 | { 25 | $compiler = $this->getCompiler($environment); 26 | $compiler->compile($node); 27 | 28 | if ($isPattern) { 29 | $this->assertStringMatchesFormat($source, trim($compiler->getSource())); 30 | } else { 31 | $this->assertEquals($source, trim($compiler->getSource())); 32 | } 33 | } 34 | 35 | protected function getCompiler(Twig_Environment $environment = null) 36 | { 37 | return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); 38 | } 39 | 40 | protected function getEnvironment() 41 | { 42 | return new Twig_Environment(new Twig_Loader_Array(array())); 43 | } 44 | 45 | protected function getVariableGetter($name, $line = false) 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 | } 52 | 53 | return sprintf('%s$this->getContext($context, "%s")', $line, $name); 54 | } 55 | 56 | protected function getAttributeGetter() 57 | { 58 | if (function_exists('twig_template_get_attributes')) { 59 | return 'twig_template_get_attributes($this, '; 60 | } 61 | 62 | return '$this->getAttribute('; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/Twig/TestCallableInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 2.0) 18 | */ 19 | interface Twig_TestCallableInterface 20 | { 21 | public function getCallable(); 22 | } 23 | -------------------------------------------------------------------------------- /vendor/Twig/TestInterface.php: -------------------------------------------------------------------------------- 1 | 16 | * 17 | * @deprecated since 1.12 (to be removed in 2.0) 18 | */ 19 | interface Twig_TestInterface 20 | { 21 | /** 22 | * Compiles a test. 23 | * 24 | * @return string The PHP code for the test 25 | */ 26 | public function compile(); 27 | } 28 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | abstract class Twig_TokenParser implements Twig_TokenParserInterface 18 | { 19 | /** 20 | * @var Twig_Parser 21 | */ 22 | protected $parser; 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 | { 31 | $this->parser = $parser; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Do.php: -------------------------------------------------------------------------------- 1 | parser->getExpressionParser()->parseExpression(); 20 | 21 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 22 | 23 | return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); 24 | } 25 | 26 | public function getTag() 27 | { 28 | return 'do'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Embed.php: -------------------------------------------------------------------------------- 1 | parser->getStream(); 20 | 21 | $parent = $this->parser->getExpressionParser()->parseExpression(); 22 | 23 | list($variables, $only, $ignoreMissing) = $this->parseArguments(); 24 | 25 | // inject a fake parent to make the parent() function work 26 | $stream->injectTokens(array( 27 | new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()), 28 | new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()), 29 | new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine()), 30 | new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()), 31 | )); 32 | 33 | $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true); 34 | 35 | // override the parent with the correct one 36 | $module->setNode('parent', $parent); 37 | 38 | $this->parser->embedTemplate($module); 39 | 40 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 41 | 42 | return new Twig_Node_Embed($module->getAttribute('filename'), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); 43 | } 44 | 45 | public function decideBlockEnd(Twig_Token $token) 46 | { 47 | return $token->test('endembed'); 48 | } 49 | 50 | public function getTag() 51 | { 52 | return 'embed'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Extends.php: -------------------------------------------------------------------------------- 1 | 17 | * {% extends "base.html" %} 18 | * 19 | */ 20 | class Twig_TokenParser_Extends extends Twig_TokenParser 21 | { 22 | public function parse(Twig_Token $token) 23 | { 24 | if (!$this->parser->isMainScope()) { 25 | throw new Twig_Error_Syntax('Cannot extend from a block.', $token->getLine(), $this->parser->getFilename()); 26 | } 27 | 28 | if (null !== $this->parser->getParent()) { 29 | throw new Twig_Error_Syntax('Multiple extends tags are forbidden.', $token->getLine(), $this->parser->getFilename()); 30 | } 31 | $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); 32 | 33 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 34 | } 35 | 36 | public function getTag() 37 | { 38 | return 'extends'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Filter.php: -------------------------------------------------------------------------------- 1 | 16 | * {% filter upper %} 17 | * This text becomes uppercase 18 | * {% endfilter %} 19 | * 20 | */ 21 | class Twig_TokenParser_Filter extends Twig_TokenParser 22 | { 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); 30 | 31 | $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); 32 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 33 | 34 | $block = new Twig_Node_Block($name, $body, $token->getLine()); 35 | $this->parser->setBlock($name, $block); 36 | 37 | return new Twig_Node_Print($filter, $token->getLine(), $this->getTag()); 38 | } 39 | 40 | public function decideBlockEnd(Twig_Token $token) 41 | { 42 | return $token->test('endfilter'); 43 | } 44 | 45 | public function getTag() 46 | { 47 | return 'filter'; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Flush.php: -------------------------------------------------------------------------------- 1 | parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 22 | 23 | return new Twig_Node_Flush($token->getLine(), $this->getTag()); 24 | } 25 | 26 | public function getTag() 27 | { 28 | return 'flush'; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/From.php: -------------------------------------------------------------------------------- 1 | 16 | * {% from 'forms.html' import forms %} 17 | * 18 | */ 19 | class Twig_TokenParser_From extends Twig_TokenParser 20 | { 21 | public function parse(Twig_Token $token) 22 | { 23 | $macro = $this->parser->getExpressionParser()->parseExpression(); 24 | $stream = $this->parser->getStream(); 25 | $stream->expect('import'); 26 | 27 | $targets = array(); 28 | do { 29 | $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); 30 | 31 | $alias = $name; 32 | if ($stream->nextIf('as')) { 33 | $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); 34 | } 35 | 36 | $targets[$name] = $alias; 37 | 38 | if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { 39 | break; 40 | } 41 | } while (true); 42 | 43 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 44 | 45 | $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); 46 | 47 | foreach ($targets as $name => $alias) { 48 | if ($this->parser->isReservedMacroName($name)) { 49 | throw new Twig_Error_Syntax(sprintf('"%s" cannot be an imported macro as it is a reserved keyword.', $name), $token->getLine(), $stream->getFilename()); 50 | } 51 | 52 | $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); 53 | } 54 | 55 | return $node; 56 | } 57 | 58 | public function getTag() 59 | { 60 | return 'from'; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Import.php: -------------------------------------------------------------------------------- 1 | 16 | * {% import 'forms.html' as forms %} 17 | * 18 | */ 19 | class Twig_TokenParser_Import extends Twig_TokenParser 20 | { 21 | public function parse(Twig_Token $token) 22 | { 23 | $macro = $this->parser->getExpressionParser()->parseExpression(); 24 | $this->parser->getStream()->expect('as'); 25 | $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); 26 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 27 | 28 | $this->parser->addImportedSymbol('template', $var->getAttribute('name')); 29 | 30 | return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); 31 | } 32 | 33 | public function getTag() 34 | { 35 | return 'import'; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Include.php: -------------------------------------------------------------------------------- 1 | 17 | * {% include 'header.html' %} 18 | * Body 19 | * {% include 'footer.html' %} 20 | * 21 | */ 22 | class Twig_TokenParser_Include extends Twig_TokenParser 23 | { 24 | public function parse(Twig_Token $token) 25 | { 26 | $expr = $this->parser->getExpressionParser()->parseExpression(); 27 | 28 | list($variables, $only, $ignoreMissing) = $this->parseArguments(); 29 | 30 | return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); 31 | } 32 | 33 | protected function parseArguments() 34 | { 35 | $stream = $this->parser->getStream(); 36 | 37 | $ignoreMissing = false; 38 | if ($stream->nextIf(Twig_Token::NAME_TYPE, 'ignore')) { 39 | $stream->expect(Twig_Token::NAME_TYPE, 'missing'); 40 | 41 | $ignoreMissing = true; 42 | } 43 | 44 | $variables = null; 45 | if ($stream->nextIf(Twig_Token::NAME_TYPE, 'with')) { 46 | $variables = $this->parser->getExpressionParser()->parseExpression(); 47 | } 48 | 49 | $only = false; 50 | if ($stream->nextIf(Twig_Token::NAME_TYPE, 'only')) { 51 | $only = true; 52 | } 53 | 54 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 55 | 56 | return array($variables, $only, $ignoreMissing); 57 | } 58 | 59 | public function getTag() 60 | { 61 | return 'include'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Macro.php: -------------------------------------------------------------------------------- 1 | 16 | * {% macro input(name, value, type, size) %} 17 | * 18 | * {% endmacro %} 19 | * 20 | */ 21 | class Twig_TokenParser_Macro extends Twig_TokenParser 22 | { 23 | public function parse(Twig_Token $token) 24 | { 25 | $lineno = $token->getLine(); 26 | $stream = $this->parser->getStream(); 27 | $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); 28 | 29 | $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); 30 | 31 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 32 | $this->parser->pushLocalScope(); 33 | $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); 34 | if ($token = $stream->nextIf(Twig_Token::NAME_TYPE)) { 35 | $value = $token->getValue(); 36 | 37 | if ($value != $name) { 38 | throw new Twig_Error_Syntax(sprintf('Expected endmacro for macro "%s" (but "%s" given).', $name, $value), $stream->getCurrent()->getLine(), $stream->getFilename()); 39 | } 40 | } 41 | $this->parser->popLocalScope(); 42 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 43 | 44 | $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag())); 45 | } 46 | 47 | public function decideBlockEnd(Twig_Token $token) 48 | { 49 | return $token->test('endmacro'); 50 | } 51 | 52 | public function getTag() 53 | { 54 | return 'macro'; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Sandbox.php: -------------------------------------------------------------------------------- 1 | 16 | * {% sandbox %} 17 | * {% include 'user.html' %} 18 | * {% endsandbox %} 19 | * 20 | * 21 | * @see http://www.twig-project.org/doc/api.html#sandbox-extension for details 22 | */ 23 | class Twig_TokenParser_Sandbox extends Twig_TokenParser 24 | { 25 | public function parse(Twig_Token $token) 26 | { 27 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 28 | $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); 29 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 30 | 31 | // in a sandbox tag, only include tags are allowed 32 | if (!$body instanceof Twig_Node_Include) { 33 | foreach ($body as $node) { 34 | if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { 35 | continue; 36 | } 37 | 38 | if (!$node instanceof Twig_Node_Include) { 39 | throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section.', $node->getLine(), $this->parser->getFilename()); 40 | } 41 | } 42 | } 43 | 44 | return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); 45 | } 46 | 47 | public function decideBlockEnd(Twig_Token $token) 48 | { 49 | return $token->test('endsandbox'); 50 | } 51 | 52 | public function getTag() 53 | { 54 | return 'sandbox'; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Set.php: -------------------------------------------------------------------------------- 1 | 16 | * {% set foo = 'foo' %} 17 | * 18 | * {% set foo = [1, 2] %} 19 | * 20 | * {% set foo = {'foo': 'bar'} %} 21 | * 22 | * {% set foo = 'foo' ~ 'bar' %} 23 | * 24 | * {% set foo, bar = 'foo', 'bar' %} 25 | * 26 | * {% set foo %}Some content{% endset %} 27 | * 28 | */ 29 | class Twig_TokenParser_Set extends Twig_TokenParser 30 | { 31 | public function parse(Twig_Token $token) 32 | { 33 | $lineno = $token->getLine(); 34 | $stream = $this->parser->getStream(); 35 | $names = $this->parser->getExpressionParser()->parseAssignmentExpression(); 36 | 37 | $capture = false; 38 | if ($stream->nextIf(Twig_Token::OPERATOR_TYPE, '=')) { 39 | $values = $this->parser->getExpressionParser()->parseMultitargetExpression(); 40 | 41 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 42 | 43 | if (count($names) !== count($values)) { 44 | throw new Twig_Error_Syntax('When using set, you must have the same number of variables and assignments.', $stream->getCurrent()->getLine(), $stream->getFilename()); 45 | } 46 | } else { 47 | $capture = true; 48 | 49 | if (count($names) > 1) { 50 | throw new Twig_Error_Syntax('When using set with a block, you cannot have a multi-target.', $stream->getCurrent()->getLine(), $stream->getFilename()); 51 | } 52 | 53 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 54 | 55 | $values = $this->parser->subparse(array($this, 'decideBlockEnd'), true); 56 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 57 | } 58 | 59 | return new Twig_Node_Set($capture, $names, $values, $lineno, $this->getTag()); 60 | } 61 | 62 | public function decideBlockEnd(Twig_Token $token) 63 | { 64 | return $token->test('endset'); 65 | } 66 | 67 | public function getTag() 68 | { 69 | return 'set'; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Spaceless.php: -------------------------------------------------------------------------------- 1 | 16 | * {% spaceless %} 17 | *
18 | * foo 19 | *
20 | * {% endspaceless %} 21 | * 22 | * {# output will be
foo
#} 23 | * 24 | */ 25 | class Twig_TokenParser_Spaceless extends Twig_TokenParser 26 | { 27 | public function parse(Twig_Token $token) 28 | { 29 | $lineno = $token->getLine(); 30 | 31 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 32 | $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); 33 | $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); 34 | 35 | return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); 36 | } 37 | 38 | public function decideSpacelessEnd(Twig_Token $token) 39 | { 40 | return $token->test('endspaceless'); 41 | } 42 | 43 | public function getTag() 44 | { 45 | return 'spaceless'; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParser/Use.php: -------------------------------------------------------------------------------- 1 | 16 | * {% extends "base.html" %} 17 | * 18 | * {% use "blocks.html" %} 19 | * 20 | * {% block title %}{% endblock %} 21 | * {% block content %}{% endblock %} 22 | * 23 | * 24 | * @see http://www.twig-project.org/doc/templates.html#horizontal-reuse for details. 25 | */ 26 | class Twig_TokenParser_Use extends Twig_TokenParser 27 | { 28 | public function parse(Twig_Token $token) 29 | { 30 | $template = $this->parser->getExpressionParser()->parseExpression(); 31 | $stream = $this->parser->getStream(); 32 | 33 | if (!$template instanceof Twig_Node_Expression_Constant) { 34 | throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getFilename()); 35 | } 36 | 37 | $targets = array(); 38 | if ($stream->nextIf('with')) { 39 | do { 40 | $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); 41 | 42 | $alias = $name; 43 | if ($stream->nextIf('as')) { 44 | $alias = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); 45 | } 46 | 47 | $targets[$name] = new Twig_Node_Expression_Constant($alias, -1); 48 | 49 | if (!$stream->nextIf(Twig_Token::PUNCTUATION_TYPE, ',')) { 50 | break; 51 | } 52 | } while (true); 53 | } 54 | 55 | $stream->expect(Twig_Token::BLOCK_END_TYPE); 56 | 57 | $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); 58 | } 59 | 60 | public function getTag() 61 | { 62 | return 'use'; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParserBrokerInterface.php: -------------------------------------------------------------------------------- 1 | 19 | * 20 | * @deprecated since 1.12 (to be removed in 2.0) 21 | */ 22 | interface Twig_TokenParserBrokerInterface 23 | { 24 | /** 25 | * Gets a TokenParser suitable for a tag. 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 | 40 | /** 41 | * Gets the Twig_ParserInterface. 42 | * 43 | * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null 44 | */ 45 | public function getParser(); 46 | } 47 | -------------------------------------------------------------------------------- /vendor/Twig/TokenParserInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 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 | */ 35 | public function parse(Twig_Token $token); 36 | 37 | /** 38 | * Gets the tag name associated with this token parser. 39 | * 40 | * @return string The tag name 41 | */ 42 | public function getTag(); 43 | } 44 | -------------------------------------------------------------------------------- /vendor/Twig/Util/DeprecationCollector.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Util_DeprecationCollector 16 | { 17 | private $twig; 18 | private $deprecations; 19 | 20 | public function __construct(Twig_Environment $twig) 21 | { 22 | $this->twig = $twig; 23 | } 24 | 25 | /** 26 | * Returns deprecations for templates contained in a directory. 27 | * 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 | { 35 | $iterator = new RegexIterator( 36 | new RecursiveIteratorIterator( 37 | new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY 38 | ), '{'.preg_quote($ext).'$}' 39 | ); 40 | 41 | return $this->collect(new Twig_Util_TemplateDirIterator($iterator)); 42 | } 43 | 44 | /** 45 | * Returns deprecations for passed templates. 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 | { 53 | $this->deprecations = array(); 54 | 55 | set_error_handler(array($this, 'errorHandler')); 56 | 57 | foreach ($iterator as $name => $contents) { 58 | try { 59 | $this->twig->parse($this->twig->tokenize($contents, $name)); 60 | } catch (Twig_Error_Syntax $e) { 61 | // ignore templates containing syntax errors 62 | } 63 | } 64 | 65 | restore_error_handler(); 66 | 67 | $deprecations = $this->deprecations; 68 | $this->deprecations = array(); 69 | 70 | return $deprecations; 71 | } 72 | 73 | /** 74 | * @internal 75 | */ 76 | public function errorHandler($type, $msg) 77 | { 78 | if (E_USER_DEPRECATED === $type) { 79 | $this->deprecations[] = $msg; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /vendor/Twig/Util/TemplateDirIterator.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | class Twig_Util_TemplateDirIterator extends IteratorIterator 16 | { 17 | public function current() 18 | { 19 | return file_get_contents(parent::current()); 20 | } 21 | 22 | public function key() 23 | { 24 | return (string) parent::key(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /yaml_translation_patterns.yml: -------------------------------------------------------------------------------- 1 | translation_patterns: 2 | - matches: '*.info.yml' 3 | translatable_keys: 4 | - name 5 | - description 6 | - package 7 | - regions 8 | - matches: '*.routing.yml' 9 | translatable_keys: 10 | - key: _title 11 | context: _title_context 12 | - matches: '*.links.*.yml' 13 | translatable_keys: 14 | - key: title 15 | context: title_context 16 | - matches: '*.links.menu.yml' 17 | translatable_keys: 18 | - description 19 | - matches: '*.breakpoints.yml' 20 | translatable_keys: 21 | - label 22 | - group 23 | - matches: '*.permissions.yml' 24 | top_level_translatables: true 25 | translatable_keys: 26 | - title 27 | - description 28 | - matches: 'config/schema/*.yml' 29 | translatable_keys: 30 | - label 31 | --------------------------------------------------------------------------------