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

Source for file TextElement.php

Documentation is available at TextElement.php

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

Documentation generated on Mon, 05 Jan 2009 20:38:39 +0100 by phpDocumentor 1.4.1