Text_Diff
[ class tree: Text_Diff ] [ index: Text_Diff ] [ all elements ]

Source for file unified.php

Documentation is available at unified.php

  1. <?php
  2. /**
  3.  * "Unified" diff renderer.
  4.  *
  5.  * This class renders the diff in classic "unified diff" format.
  6.  *
  7.  * $Horde: framework/Text_Diff/Diff/Renderer/unified.php,v 1.2 2004/01/09 21:46:30 chuck Exp $
  8.  *
  9.  * @package Text_Diff
  10.  */
  11.  
  12.     function Text_Diff_Renderer_unified($context_lines = 4)
  13.     {
  14.         $this->_leading_context_lines $context_lines;
  15.         $this->_trailing_context_lines $context_lines;
  16.     }
  17.  
  18.     function _blockHeader($xbeg$xlen$ybeg$ylen)
  19.     {
  20.         if ($xlen != 1{
  21.             $xbeg .= ',' $xlen;
  22.         }
  23.         if ($ylen != 1{
  24.             $ybeg .= ',' $ylen;
  25.         }
  26.         return "@@ -$xbeg +$ybeg @@";
  27.     }
  28.  
  29.     function _added($lines)
  30.     {
  31.         $this->_lines($lines'+');
  32.     }
  33.  
  34.     function _deleted($lines)
  35.     {
  36.         $this->_lines($lines'-');
  37.     }
  38.  
  39.     function _changed($orig$final)
  40.     {
  41.         $this->_deleted($orig);
  42.         $this->_added($final);
  43.     }
  44.  
  45. }

Documentation generated on Mon, 11 Mar 2019 10:15:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.