Problem: Accessing a Twig Extension dataset that was needed for logging outside of the Twig Template in an Controller
Complication: The data was only available in context, so the actual rendering was needed
Solution: Write a Getter, Write the Data in a property, access the Getter from Outside
Write in the custom Twitch Function
$this->result = $result;
Getter Function
function getResult() { return $this->result; }
Fetching data
$result = $this->twig->getExtension(‚\App\Tools\Twig\customExtension‘)->getResult();
Source https://stackoverflow.com/questions/7932666/accessing-twig-template-variables-from-php
Additional https://tomasvotruba.com/blog/stamp-1-how-to-compile-twig-to-php/