. */ declare(strict_types=1); namespace FireflyIII\Support\Twig\Loader; use FireflyIII\Support\Twig\Extension\TransactionJournal; use Twig_RuntimeLoaderInterface; /** * Class TransactionJournalLoader. */ class TransactionJournalLoader implements Twig_RuntimeLoaderInterface { /** * Creates the runtime implementation of a Twig element (filter/function/test). * * @param string $class A runtime class * * @return object|null The runtime instance or null if the loader does not know how to create the runtime for this class */ public function load($class) { // implement the logic to create an instance of $class // and inject its dependencies // most of the time, it means using your dependency injection container if (TransactionJournal::class === $class) { return app(TransactionJournal::class); } return null; } }