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

Source for file Comment.php

Documentation is available at Comment.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2008 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel
  23.  * @copyright  Copyright (c) 2006 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.4, 2008-10-27
  26.  */
  27.  
  28.  
  29. /** PHPExcel_RichText */
  30. require_once 'PHPExcel/RichText.php';
  31.  
  32. /** PHPExcel_IComparable */
  33. require_once 'PHPExcel/IComparable.php';
  34.  
  35.  
  36. /**
  37.  * PHPExcel_Comment
  38.  *
  39.  * @category   PHPExcel
  40.  * @package    PHPExcel
  41.  * @copyright  Copyright (c) 2006 - 2008 PHPExcel (http://www.codeplex.com/PHPExcel)
  42.  */
  43. class PHPExcel_Comment implements PHPExcel_IComparable
  44. {
  45.     /**
  46.      * Author
  47.      *
  48.      * @var string 
  49.      */
  50.     private $_author;
  51.     
  52.     /**
  53.      * Rich text comment
  54.      *
  55.      * @var PHPExcel_RichText 
  56.      */
  57.     private $_text;
  58.         
  59.     /**
  60.      * Create a new PHPExcel_Comment
  61.      * 
  62.      * @throws    Exception
  63.      */
  64.     public function __construct()
  65.     {
  66.         // Initialise variables
  67.         $this->_author        = 'Author';
  68.         $this->_text        = new PHPExcel_RichText();
  69.     }
  70.     
  71.     /**
  72.      * Get Author
  73.      *
  74.      * @return string 
  75.      */
  76.     public function getAuthor({
  77.         return $this->_author;
  78.     }
  79.     
  80.     /**
  81.      * Set Author
  82.      *
  83.      * @param string $pValue 
  84.      */
  85.     public function setAuthor($pValue ''{
  86.         $this->_author = $pValue;
  87.     }
  88.     
  89.     /**
  90.      * Get Rich text comment
  91.      *
  92.      * @return PHPExcel_RichText 
  93.      */
  94.     public function getText({
  95.         return $this->_text;
  96.     }
  97.     
  98.     /**
  99.      * Set Rich text comment
  100.      *
  101.      * @param PHPExcel_RichText $pValue 
  102.      */
  103.     public function setText(PHPExcel_RichText $pValue{
  104.         $this->_text = $pValue;
  105.     }
  106.     
  107.     /**
  108.      * Get hash code
  109.      *
  110.      * @return string    Hash code
  111.      */    
  112.     public function getHashCode({
  113.         return md5(
  114.               $this->_author
  115.             . $this->_text->getHashCode()
  116.             . __CLASS__
  117.         );
  118.     }
  119.         
  120.     /**
  121.      * Implement PHP __clone to create a deep clone, not just a shallow copy.
  122.      */
  123.     public function __clone({
  124.         $vars get_object_vars($this);
  125.         foreach ($vars as $key => $value{
  126.             if (is_object($value)) {
  127.                 $this->$key clone $value;
  128.             else {
  129.                 $this->$key $value;
  130.             }
  131.         }
  132.     }
  133. }

Documentation generated on Mon, 27 Oct 2008 08:37:49 +0100 by phpDocumentor 1.4.1