refactoring of twig variable collector to wrap them in extensions