public function __construct($filename, $source, $encoding = 'utf-8')
{
$this->filename = $filename;
$this->source = $source;
$this->encoding = $encoding;
// Split source into line arrays, containing both content and ending.
preg_match_all('((?<content>.*?)(?<ending>\\n|\\r\\n?|$))', $source, $matches, PREG_SET_ORDER);
foreach ($matches as $index => $line) {
$this->lines[$index + 1] = array('content' => $line['content'], 'ending' => $line['ending']);
}
}