/** * create objects from command output * https://www.kernel.org/pub/software/scm/git/docs/git-status.html in the output section * * * @param array $lines */ private function parseOutputLines($lines) { foreach ($lines as $line) { preg_match('/([MADRCU\\? ])?([MADRCU\\? ])?\\ "?(\\S+)"? ?( -> )?(\\S+)?/', $line, $matches); $x = isset($matches[1]) ? $matches[1] : null; $y = isset($matches[2]) ? $matches[2] : null; $file = isset($matches[3]) ? $matches[3] : null; $renamedFile = isset($matches[4]) ? $matches[4] : null; $this->files[] = StatusFile::create($x, $y, $file, $renamedFile); } }