method difference documentation in bbn\Api\Git

function() { $arr= []; $status = [ '@@ -1 +0,0 @@' => 'delete in local', '@@ -1 +1 @@' => 'different', '@@ +1 -1 @@' => 'different', '@@ 0,0 -1 @@' => 'delete in remote', ]; foreach ($diff as $i => $ele){ $start = strpos($ele, '--git'); if ( $start != 0){ $idx = 0; $file = substr($ele, $start+5); $file = substr($file, Strpos($file, 'a/')+2, Strpos($file, 'b/')-3); $idx= $i+5; if ( strpos($diff[$i + 5], '@@') === false ){ $idx--; } if ( !empty($diff[$idx+1]) ){ $x = strpos($diff[$idx+1],'-]{+') === false ? '-]' : '-]{+'; $remote_code = false; $local_code = false; //for code remote if ( $x === '-]{+' ){ $code = substr($diff[$idx+1],strpos($diff[$idx+1],$x)+4); $remote_code = substr($code,0, Strpos($code,'+}')); } //for code local if ( strpos($diff[$idx+1], '[-') !== false ){ $code = substr($diff[$idx+1], strpos($diff[$idx+1], '[-')+2); $local_code = substr($code,0, Strpos($code, $x)); } $arr[] = [ 'file' => $file, 'status' => $status[$diff[$idx]], 'code' => [ 'local' => $local_code, 'remote'=> $remote_code ] ]; } } } return $arr; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.