Netresearch\Composer\Patches\Patch::getActionFiles PHP Method

getActionFiles() protected method

Find the file additions/deletions within the patch file
protected getActionFiles ( string $action ) : array
$action string '-' or '+'
return array
    protected function getActionFiles($action)
    {
        $prefix = preg_quote(str_repeat($action, 3));
        $p1 = $action == '-' ? 'a' : 'b';
        preg_match_all('/^' . $prefix . ' (.+)$/m', $this->read(), $matches);
        $paths = array();
        foreach ($matches[1] as $match) {
            if ($match === '/dev/null') {
                continue;
            }
            $slashPos = strpos($match, '/');
            if (substr($match, 0, $slashPos) !== $p1) {
                throw new Exception('Unexpected path: ' . $match);
            }
            $paths[] = substr($match, $slashPos + 1);
        }
        return $paths;
    }