Refactor: Remove some duplication found by phpcpd. One more to go.

This commit is contained in:
Ivan Lanin 2014-04-28 23:33:26 +07:00
parent b4c22982cb
commit 1ed8f0dfc2
9 changed files with 381 additions and 943 deletions

View File

@ -9,13 +9,10 @@
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph;
/**
* Check box element
*/
class CheckBox extends AbstractElement
class CheckBox extends Text
{
/**
* Name content
@ -25,118 +22,30 @@ class CheckBox extends AbstractElement
private $name;
/**
* Text content
*
* @var string
*/
private $text;
/**
* Text style
*
* @var string|\PhpOffice\PhpWord\Style\Font
*/
private $fontStyle;
/**
* Paragraph style
*
* @var string|\PhpOffice\PhpWord\Style\Paragraph
*/
private $paragraphStyle;
/**
* Create a new Text Element
* Create new instance
*
* @param string $name
* @param string $text
* @param mixed $fontStyle
* @param mixed $paragraphStyle
* @return self
*/
public function __construct($name = null, $text = null, $fontStyle = null, $paragraphStyle = null)
{
$this->setName($name);
$this->setText($text);
$paragraphStyle = $this->setParagraphStyle($paragraphStyle);
$this->setFontStyle($fontStyle, $paragraphStyle);
return $this;
}
/**
* Set Text style
*
* @param mixed $style
* @param mixed $paragraphStyle
* @return string|\PhpOffice\PhpWord\Style\Font
*/
public function setFontStyle($style = null, $paragraphStyle = null)
{
if ($style instanceof Font) {
$this->fontStyle = $style;
$this->setParagraphStyle($paragraphStyle);
} elseif (is_array($style)) {
$this->fontStyle = new Font('text', $paragraphStyle);
$this->fontStyle->setArrayStyle($style);
} elseif (null === $style) {
$this->fontStyle = new Font('text', $paragraphStyle);
} else {
$this->fontStyle = $style;
$this->setParagraphStyle($paragraphStyle);
}
return $this->fontStyle;
}
/**
* Get Text style
*
* @return string|\PhpOffice\PhpWord\Style\Font
*/
public function getFontStyle()
{
return $this->fontStyle;
}
/**
* Set Paragraph style
*
* @param mixed $style
* @return string|\PhpOffice\PhpWord\Style\Paragraph
*/
public function setParagraphStyle($style = null)
{
if (is_array($style)) {
$this->paragraphStyle = new Paragraph;
$this->paragraphStyle->setArrayStyle($style);
} elseif ($style instanceof Paragraph) {
$this->paragraphStyle = $style;
} elseif (null === $style) {
$this->paragraphStyle = new Paragraph;
} else {
$this->paragraphStyle = $style;
}
return $this->paragraphStyle;
}
/**
* Get Paragraph style
*
* @return string|\PhpOffice\PhpWord\Style\Paragraph
*/
public function getParagraphStyle()
{
return $this->paragraphStyle;
parent::__construct($text, $fontStyle, $paragraphStyle);
}
/**
* Set name content
*
* @param string $name
* @return $this
* @return self
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
@ -149,26 +58,4 @@ class CheckBox extends AbstractElement
{
return $this->name;
}
/**
* Set text content
*
* @param string $text
* @return $this
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text content
*
* @return string
*/
public function getText()
{
return $this->text;
}
}

View File

@ -109,6 +109,7 @@ class Link extends AbstractElement
*
* @return string
* @deprecated 0.10.0
* @codeCoverageIgnore
*/
public function getLinkSrc()
{
@ -120,6 +121,7 @@ class Link extends AbstractElement
*
* @return string
* @deprecated 0.10.0
* @codeCoverageIgnore
*/
public function getLinkName()
{

View File

@ -22,21 +22,21 @@ class Text extends AbstractElement
*
* @var string
*/
private $text;
protected $text;
/**
* Text style
*
* @var string|\PhpOffice\PhpWord\Style\Font
*/
private $fontStyle;
protected $fontStyle;
/**
* Paragraph style
*
* @var string|\PhpOffice\PhpWord\Style\Paragraph
*/
private $paragraphStyle;
protected $paragraphStyle;
/**
* Create a new Text Element
@ -73,6 +73,7 @@ class Text extends AbstractElement
$this->fontStyle = $style;
$this->setParagraphStyle($paragraphStyle);
}
return $this->fontStyle;
}
@ -104,6 +105,7 @@ class Text extends AbstractElement
} else {
$this->paragraphStyle = $style;
}
return $this->paragraphStyle;
}
@ -121,11 +123,12 @@ class Text extends AbstractElement
* Set text content
*
* @param string $text
* @return $this
* @return self
*/
public function setText($text)
{
$this->text = $text;
return $this;
}

View File

@ -117,6 +117,22 @@ abstract class AbstractStyle
return $this;
}
/**
* Set boolean value
*
* @param mixed $value
* @param mixed $default
* @return mixed
*/
protected function setNonEmptyVal($value, $default)
{
if (is_null($value) || $value == '') {
$value = $default;
}
return $value;
}
/**
* Set boolean value
*
@ -133,6 +149,22 @@ abstract class AbstractStyle
return $value;
}
/**
* Set numeric value
*
* @param mixed $value
* @param integer|float|null $default
* @return integer|float|null
*/
protected function setNumericVal($value, $default = null)
{
if (!is_numeric($value)) {
$value = $default;
}
return $value;
}
/**
* Set integer value
*

View File

@ -0,0 +1,268 @@
<?php
/**
* PHPWord
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
*/
namespace PhpOffice\PhpWord\Style;
/**
* Border style
*/
class Border extends AbstractStyle
{
/**
* Border Top Size
*
* @var int
*/
protected $borderTopSize;
/**
* Border Top Color
*
* @var string
*/
protected $borderTopColor;
/**
* Border Left Size
*
* @var int
*/
protected $borderLeftSize;
/**
* Border Left Color
*
* @var string
*/
protected $borderLeftColor;
/**
* Border Right Size
*
* @var int
*/
protected $borderRightSize;
/**
* Border Right Color
*
* @var string
*/
protected $borderRightColor;
/**
* Border Bottom Size
*
* @var int
*/
protected $borderBottomSize;
/**
* Border Bottom Color
*
* @var string
*/
protected $borderBottomColor;
/**
* Set border size
*
* @param int $pValue
*/
public function setBorderSize($pValue = null)
{
$this->borderTopSize = $pValue;
$this->borderLeftSize = $pValue;
$this->borderRightSize = $pValue;
$this->borderBottomSize = $pValue;
}
/**
* Get border size
*/
public function getBorderSize()
{
$top = $this->getBorderTopSize();
$left = $this->getBorderLeftSize();
$right = $this->getBorderRightSize();
$bottom = $this->getBorderBottomSize();
return array($top, $left, $right, $bottom);
}
/**
* Set border color
*
* @param string $pValue
*/
public function setBorderColor($pValue = null)
{
$this->borderTopColor = $pValue;
$this->borderLeftColor = $pValue;
$this->borderRightColor = $pValue;
$this->borderBottomColor = $pValue;
}
/**
* Get border color
*/
public function getBorderColor()
{
$top = $this->getBorderTopColor();
$left = $this->getBorderLeftColor();
$right = $this->getBorderRightColor();
$bottom = $this->getBorderBottomColor();
return array($top, $left, $right, $bottom);
}
/**
* Set border top size
*
* @param int $pValue
*/
public function setBorderTopSize($pValue = null)
{
$this->borderTopSize = $pValue;
}
/**
* Get border top size
*/
public function getBorderTopSize()
{
return $this->borderTopSize;
}
/**
* Set border top color
*
* @param string $pValue
*/
public function setBorderTopColor($pValue = null)
{
$this->borderTopColor = $pValue;
}
/**
* Get border top color
*/
public function getBorderTopColor()
{
return $this->borderTopColor;
}
/**
* Set border left size
*
* @param int $pValue
*/
public function setBorderLeftSize($pValue = null)
{
$this->borderLeftSize = $pValue;
}
/**
* Get border left size
*/
public function getBorderLeftSize()
{
return $this->borderLeftSize;
}
/**
* Set border left color
*
* @param string $pValue
*/
public function setBorderLeftColor($pValue = null)
{
$this->borderLeftColor = $pValue;
}
/**
* Get border left color
*/
public function getBorderLeftColor()
{
return $this->borderLeftColor;
}
/**
* Set border right size
*
* @param int $pValue
*/
public function setBorderRightSize($pValue = null)
{
$this->borderRightSize = $pValue;
}
/**
* Get border right size
*/
public function getBorderRightSize()
{
return $this->borderRightSize;
}
/**
* Set border right color
*
* @param string $pValue
*/
public function setBorderRightColor($pValue = null)
{
$this->borderRightColor = $pValue;
}
/**
* Get border right color
*/
public function getBorderRightColor()
{
return $this->borderRightColor;
}
/**
* Set border bottom size
*
* @param int $pValue
*/
public function setBorderBottomSize($pValue = null)
{
$this->borderBottomSize = $pValue;
}
/**
* Get border bottom size
*/
public function getBorderBottomSize()
{
return $this->borderBottomSize;
}
/**
* Set border bottom color
*
* @param string $pValue
*/
public function setBorderBottomColor($pValue = null)
{
$this->borderBottomColor = $pValue;
}
/**
* Get border bottom color
*/
public function getBorderBottomColor()
{
return $this->borderBottomColor;
}
}

View File

@ -14,7 +14,7 @@ use PhpOffice\PhpWord\Shared\String;
/**
* Table cell style
*/
class Cell extends AbstractStyle
class Cell extends Border
{
const TEXT_DIR_BTLR = 'btLr';
const TEXT_DIR_TBRL = 'tbRl';
@ -40,62 +40,6 @@ class Cell extends AbstractStyle
*/
private $bgColor;
/**
* Border Top Size
*
* @var int
*/
private $borderTopSize;
/**
* Border Top Color
*
* @var string
*/
private $borderTopColor;
/**
* Border Left Size
*
* @var int
*/
private $borderLeftSize;
/**
* Border Left Color
*
* @var string
*/
private $borderLeftColor;
/**
* Border Right Size
*
* @var int
*/
private $borderRightSize;
/**
* Border Right Color
*
* @var string
*/
private $borderRightColor;
/**
* Border Bottom Size
*
* @var int
*/
private $borderBottomSize;
/**
* Border Bottom Color
*
* @var string
*/
private $borderBottomColor;
/**
* Border Default Color
*
@ -211,202 +155,6 @@ class Cell extends AbstractStyle
$this->bgColor = $pValue;
}
/**
* Set border size
*
* @param int $pValue
*/
public function setBorderSize($pValue = null)
{
$this->borderTopSize = $pValue;
$this->borderLeftSize = $pValue;
$this->borderRightSize = $pValue;
$this->borderBottomSize = $pValue;
}
/**
* Get border size
*/
public function getBorderSize()
{
$top = $this->getBorderTopSize();
$left = $this->getBorderLeftSize();
$right = $this->getBorderRightSize();
$bottom = $this->getBorderBottomSize();
return array($top, $left, $right, $bottom);
}
/**
* Set border color
*
* @param string $pValue
*/
public function setBorderColor($pValue = null)
{
$this->borderTopColor = $pValue;
$this->borderLeftColor = $pValue;
$this->borderRightColor = $pValue;
$this->borderBottomColor = $pValue;
}
/**
* Get border color
*/
public function getBorderColor()
{
$top = $this->getBorderTopColor();
$left = $this->getBorderLeftColor();
$right = $this->getBorderRightColor();
$bottom = $this->getBorderBottomColor();
return array($top, $left, $right, $bottom);
}
/**
* Set border top size
*
* @param int $pValue
*/
public function setBorderTopSize($pValue = null)
{
$this->borderTopSize = $pValue;
}
/**
* Get border top size
*/
public function getBorderTopSize()
{
return $this->borderTopSize;
}
/**
* Set border top color
*
* @param string $pValue
*/
public function setBorderTopColor($pValue = null)
{
$this->borderTopColor = $pValue;
}
/**
* Get border top color
*/
public function getBorderTopColor()
{
return $this->borderTopColor;
}
/**
* Set border left size
*
* @param int $pValue
*/
public function setBorderLeftSize($pValue = null)
{
$this->borderLeftSize = $pValue;
}
/**
* Get border left size
*/
public function getBorderLeftSize()
{
return $this->borderLeftSize;
}
/**
* Set border left color
*
* @param string $pValue
*/
public function setBorderLeftColor($pValue = null)
{
$this->borderLeftColor = $pValue;
}
/**
* Get border left color
*/
public function getBorderLeftColor()
{
return $this->borderLeftColor;
}
/**
* Set border right size
*
* @param int $pValue
*/
public function setBorderRightSize($pValue = null)
{
$this->borderRightSize = $pValue;
}
/**
* Get border right size
*/
public function getBorderRightSize()
{
return $this->borderRightSize;
}
/**
* Set border right color
*
* @param string $pValue
*/
public function setBorderRightColor($pValue = null)
{
$this->borderRightColor = $pValue;
}
/**
* Get border right color
*/
public function getBorderRightColor()
{
return $this->borderRightColor;
}
/**
* Set border bottom size
*
* @param int $pValue
*/
public function setBorderBottomSize($pValue = null)
{
$this->borderBottomSize = $pValue;
}
/**
* Get border bottom size
*/
public function getBorderBottomSize()
{
return $this->borderBottomSize;
}
/**
* Set border bottom color
*
* @param string $pValue
*/
public function setBorderBottomColor($pValue = null)
{
$this->borderBottomColor = $pValue;
}
/**
* Get border bottom color
*/
public function getBorderBottomColor()
{
return $this->borderBottomColor;
}
/**
* Get default border color
*/

View File

@ -213,15 +213,13 @@ class Font extends AbstractStyle
/**
* Set font name
*
* @param string $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param string $value
* @return self
*/
public function setName($pValue = PhpWord::DEFAULT_FONT_NAME)
public function setName($value = PhpWord::DEFAULT_FONT_NAME)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_NAME;
}
$this->name = $pValue;
$this->name = $this->setNonEmptyVal($value, PhpWord::DEFAULT_FONT_NAME);
return $this;
}
@ -239,15 +237,13 @@ class Font extends AbstractStyle
/**
* Set font size
*
* @param int|float $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param int|float $value
* @return self
*/
public function setSize($pValue = PhpWord::DEFAULT_FONT_SIZE)
public function setSize($value = PhpWord::DEFAULT_FONT_SIZE)
{
if (!is_numeric($pValue)) {
$pValue = PhpWord::DEFAULT_FONT_SIZE;
}
$this->size = $pValue;
$this->size = $this->setNumericVal($value, PhpWord::DEFAULT_FONT_SIZE);
return $this;
}
@ -264,15 +260,13 @@ class Font extends AbstractStyle
/**
* Set bold
*
* @param bool $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param bool $value
* @return self
*/
public function setBold($pValue = false)
public function setBold($value = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
$this->bold = $pValue;
$this->bold = $this->setBoolVal($value, $this->bold);
return $this;
}
@ -289,15 +283,13 @@ class Font extends AbstractStyle
/**
* Set italic
*
* @param bool $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param bool $value
* @return self
*/
public function setItalic($pValue = false)
public function setItalic($value = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
$this->italic = $pValue;
$this->italic = $this->setBoolVal($value, $this->italic);
return $this;
}
@ -314,16 +306,16 @@ class Font extends AbstractStyle
/**
* Set superscript
*
* @param bool $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param bool $value
* @return self
*/
public function setSuperScript($pValue = false)
public function setSuperScript($value = false)
{
if (!is_bool($pValue)) {
$pValue = false;
$this->superScript = $this->setBoolVal($value, $this->superScript);
if ($this->superScript) {
$this->subScript = false;
}
$this->superScript = $pValue;
$this->subScript = !$pValue;
return $this;
}
@ -340,16 +332,16 @@ class Font extends AbstractStyle
/**
* Set subscript
*
* @param bool $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param bool $value
* @return self
*/
public function setSubScript($pValue = false)
public function setSubScript($value = false)
{
if (!is_bool($pValue)) {
$pValue = false;
$this->subScript = $this->setBoolVal($value, $this->subScript);
if ($this->subScript) {
$this->superScript = false;
}
$this->subScript = $pValue;
$this->superScript = !$pValue;
return $this;
}
@ -366,15 +358,13 @@ class Font extends AbstractStyle
/**
* Set underline
*
* @param string $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param string $value
* @return self
*/
public function setUnderline($pValue = self::UNDERLINE_NONE)
public function setUnderline($value = self::UNDERLINE_NONE)
{
if ($pValue == '') {
$pValue = self::UNDERLINE_NONE;
}
$this->underline = $pValue;
$this->underline = $this->setNonEmptyVal($value, self::UNDERLINE_NONE);
return $this;
}
@ -391,15 +381,13 @@ class Font extends AbstractStyle
/**
* Set strikethrough
*
* @param bool $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param bool $value
* @return self
*/
public function setStrikethrough($pValue = false)
public function setStrikethrough($value = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
$this->strikethrough = $pValue;
$this->strikethrough = $this->setBoolVal($value, $this->strikethrough);
return $this;
}
@ -416,15 +404,13 @@ class Font extends AbstractStyle
/**
* Set font color
*
* @param string $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param string $value
* @return self
*/
public function setColor($pValue = PhpWord::DEFAULT_FONT_COLOR)
public function setColor($value = PhpWord::DEFAULT_FONT_COLOR)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_COLOR;
}
$this->color = $pValue;
$this->color = $this->setNonEmptyVal($value, PhpWord::DEFAULT_FONT_COLOR);
return $this;
}
@ -441,12 +427,13 @@ class Font extends AbstractStyle
/**
* Set foreground/highlight color
*
* @param string $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param string $value
* @return self
*/
public function setFgColor($pValue = null)
public function setFgColor($value = null)
{
$this->fgColor = $pValue;
$this->fgColor = $value;
return $this;
}
@ -463,12 +450,13 @@ class Font extends AbstractStyle
/**
* Set background color
*
* @param string $pValue
* @param string $value
* @return $this
*/
public function setBgColor($pValue = null)
public function setBgColor($value = null)
{
$this->bgColor = $pValue;
$this->bgColor = $value;
return $this;
}
@ -537,15 +525,13 @@ class Font extends AbstractStyle
/**
* Set Font Content Type
*
* @param string $pValue
* @return \PhpOffice\PhpWord\Style\Font
* @param string $value
* @return self
*/
public function setHint($pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE)
public function setHint($value = PhpWord::DEFAULT_FONT_CONTENT_TYPE)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
}
$this->hint = $pValue;
$this->hint = $this->setNonEmptyVal($value, PhpWord::DEFAULT_FONT_CONTENT_TYPE);
return $this;
}
}

View File

@ -14,7 +14,7 @@ use PhpOffice\PhpWord\Shared\String;
/**
* Section settings
*/
class Section extends AbstractStyle
class Section extends Border
{
/**
* Default Page Size Width
@ -79,62 +79,6 @@ class Section extends AbstractStyle
*/
private $pageSizeH;
/**
* Page Border Top Size
*
* @var int
*/
private $borderTopSize;
/**
* Page Border Top Color
*
* @var int
*/
private $borderTopColor;
/**
* Page Border Left Size
*
* @var int
*/
private $borderLeftSize;
/**
* Page Border Left Color
*
* @var int
*/
private $borderLeftColor;
/**
* Page Border Right Size
*
* @var int
*/
private $borderRightSize;
/**
* Page Border Right Color
*
* @var int
*/
private $borderRightColor;
/**
* Page Border Bottom Size
*
* @var int
*/
private $borderBottomSize;
/**
* Page Border Bottom Color
*
* @var int
*/
private $borderBottomColor;
/**
* Page Numbering Start
*
@ -370,222 +314,6 @@ class Section extends AbstractStyle
return $this->orientation;
}
/**
* Set Border Size
*
* @param int $pValue
*/
public function setBorderSize($pValue = null)
{
$this->borderTopSize = $pValue;
$this->borderLeftSize = $pValue;
$this->borderRightSize = $pValue;
$this->borderBottomSize = $pValue;
}
/**
* Get Border Size
*
* @return array
*/
public function getBorderSize()
{
$top = $this->getBorderTopSize();
$left = $this->getBorderLeftSize();
$right = $this->getBorderRightSize();
$bottom = $this->getBorderBottomSize();
return array($top, $left, $right, $bottom);
}
/**
* Set Border Color
*
* @param string $pValue
*/
public function setBorderColor($pValue = null)
{
$this->borderTopColor = $pValue;
$this->borderLeftColor = $pValue;
$this->borderRightColor = $pValue;
$this->borderBottomColor = $pValue;
}
/**
* Get Border Color
*
* @return array
*/
public function getBorderColor()
{
$top = $this->getBorderTopColor();
$left = $this->getBorderLeftColor();
$right = $this->getBorderRightColor();
$bottom = $this->getBorderBottomColor();
return array($top, $left, $right, $bottom);
}
/**
* Set Border Top Size
*
* @param int $pValue
*/
public function setBorderTopSize($pValue = null)
{
$this->borderTopSize = $pValue;
}
/**
* Get Border Top Size
*
* @return int
*/
public function getBorderTopSize()
{
return $this->borderTopSize;
}
/**
* Set Border Top Color
*
* @param string $pValue
*/
public function setBorderTopColor($pValue = null)
{
$this->borderTopColor = $pValue;
}
/**
* Get Border Top Color
*
* @return string
*/
public function getBorderTopColor()
{
return $this->borderTopColor;
}
/**
* Set Border Left Size
*
* @param int $pValue
*/
public function setBorderLeftSize($pValue = null)
{
$this->borderLeftSize = $pValue;
}
/**
* Get Border Left Size
*
* @return int
*/
public function getBorderLeftSize()
{
return $this->borderLeftSize;
}
/**
* Set Border Left Color
*
* @param string $pValue
*/
public function setBorderLeftColor($pValue = null)
{
$this->borderLeftColor = $pValue;
}
/**
* Get Border Left Color
*
* @return string
*/
public function getBorderLeftColor()
{
return $this->borderLeftColor;
}
/**
* Set Border Right Size
*
* @param int $pValue
*/
public function setBorderRightSize($pValue = null)
{
$this->borderRightSize = $pValue;
}
/**
* Get Border Right Size
*
* @return int
*/
public function getBorderRightSize()
{
return $this->borderRightSize;
}
/**
* Set Border Right Color
*
* @param string $pValue
*/
public function setBorderRightColor($pValue = null)
{
$this->borderRightColor = $pValue;
}
/**
* Get Border Right Color
*
* @return string
*/
public function getBorderRightColor()
{
return $this->borderRightColor;
}
/**
* Set Border Bottom Size
*
* @param int $pValue
*/
public function setBorderBottomSize($pValue = null)
{
$this->borderBottomSize = $pValue;
}
/**
* Get Border Bottom Size
*
* @return int
*/
public function getBorderBottomSize()
{
return $this->borderBottomSize;
}
/**
* Set Border Bottom Color
*
* @param string $pValue
*/
public function setBorderBottomColor($pValue = null)
{
$this->borderBottomColor = $pValue;
}
/**
* Get Border Bottom Color
*
* @return string
*/
public function getBorderBottomColor()
{
return $this->borderBottomColor;
}
/**
* Set page numbering start
*

View File

@ -14,7 +14,7 @@ use PhpOffice\PhpWord\Shared\String;
/**
* Table style
*/
class Table extends AbstractStyle
class Table extends Border
{
/**
* Style for first row
@ -58,62 +58,6 @@ class Table extends AbstractStyle
*/
private $bgColor;
/**
* Border size top
*
* @var int
*/
private $borderTopSize;
/**
* Border color
*
* @var string top
*/
private $borderTopColor;
/**
* Border size left
*
* @var int
*/
private $borderLeftSize;
/**
* Border color left
*
* @var string
*/
private $borderLeftColor;
/**
* Border size right
*
* @var int
*/
private $borderRightSize;
/**
* Border color right
*
* @var string
*/
private $borderRightColor;
/**
* Border size bottom
*
* @var int
*/
private $borderBottomSize;
/**
* Border color bottom
*
* @var string
*/
private $borderBottomColor;
/**
* Border size inside horizontal
*
@ -288,166 +232,6 @@ class Table extends AbstractStyle
return array($top, $left, $right, $bottom, $insideH, $insideV);
}
/**
* Set border size top
*
* @param $pValue
*/
public function setBorderTopSize($pValue = null)
{
$this->borderTopSize = $pValue;
}
/**
* Get border size top
*
* @return
*/
public function getBorderTopSize()
{
return $this->borderTopSize;
}
/**
* Set border color top
*
* @param $pValue
*/
public function setBorderTopColor($pValue = null)
{
$this->borderTopColor = $pValue;
}
/**
* Get border color top
*
* @return
*/
public function getBorderTopColor()
{
return $this->borderTopColor;
}
/**
* Set border size left
*
* @param $pValue
*/
public function setBorderLeftSize($pValue = null)
{
$this->borderLeftSize = $pValue;
}
/**
* Get border size left
*
* @return
*/
public function getBorderLeftSize()
{
return $this->borderLeftSize;
}
/**
* Set border color left
*
* @param $pValue
*/
public function setBorderLeftColor($pValue = null)
{
$this->borderLeftColor = $pValue;
}
/**
* Get border color left
*
* @return
*/
public function getBorderLeftColor()
{
return $this->borderLeftColor;
}
/**
* Set border size right
*
* @param $pValue
*/
public function setBorderRightSize($pValue = null)
{
$this->borderRightSize = $pValue;
}
/**
* Get border size right
*
* @return
*/
public function getBorderRightSize()
{
return $this->borderRightSize;
}
/**
* Set border color right
*
* @param $pValue
*/
public function setBorderRightColor($pValue = null)
{
$this->borderRightColor = $pValue;
}
/**
* Get border color right
*
* @return
*/
public function getBorderRightColor()
{
return $this->borderRightColor;
}
/**
* Set border size bottom
*
* @param $pValue
*/
public function setBorderBottomSize($pValue = null)
{
$this->borderBottomSize = $pValue;
}
/**
* Get border size bottom
*
* @return
*/
public function getBorderBottomSize()
{
return $this->borderBottomSize;
}
/**
* Set border color bottom
*
* @param $pValue
*/
public function setBorderBottomColor($pValue = null)
{
$this->borderBottomColor = $pValue;
}
/**
* Get border color bottom
*
* @return
*/
public function getBorderBottomColor()
{
return $this->borderBottomColor;
}
/**
* Set border color inside horizontal
*