protected function Twig_Tests_IntegrationTest::parseTemplates

1 call to Twig_Tests_IntegrationTest::parseTemplates()
Twig_Tests_IntegrationTest::getTests in drupal/core/vendor/twig/twig/test/Twig/Tests/integrationTest.php

File

drupal/core/vendor/twig/twig/test/Twig/Tests/integrationTest.php, line 132

Class

Twig_Tests_IntegrationTest

Code

protected function parseTemplates($test) {
  $templates = array();
  preg_match_all('/--TEMPLATE(?:\\((.*?)\\))?--(.*?)(?=\\-\\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER);
  foreach ($matches as $match) {
    $templates[$match[1] ? $match[1] : 'index.twig'] = $match[2];
  }
  return $templates;
}