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

Source for file context.php

Documentation is available at context.php

  1. <?php
  2.  
  3. require_once 'Text/Diff/Renderer.php';
  4.  
  5. /**
  6.  * "Context" diff renderer.
  7.  *
  8.  * This class renders the diff in classic "context diff" format.
  9.  *
  10.  * $Horde: framework/Text_Diff/Diff/Renderer/context.php,v 1.1 2007/01/05 15:23:57 jan Exp $
  11.  *
  12.  * @package Text_Diff
  13.  */
  14.  
  15.     /**
  16.      * Number of leading context "lines" to preserve.
  17.      */
  18.     var $_leading_context_lines = 4;
  19.  
  20.     /**
  21.      * Number of trailing context "lines" to preserve.
  22.      */
  23.     var $_trailing_context_lines = 4;
  24.  
  25.     var $_second_block '';
  26.  
  27.     function _blockHeader($xbeg$xlen$ybeg$ylen)
  28.     {
  29.         if ($xlen != 1{
  30.             $xbeg .= ',' $xlen;
  31.         }
  32.         if ($ylen != 1{
  33.             $ybeg .= ',' $ylen;
  34.         }
  35.         $this->_second_block = "--- $ybeg ----\n";
  36.         return "***************\n*** $xbeg ****";
  37.     }
  38.  
  39.     function _endBlock()
  40.     {
  41.         return $this->_second_block;
  42.     }
  43.  
  44.     function _context($lines)
  45.     {
  46.         $this->_second_block .= $this->_lines($lines'  ');
  47.         return $this->_lines($lines'  ');
  48.     }
  49.  
  50.     function _added($lines)
  51.     {
  52.         $this->_second_block .= $this->_lines($lines'+ ');
  53.         return '';
  54.     }
  55.  
  56.     function _deleted($lines)
  57.     {
  58.         return $this->_lines($lines'- ');
  59.     }
  60.  
  61.     function _changed($orig$final)
  62.     {
  63.         $this->_second_block .= $this->_lines($final'! ');
  64.         return $this->_lines($orig'! ');
  65.     }
  66.  
  67. }

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