[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/phpexcel/PHPExcel/RichText/ -> TextElement.php (source)

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


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1