public function printSnippets(SnippetPrinter $printer, array $snippets)
    {
        $printableSnippets = array();
        foreach ($snippets as $snippet) {
            foreach ($snippet->getTargets() as $target) {
                $targetSnippets = array();

                if (isset($printableSnippets[$target])) {
                    $targetSnippets = $printableSnippets[$target];
                }

                $targetSnippets[] = $snippet;
                $printableSnippets[$target] = $targetSnippets;
            }
        }

        foreach ($printableSnippets as $target => $targetSnippets) {
            $printer->printSnippets($target, $targetSnippets);
        }
    }