public static function parse($diff)
    {
        if ('' === $diff) {
            return array();
        }

        $lines = explode("\n", $diff);
        $nbLines = count($lines);
        $curLine = 0;
        $chunks = array();

        while ($curLine < $nbLines) {
            $chunks[] = self::parseChunk($lines, $nbLines, $curLine);
        }

        return $chunks;
    }