/branches/v1.1.0/Classes/PHPExcel/Style/Border.php
PHP | 149 lines | 53 code | 14 blank | 82 comment | 2 complexity | 384bbfa2081d06d4f4bb8955a4bf96e4 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-2.0, LGPL-2.1, GPL-3.0, LGPL-3.0
- <?php
- /**
- * PHPExcel
- *
- * Copyright (c) 2006 - 2007 PHPExcel, Maarten Balliauw
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * @category PHPExcel
- * @package PHPExcel_Style
- * @copyright Copyright (c) 2006 - 2007 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/gpl.txt GPL
- */
- /** PHPExcel_Style_Color */
- require_once 'PHPExcel/Style/Color.php';
- /** PHPExcel_IComparable */
- require_once 'PHPExcel/IComparable.php';
- /**
- * PHPExcel_Style_Border
- *
- * @category PHPExcel
- * @package PHPExcel_Style
- * @copyright Copyright (c) 2006 - 2007 PHPExcel (http://www.codeplex.com/PHPExcel)
- */
- class PHPExcel_Style_Border implements PHPExcel_IComparable
- {
- /* Border style */
- const BORDER_NONE = 'none';
- const BORDER_DASHDOT = 'dashDot';
- const BORDER_DASHDOTDOT = 'dashDotDot';
- const BORDER_DASHED = 'dashed';
- const BORDER_DOTTED = 'dotted';
- const BORDER_DOUBLE = 'double';
- const BORDER_HAIR = 'hair';
- const BORDER_MEDIUM = 'medium';
- const BORDER_MEDIUMDASHDOT = 'mediumDashDot';
- const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot';
- const BORDER_MEDIUMDASHED = 'mediumDashed';
- const BORDER_SLANTDASHDOT = 'slantDashDot';
- const BORDER_THICK = 'thick';
- const BORDER_THIN = 'thin';
-
- /**
- * Border style
- *
- * @var string
- */
- private $_borderStyle;
-
- /**
- * Border color
- *
- * @var PHPExcel_Style_Color
- */
- private $_borderColor;
-
- /**
- * Create a new PHPExcel_Style_Border
- */
- public function __construct()
- {
- // Initialise values
- $this->_borderStyle = PHPExcel_Style_Border::BORDER_NONE;
- $this->_borderColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
- }
-
- /**
- * Get Border style
- *
- * @return string
- */
- public function getBorderStyle() {
- return $this->_borderStyle;
- }
-
- /**
- * Set Border style
- *
- * @param string $pValue
- */
- public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE) {
- $this->_borderStyle = $pValue;
- }
-
- /**
- * Get Border Color
- *
- * @return PHPExcel_Style_Color
- */
- public function getColor() {
- return $this->_borderColor;
- }
-
- /**
- * Set Border Color
- *
- * @param PHPExcel_Style_Color $pValue
- * @throws Exception
- */
- public function setColor($pValue = null) {
- if ($pValue instanceof PHPExcel_Style_Color) {
- $this->_borderColor = $pValue;
- } else {
- throw new Exception("Invalid PHPExcel_Style_Color passed.");
- }
- }
-
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- $this->_borderStyle
- . $this->_borderColor->getHashCode()
- . __CLASS__
- );
- }
-
- /**
- * Duplicate object
- *
- * Duplicates the current object, also duplicating referenced objects (deep cloning).
- * Standard PHP clone does not copy referenced objects!
- *
- * @return PHPExcel_Style_Border
- */
- public function duplicate() {
- return unserialize(serialize($this));
- }
- }