You are here

protected static function Twig_Test_IntegrationTestCase::parseTemplates in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php \Twig_Test_IntegrationTestCase::parseTemplates()
1 call to Twig_Test_IntegrationTestCase::parseTemplates()
Twig_Test_IntegrationTestCase::getTests in vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php

File

vendor/twig/twig/lib/Twig/Test/IntegrationTestCase.php, line 222

Class

Twig_Test_IntegrationTestCase
Integration test helper.

Code

protected static 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;
}