/** * Creates a new merge object * @param \gihp\Object\Blob $original The original blob * @param \gihp\Diff\Diff $base The diff to the original blob from the base branch * @param \gihp\Diff\Diff $head The diff to the original blob from the head branch * @param string $branch_name The name of the head branch */ public function __construct(Blob $original, Diff $base, Diff $head, $branch_name = '') { $orig_arr = explode("\n", $original->getData()); $base_diff_arr = $base->getArray(); $head_diff_arr = $head->getArray(); $this->merge_data = self::mergeArrays($orig_arr, $base_diff_arr, $head_diff_arr, $branch_name); }
/** * Creates a new diff object * @param \gihp\Object\Blob $original The base of the diff * @param \gihp\Object\Blob $modified The modified version of the base */ public function __construct(Blob $original, Blob $modified) { $orig_arr = explode("\n", $original->getData()); $mod_arr = explode("\n", $modified->getData()); $this->diff = self::diff($orig_arr, $mod_arr); }
/** * Exports a blob * @param \gihp\Object\Blob $blob * @return string */ private static function exportBlob(Blob $blob) { return $blob->getData(); }