[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * PHPExcel_RichText_Run
   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_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
  27  {
  28      /**
  29       * Font
  30       *
  31       * @var PHPExcel_Style_Font
  32       */
  33      private $font;
  34  
  35      /**
  36       * Create a new PHPExcel_RichText_Run instance
  37       *
  38       * @param     string        $pText        Text
  39       */
  40      public function __construct($pText = '')
  41      {
  42          // Initialise variables
  43          $this->setText($pText);
  44          $this->font = new PHPExcel_Style_Font();
  45      }
  46  
  47      /**
  48       * Get font
  49       *
  50       * @return PHPExcel_Style_Font
  51       */
  52      public function getFont()
  53      {
  54          return $this->font;
  55      }
  56  
  57      /**
  58       * Set font
  59       *
  60       * @param    PHPExcel_Style_Font        $pFont        Font
  61       * @throws     PHPExcel_Exception
  62       * @return PHPExcel_RichText_ITextElement
  63       */
  64      public function setFont(PHPExcel_Style_Font $pFont = null)
  65      {
  66          $this->font = $pFont;
  67          return $this;
  68      }
  69  
  70      /**
  71       * Get hash code
  72       *
  73       * @return string    Hash code
  74       */
  75      public function getHashCode()
  76      {
  77          return md5(
  78              $this->getText() .
  79              $this->font->getHashCode() .
  80              __CLASS__
  81          );
  82      }
  83  
  84      /**
  85       * Implement PHP __clone to create a deep clone, not just a shallow copy.
  86       */
  87      public function __clone()
  88      {
  89          $vars = get_object_vars($this);
  90          foreach ($vars as $key => $value) {
  91              if (is_object($value)) {
  92                  $this->$key = clone $value;
  93              } else {
  94                  $this->$key = $value;
  95              }
  96          }
  97      }
  98  }


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