protected static function branch(array $paths, array $branches): array
    {
        $twig = array_shift($branches);
        if (count($branches) == 0) {
            $paths[] = $twig;

            return $paths;
        }

        if (!isset($paths[$twig])) {
            $paths[$twig] = [];
        }

        $paths[$twig] = static::branch($paths[$twig], $branches);

        return $paths;
    }