protected function consumeReference($lines, $current)
{
while (isset($lines[$current]) && preg_match('/^ {0,3}\\[(.+?)\\]:\\s*(.+?)(?:\\s+[\\(\'"](.+?)[\\)\'"])?\\s*$/', $lines[$current], $matches)) {
$label = strtolower($matches[1]);
$this->references[$label] = ['url' => $this->replaceEscape($matches[2])];
if (isset($matches[3])) {
$this->references[$label]['title'] = $matches[3];
} else {
// title may be on the next line
if (isset($lines[$current + 1]) && preg_match('/^\\s+[\\(\'"](.+?)[\\)\'"]\\s*$/', $lines[$current + 1], $matches)) {
$this->references[$label]['title'] = $matches[1];
$current++;
}
}
$current++;
}
return [false, --$current];
}