public function Twig_Util_DeprecationCollector::collect in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/twig/twig/lib/Twig/Util/DeprecationCollector.php \Twig_Util_DeprecationCollector::collect()
Returns deprecations for passed templates.
Parameters
Iterator $iterator An iterator of templates (where keys are template names and values the contents of the template):
Return value
array() An array of deprecations
1 call to Twig_Util_DeprecationCollector::collect()
- Twig_Util_DeprecationCollector::collectDir in vendor/
twig/ twig/ lib/ Twig/ Util/ DeprecationCollector.php - Returns deprecations for templates contained in a directory.
File
- vendor/
twig/ twig/ lib/ Twig/ Util/ DeprecationCollector.php, line 51
Class
- Twig_Util_DeprecationCollector
- @author Fabien Potencier <fabien@symfony.com>
Code
public function collect(Iterator $iterator) {
$this->deprecations = array();
set_error_handler(array(
$this,
'errorHandler',
));
foreach ($iterator as $name => $contents) {
try {
$this->twig
->parse($this->twig
->tokenize($contents, $name));
} catch (Twig_Error_Syntax $e) {
// ignore templates containing syntax errors
}
}
restore_error_handler();
$deprecations = $this->deprecations;
$this->deprecations = array();
return $deprecations;
}