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.3.10.7 2009/01/06 15:23:42 jan Exp $
  8.  *
  9.  * Copyright 2004-2009 The Horde Project (http://www.horde.org/)
  10.  *
  11.  * See the enclosed file COPYING for license information (LGPL). If you did
  12.  * not receive this file, see http://opensource.org/licenses/lgpl-license.php.
  13.  *
  14.  * @author  Ciprian Popovici
  15.  * @package Text_Diff
  16.  */
  17.  
  18. /** Text_Diff_Renderer */
  19. require_once 'Text/Diff/Renderer.php';
  20.  
  21. /**
  22.  * @package Text_Diff
  23.  */
  24.  
  25.     /**
  26.      * Number of leading context "lines" to preserve.
  27.      */
  28.     var $_leading_context_lines = 4;
  29.  
  30.     /**
  31.      * Number of trailing context "lines" to preserve.
  32.      */
  33.     var $_trailing_context_lines = 4;
  34.  
  35.     function _blockHeader($xbeg$xlen$ybeg$ylen)
  36.     {
  37.         if ($xlen != 1{
  38.             $xbeg .= ',' $xlen;
  39.         }
  40.         if ($ylen != 1{
  41.             $ybeg .= ',' $ylen;
  42.         }
  43.         return "@@ -$xbeg +$ybeg @@";
  44.     }
  45.  
  46.     function _context($lines)
  47.     {
  48.         return $this->_lines($lines' ');
  49.     }
  50.  
  51.     function _added($lines)
  52.     {
  53.         return $this->_lines($lines'+');
  54.     }
  55.  
  56.     function _deleted($lines)
  57.     {
  58.         return $this->_lines($lines'-');
  59.     }
  60.  
  61.     function _changed($orig$final)
  62.     {
  63.         return $this->_deleted($orig$this->_added($final);
  64.     }
  65.  
  66. }

Documentation generated on Fri, 24 Jul 2009 15:00:05 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.