Remove underscore prefix from all private properties name

This commit is contained in:
Ivan Lanin 2014-04-06 18:03:03 +07:00
parent a218202dbd
commit 177c523799
24 changed files with 446 additions and 423 deletions

View File

@ -55,6 +55,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers
- Container: Create new Container abstract class - @ivanlanin GH-187 - Container: Create new Container abstract class - @ivanlanin GH-187
- Element: Create new Element abstract class - @ivanlanin GH-187 - Element: Create new Element abstract class - @ivanlanin GH-187
- Media: Refactor media class to use one method for all docPart (section, header, footer, footnote) - @ivanlanin GH-187 - Media: Refactor media class to use one method for all docPart (section, header, footer, footnote) - @ivanlanin GH-187
- General: Remove underscore prefix from all private properties name
## 0.9.1 - 27 Mar 2014 ## 0.9.1 - 27 Mar 2014

View File

@ -66,8 +66,8 @@ class Section extends Container
{ {
if (!is_null($settings) && is_array($settings)) { if (!is_null($settings) && is_array($settings)) {
foreach ($settings as $key => $value) { foreach ($settings as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$this->settings->setSettingValue($key, $value); $this->settings->setSettingValue($key, $value);
} }

View File

@ -19,119 +19,119 @@ class Settings
* *
* @var int * @var int
*/ */
private $_defaultPageSizeW = 11906; private $defaultPageSizeW = 11906;
/** /**
* Default Page Size Height * Default Page Size Height
* *
* @var int * @var int
*/ */
private $_defaultPageSizeH = 16838; private $defaultPageSizeH = 16838;
/** /**
* Page Orientation * Page Orientation
* *
* @var string * @var string
*/ */
private $_orientation; private $orientation;
/** /**
* Page Margin Top * Page Margin Top
* *
* @var int * @var int
*/ */
private $_marginTop; private $marginTop;
/** /**
* Page Margin Left * Page Margin Left
* *
* @var int * @var int
*/ */
private $_marginLeft; private $marginLeft;
/** /**
* Page Margin Right * Page Margin Right
* *
* @var int * @var int
*/ */
private $_marginRight; private $marginRight;
/** /**
* Page Margin Bottom * Page Margin Bottom
* *
* @var int * @var int
*/ */
private $_marginBottom; private $marginBottom;
/** /**
* Page Size Width * Page Size Width
* *
* @var int * @var int
*/ */
private $_pageSizeW; private $pageSizeW;
/** /**
* Page Size Height * Page Size Height
* *
* @var int * @var int
*/ */
private $_pageSizeH; private $pageSizeH;
/** /**
* Page Border Top Size * Page Border Top Size
* *
* @var int * @var int
*/ */
private $_borderTopSize; private $borderTopSize;
/** /**
* Page Border Top Color * Page Border Top Color
* *
* @var int * @var int
*/ */
private $_borderTopColor; private $borderTopColor;
/** /**
* Page Border Left Size * Page Border Left Size
* *
* @var int * @var int
*/ */
private $_borderLeftSize; private $borderLeftSize;
/** /**
* Page Border Left Color * Page Border Left Color
* *
* @var int * @var int
*/ */
private $_borderLeftColor; private $borderLeftColor;
/** /**
* Page Border Right Size * Page Border Right Size
* *
* @var int * @var int
*/ */
private $_borderRightSize; private $borderRightSize;
/** /**
* Page Border Right Color * Page Border Right Color
* *
* @var int * @var int
*/ */
private $_borderRightColor; private $borderRightColor;
/** /**
* Page Border Bottom Size * Page Border Bottom Size
* *
* @var int * @var int
*/ */
private $_borderBottomSize; private $borderBottomSize;
/** /**
* Page Border Bottom Color * Page Border Bottom Color
* *
* @var int * @var int
*/ */
private $_borderBottomColor; private $borderBottomColor;
/** /**
* Page Numbering Start * Page Numbering Start
@ -159,14 +159,14 @@ class Settings
* *
* @var int * @var int
*/ */
private $_colsNum; private $colsNum;
/** /**
* Section spacing between columns * Section spacing between columns
* *
* @var int * @var int
*/ */
private $_colsSpace; private $colsSpace;
/** /**
* Section break type * Section break type
@ -180,33 +180,33 @@ class Settings
* *
* @var string * @var string
*/ */
private $_breakType; private $breakType;
/** /**
* Create new Section Settings * Create new Section Settings
*/ */
public function __construct() public function __construct()
{ {
$this->_orientation = null; $this->orientation = null;
$this->_marginTop = 1418; $this->marginTop = 1418;
$this->_marginLeft = 1418; $this->marginLeft = 1418;
$this->_marginRight = 1418; $this->marginRight = 1418;
$this->_marginBottom = 1134; $this->marginBottom = 1134;
$this->_pageSizeW = $this->_defaultPageSizeW; $this->pageSizeW = $this->defaultPageSizeW;
$this->_pageSizeH = $this->_defaultPageSizeH; $this->pageSizeH = $this->defaultPageSizeH;
$this->_borderTopSize = null; $this->borderTopSize = null;
$this->_borderTopColor = null; $this->borderTopColor = null;
$this->_borderLeftSize = null; $this->borderLeftSize = null;
$this->_borderLeftColor = null; $this->borderLeftColor = null;
$this->_borderRightSize = null; $this->borderRightSize = null;
$this->_borderRightColor = null; $this->borderRightColor = null;
$this->_borderBottomSize = null; $this->borderBottomSize = null;
$this->_borderBottomColor = null; $this->borderBottomColor = null;
$this->headerHeight = 720; // set default header and footer to 720 twips (.5 inches) $this->headerHeight = 720; // set default header and footer to 720 twips (.5 inches)
$this->footerHeight = 720; $this->footerHeight = 720;
$this->_colsNum = 1; $this->colsNum = 1;
$this->_colsSpace = 720; $this->colsSpace = 720;
$this->_breakType = null; $this->breakType = null;
} }
/** /**
@ -217,13 +217,16 @@ class Settings
*/ */
public function setSettingValue($key, $value) public function setSettingValue($key, $value)
{ {
if ($key == '_orientation' && $value == 'landscape') { if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
if ($key == 'orientation' && $value == 'landscape') {
$this->setLandscape(); $this->setLandscape();
} elseif ($key == '_orientation' && is_null($value)) { } elseif ($key == 'orientation' && is_null($value)) {
$this->setPortrait(); $this->setPortrait();
} elseif ($key == '_borderSize') { } elseif ($key == 'borderSize') {
$this->setBorderSize($value); $this->setBorderSize($value);
} elseif ($key == '_borderColor') { } elseif ($key == 'borderColor') {
$this->setBorderColor($value); $this->setBorderColor($value);
} else { } else {
$this->$key = $value; $this->$key = $value;
@ -237,7 +240,7 @@ class Settings
*/ */
public function getMarginTop() public function getMarginTop()
{ {
return $this->_marginTop; return $this->marginTop;
} }
/** /**
@ -247,7 +250,7 @@ class Settings
*/ */
public function setMarginTop($pValue = '') public function setMarginTop($pValue = '')
{ {
$this->_marginTop = $pValue; $this->marginTop = $pValue;
return $this; return $this;
} }
@ -258,7 +261,7 @@ class Settings
*/ */
public function getMarginLeft() public function getMarginLeft()
{ {
return $this->_marginLeft; return $this->marginLeft;
} }
/** /**
@ -268,7 +271,7 @@ class Settings
*/ */
public function setMarginLeft($pValue = '') public function setMarginLeft($pValue = '')
{ {
$this->_marginLeft = $pValue; $this->marginLeft = $pValue;
return $this; return $this;
} }
@ -279,7 +282,7 @@ class Settings
*/ */
public function getMarginRight() public function getMarginRight()
{ {
return $this->_marginRight; return $this->marginRight;
} }
/** /**
@ -289,7 +292,7 @@ class Settings
*/ */
public function setMarginRight($pValue = '') public function setMarginRight($pValue = '')
{ {
$this->_marginRight = $pValue; $this->marginRight = $pValue;
return $this; return $this;
} }
@ -300,7 +303,7 @@ class Settings
*/ */
public function getMarginBottom() public function getMarginBottom()
{ {
return $this->_marginBottom; return $this->marginBottom;
} }
/** /**
@ -310,7 +313,7 @@ class Settings
*/ */
public function setMarginBottom($pValue = '') public function setMarginBottom($pValue = '')
{ {
$this->_marginBottom = $pValue; $this->marginBottom = $pValue;
return $this; return $this;
} }
@ -319,9 +322,9 @@ class Settings
*/ */
public function setLandscape() public function setLandscape()
{ {
$this->_orientation = 'landscape'; $this->orientation = 'landscape';
$this->_pageSizeW = $this->_defaultPageSizeH; $this->pageSizeW = $this->defaultPageSizeH;
$this->_pageSizeH = $this->_defaultPageSizeW; $this->pageSizeH = $this->defaultPageSizeW;
} }
/** /**
@ -329,9 +332,9 @@ class Settings
*/ */
public function setPortrait() public function setPortrait()
{ {
$this->_orientation = null; $this->orientation = null;
$this->_pageSizeW = $this->_defaultPageSizeW; $this->pageSizeW = $this->defaultPageSizeW;
$this->_pageSizeH = $this->_defaultPageSizeH; $this->pageSizeH = $this->defaultPageSizeH;
} }
/** /**
@ -341,7 +344,7 @@ class Settings
*/ */
public function getPageSizeW() public function getPageSizeW()
{ {
return $this->_pageSizeW; return $this->pageSizeW;
} }
/** /**
@ -351,7 +354,7 @@ class Settings
*/ */
public function getPageSizeH() public function getPageSizeH()
{ {
return $this->_pageSizeH; return $this->pageSizeH;
} }
/** /**
@ -361,7 +364,7 @@ class Settings
*/ */
public function getOrientation() public function getOrientation()
{ {
return $this->_orientation; return $this->orientation;
} }
/** /**
@ -371,10 +374,10 @@ class Settings
*/ */
public function setBorderSize($pValue = null) public function setBorderSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
} }
/** /**
@ -399,10 +402,10 @@ class Settings
*/ */
public function setBorderColor($pValue = null) public function setBorderColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
} }
/** /**
@ -427,7 +430,7 @@ class Settings
*/ */
public function setBorderTopSize($pValue = null) public function setBorderTopSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
} }
/** /**
@ -437,7 +440,7 @@ class Settings
*/ */
public function getBorderTopSize() public function getBorderTopSize()
{ {
return $this->_borderTopSize; return $this->borderTopSize;
} }
/** /**
@ -447,7 +450,7 @@ class Settings
*/ */
public function setBorderTopColor($pValue = null) public function setBorderTopColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
} }
/** /**
@ -457,7 +460,7 @@ class Settings
*/ */
public function getBorderTopColor() public function getBorderTopColor()
{ {
return $this->_borderTopColor; return $this->borderTopColor;
} }
/** /**
@ -467,7 +470,7 @@ class Settings
*/ */
public function setBorderLeftSize($pValue = null) public function setBorderLeftSize($pValue = null)
{ {
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
} }
/** /**
@ -477,7 +480,7 @@ class Settings
*/ */
public function getBorderLeftSize() public function getBorderLeftSize()
{ {
return $this->_borderLeftSize; return $this->borderLeftSize;
} }
/** /**
@ -487,7 +490,7 @@ class Settings
*/ */
public function setBorderLeftColor($pValue = null) public function setBorderLeftColor($pValue = null)
{ {
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
} }
/** /**
@ -497,7 +500,7 @@ class Settings
*/ */
public function getBorderLeftColor() public function getBorderLeftColor()
{ {
return $this->_borderLeftColor; return $this->borderLeftColor;
} }
/** /**
@ -507,7 +510,7 @@ class Settings
*/ */
public function setBorderRightSize($pValue = null) public function setBorderRightSize($pValue = null)
{ {
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
} }
/** /**
@ -517,7 +520,7 @@ class Settings
*/ */
public function getBorderRightSize() public function getBorderRightSize()
{ {
return $this->_borderRightSize; return $this->borderRightSize;
} }
/** /**
@ -527,7 +530,7 @@ class Settings
*/ */
public function setBorderRightColor($pValue = null) public function setBorderRightColor($pValue = null)
{ {
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
} }
/** /**
@ -537,7 +540,7 @@ class Settings
*/ */
public function getBorderRightColor() public function getBorderRightColor()
{ {
return $this->_borderRightColor; return $this->borderRightColor;
} }
/** /**
@ -547,7 +550,7 @@ class Settings
*/ */
public function setBorderBottomSize($pValue = null) public function setBorderBottomSize($pValue = null)
{ {
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
} }
/** /**
@ -557,7 +560,7 @@ class Settings
*/ */
public function getBorderBottomSize() public function getBorderBottomSize()
{ {
return $this->_borderBottomSize; return $this->borderBottomSize;
} }
/** /**
@ -567,7 +570,7 @@ class Settings
*/ */
public function setBorderBottomColor($pValue = null) public function setBorderBottomColor($pValue = null)
{ {
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
} }
/** /**
@ -577,7 +580,7 @@ class Settings
*/ */
public function getBorderBottomColor() public function getBorderBottomColor()
{ {
return $this->_borderBottomColor; return $this->borderBottomColor;
} }
/** /**
@ -660,7 +663,7 @@ class Settings
if (!is_numeric($pValue)) { if (!is_numeric($pValue)) {
$pValue = 1; $pValue = 1;
} }
$this->_colsNum = $pValue; $this->colsNum = $pValue;
return $this; return $this;
} }
@ -671,7 +674,7 @@ class Settings
*/ */
public function getColsNum() public function getColsNum()
{ {
return $this->_colsNum; return $this->colsNum;
} }
/** /**
@ -684,7 +687,7 @@ class Settings
if (!is_numeric($pValue)) { if (!is_numeric($pValue)) {
$pValue = 720; $pValue = 720;
} }
$this->_colsSpace = $pValue; $this->colsSpace = $pValue;
return $this; return $this;
} }
@ -695,7 +698,7 @@ class Settings
*/ */
public function getColsSpace() public function getColsSpace()
{ {
return $this->_colsSpace; return $this->colsSpace;
} }
/** /**
@ -705,7 +708,7 @@ class Settings
*/ */
public function setBreakType($pValue = null) public function setBreakType($pValue = null)
{ {
$this->_breakType = $pValue; $this->breakType = $pValue;
return $this; return $this;
} }
@ -716,6 +719,6 @@ class Settings
*/ */
public function getBreakType() public function getBreakType()
{ {
return $this->_breakType; return $this->breakType;
} }
} }

View File

@ -49,8 +49,8 @@ abstract class Element
{ {
if (!is_null($styleValue) && is_array($styleValue)) { if (!is_null($styleValue) && is_array($styleValue)) {
foreach ($styleValue as $key => $value) { foreach ($styleValue as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$styleObject->setStyleValue($key, $value); $styleObject->setStyleValue($key, $value);
} }

View File

@ -141,8 +141,8 @@ class Style
{ {
if (!array_key_exists($styleName, self::$styles)) { if (!array_key_exists($styleName, self::$styles)) {
foreach ($styleValues as $key => $value) { foreach ($styleValues as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$styleObject->setStyleValue($key, $value); $styleObject->setStyleValue($key, $value);
} }

View File

@ -22,91 +22,91 @@ class Cell
* *
* @var string * @var string
*/ */
private $_valign; private $valign;
/** /**
* Text Direction * Text Direction
* *
* @var string * @var string
*/ */
private $_textDirection; private $textDirection;
/** /**
* Background-Color * Background-Color
* *
* @var string * @var string
*/ */
private $_bgColor; private $bgColor;
/** /**
* Border Top Size * Border Top Size
* *
* @var int * @var int
*/ */
private $_borderTopSize; private $borderTopSize;
/** /**
* Border Top Color * Border Top Color
* *
* @var string * @var string
*/ */
private $_borderTopColor; private $borderTopColor;
/** /**
* Border Left Size * Border Left Size
* *
* @var int * @var int
*/ */
private $_borderLeftSize; private $borderLeftSize;
/** /**
* Border Left Color * Border Left Color
* *
* @var string * @var string
*/ */
private $_borderLeftColor; private $borderLeftColor;
/** /**
* Border Right Size * Border Right Size
* *
* @var int * @var int
*/ */
private $_borderRightSize; private $borderRightSize;
/** /**
* Border Right Color * Border Right Color
* *
* @var string * @var string
*/ */
private $_borderRightColor; private $borderRightColor;
/** /**
* Border Bottom Size * Border Bottom Size
* *
* @var int * @var int
*/ */
private $_borderBottomSize; private $borderBottomSize;
/** /**
* Border Bottom Color * Border Bottom Color
* *
* @var string * @var string
*/ */
private $_borderBottomColor; private $borderBottomColor;
/** /**
* Border Default Color * Border Default Color
* *
* @var string * @var string
*/ */
private $_defaultBorderColor; private $defaultBorderColor;
/** /**
* colspan * colspan
* *
* @var integer * @var integer
*/ */
private $_gridSpan = null; private $gridSpan = null;
/** /**
* rowspan (restart, continue) * rowspan (restart, continue)
@ -116,25 +116,25 @@ class Cell
* *
* @var string * @var string
*/ */
private $_vMerge = null; private $vMerge = null;
/** /**
* Create a new Cell Style * Create a new Cell Style
*/ */
public function __construct() public function __construct()
{ {
$this->_valign = null; $this->valign = null;
$this->_textDirection = null; $this->textDirection = null;
$this->_bgColor = null; $this->bgColor = null;
$this->_borderTopSize = null; $this->borderTopSize = null;
$this->_borderTopColor = null; $this->borderTopColor = null;
$this->_borderLeftSize = null; $this->borderLeftSize = null;
$this->_borderLeftColor = null; $this->borderLeftColor = null;
$this->_borderRightSize = null; $this->borderRightSize = null;
$this->_borderRightColor = null; $this->borderRightColor = null;
$this->_borderBottomSize = null; $this->borderBottomSize = null;
$this->_borderBottomColor = null; $this->borderBottomColor = null;
$this->_defaultBorderColor = '000000'; $this->defaultBorderColor = '000000';
} }
/** /**
@ -145,9 +145,12 @@ class Cell
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if ($key == '_borderSize') { if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
if ($key == 'borderSize') {
$this->setBorderSize($value); $this->setBorderSize($value);
} elseif ($key == '_borderColor') { } elseif ($key == 'borderColor') {
$this->setBorderColor($value); $this->setBorderColor($value);
} else { } else {
$this->$key = $value; $this->$key = $value;
@ -159,7 +162,7 @@ class Cell
*/ */
public function getVAlign() public function getVAlign()
{ {
return $this->_valign; return $this->valign;
} }
/** /**
@ -169,7 +172,7 @@ class Cell
*/ */
public function setVAlign($pValue = null) public function setVAlign($pValue = null)
{ {
$this->_valign = $pValue; $this->valign = $pValue;
} }
/** /**
@ -177,7 +180,7 @@ class Cell
*/ */
public function getTextDirection() public function getTextDirection()
{ {
return $this->_textDirection; return $this->textDirection;
} }
/** /**
@ -187,7 +190,7 @@ class Cell
*/ */
public function setTextDirection($pValue = null) public function setTextDirection($pValue = null)
{ {
$this->_textDirection = $pValue; $this->textDirection = $pValue;
} }
/** /**
@ -195,7 +198,7 @@ class Cell
*/ */
public function getBgColor() public function getBgColor()
{ {
return $this->_bgColor; return $this->bgColor;
} }
/** /**
@ -205,7 +208,7 @@ class Cell
*/ */
public function setBgColor($pValue = null) public function setBgColor($pValue = null)
{ {
$this->_bgColor = $pValue; $this->bgColor = $pValue;
} }
/** /**
@ -215,10 +218,10 @@ class Cell
*/ */
public function setBorderSize($pValue = null) public function setBorderSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
} }
/** /**
@ -241,10 +244,10 @@ class Cell
*/ */
public function setBorderColor($pValue = null) public function setBorderColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
} }
/** /**
@ -267,7 +270,7 @@ class Cell
*/ */
public function setBorderTopSize($pValue = null) public function setBorderTopSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
} }
/** /**
@ -275,7 +278,7 @@ class Cell
*/ */
public function getBorderTopSize() public function getBorderTopSize()
{ {
return $this->_borderTopSize; return $this->borderTopSize;
} }
/** /**
@ -285,7 +288,7 @@ class Cell
*/ */
public function setBorderTopColor($pValue = null) public function setBorderTopColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
} }
/** /**
@ -293,7 +296,7 @@ class Cell
*/ */
public function getBorderTopColor() public function getBorderTopColor()
{ {
return $this->_borderTopColor; return $this->borderTopColor;
} }
/** /**
@ -303,7 +306,7 @@ class Cell
*/ */
public function setBorderLeftSize($pValue = null) public function setBorderLeftSize($pValue = null)
{ {
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
} }
/** /**
@ -311,7 +314,7 @@ class Cell
*/ */
public function getBorderLeftSize() public function getBorderLeftSize()
{ {
return $this->_borderLeftSize; return $this->borderLeftSize;
} }
/** /**
@ -321,7 +324,7 @@ class Cell
*/ */
public function setBorderLeftColor($pValue = null) public function setBorderLeftColor($pValue = null)
{ {
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
} }
/** /**
@ -329,7 +332,7 @@ class Cell
*/ */
public function getBorderLeftColor() public function getBorderLeftColor()
{ {
return $this->_borderLeftColor; return $this->borderLeftColor;
} }
/** /**
@ -339,7 +342,7 @@ class Cell
*/ */
public function setBorderRightSize($pValue = null) public function setBorderRightSize($pValue = null)
{ {
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
} }
/** /**
@ -347,7 +350,7 @@ class Cell
*/ */
public function getBorderRightSize() public function getBorderRightSize()
{ {
return $this->_borderRightSize; return $this->borderRightSize;
} }
/** /**
@ -357,7 +360,7 @@ class Cell
*/ */
public function setBorderRightColor($pValue = null) public function setBorderRightColor($pValue = null)
{ {
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
} }
/** /**
@ -365,7 +368,7 @@ class Cell
*/ */
public function getBorderRightColor() public function getBorderRightColor()
{ {
return $this->_borderRightColor; return $this->borderRightColor;
} }
/** /**
@ -375,7 +378,7 @@ class Cell
*/ */
public function setBorderBottomSize($pValue = null) public function setBorderBottomSize($pValue = null)
{ {
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
} }
/** /**
@ -383,7 +386,7 @@ class Cell
*/ */
public function getBorderBottomSize() public function getBorderBottomSize()
{ {
return $this->_borderBottomSize; return $this->borderBottomSize;
} }
/** /**
@ -393,7 +396,7 @@ class Cell
*/ */
public function setBorderBottomColor($pValue = null) public function setBorderBottomColor($pValue = null)
{ {
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
} }
/** /**
@ -401,7 +404,7 @@ class Cell
*/ */
public function getBorderBottomColor() public function getBorderBottomColor()
{ {
return $this->_borderBottomColor; return $this->borderBottomColor;
} }
/** /**
@ -409,7 +412,7 @@ class Cell
*/ */
public function getDefaultBorderColor() public function getDefaultBorderColor()
{ {
return $this->_defaultBorderColor; return $this->defaultBorderColor;
} }
/** /**
@ -419,7 +422,7 @@ class Cell
*/ */
public function setGridSpan($pValue = null) public function setGridSpan($pValue = null)
{ {
$this->_gridSpan = $pValue; $this->gridSpan = $pValue;
} }
/** /**
@ -427,7 +430,7 @@ class Cell
*/ */
public function getGridSpan() public function getGridSpan()
{ {
return $this->_gridSpan; return $this->gridSpan;
} }
/** /**
@ -437,7 +440,7 @@ class Cell
*/ */
public function setVMerge($pValue = null) public function setVMerge($pValue = null)
{ {
$this->_vMerge = $pValue; $this->vMerge = $pValue;
} }
/** /**
@ -445,6 +448,6 @@ class Cell
*/ */
public function getVMerge() public function getVMerge()
{ {
return $this->_vMerge; return $this->vMerge;
} }
} }

View File

@ -56,91 +56,91 @@ class Font
* *
* @var string * @var string
*/ */
private $_type; private $type;
/** /**
* Paragraph style * Paragraph style
* *
* @var \PhpOffice\PhpWord\Style\Paragraph * @var \PhpOffice\PhpWord\Style\Paragraph
*/ */
private $_paragraphStyle; private $paragraphStyle;
/** /**
* Font name * Font name
* *
* @var int|float * @var int|float
*/ */
private $_name = PhpWord::DEFAULT_FONT_NAME; private $name = PhpWord::DEFAULT_FONT_NAME;
/** /**
* Font size * Font size
* *
* @var int|float * @var int|float
*/ */
private $_size = PhpWord::DEFAULT_FONT_SIZE; private $size = PhpWord::DEFAULT_FONT_SIZE;
/** /**
* Bold * Bold
* *
* @var bool * @var bool
*/ */
private $_bold = false; private $bold = false;
/** /**
* Italic * Italic
* *
* @var bool * @var bool
*/ */
private $_italic = false; private $italic = false;
/** /**
* Superscript * Superscript
* *
* @var bool * @var bool
*/ */
private $_superScript = false; private $superScript = false;
/** /**
* Subscript * Subscript
* *
* @var bool * @var bool
*/ */
private $_subScript = false; private $subScript = false;
/** /**
* Undeline * Undeline
* *
* @var string * @var string
*/ */
private $_underline = self::UNDERLINE_NONE; private $underline = self::UNDERLINE_NONE;
/** /**
* Strikethrough * Strikethrough
* *
* @var bool * @var bool
*/ */
private $_strikethrough = false; private $strikethrough = false;
/** /**
* Font color * Font color
* *
* @var string * @var string
*/ */
private $_color = PhpWord::DEFAULT_FONT_COLOR; private $color = PhpWord::DEFAULT_FONT_COLOR;
/** /**
* Foreground/highlight * Foreground/highlight
* *
* @var string * @var string
*/ */
private $_fgColor = null; private $fgColor = null;
/** /**
* Background color * Background color
* *
* @var string * @var string
*/ */
private $_bgColor = null; private $bgColor = null;
/** /**
* Text line height * Text line height
* *
@ -159,7 +159,7 @@ class Font
* *
* @var string * @var string
*/ */
private $_hint = PhpWord::DEFAULT_FONT_CONTENT_TYPE; private $hint = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
/** /**
* Create new font style * Create new font style
@ -169,15 +169,15 @@ class Font
*/ */
public function __construct($type = 'text', $paragraphStyle = null) public function __construct($type = 'text', $paragraphStyle = null)
{ {
$this->_type = $type; $this->type = $type;
if ($paragraphStyle instanceof Paragraph) { if ($paragraphStyle instanceof Paragraph) {
$this->_paragraphStyle = $paragraphStyle; $this->paragraphStyle = $paragraphStyle;
} elseif (is_array($paragraphStyle)) { } elseif (is_array($paragraphStyle)) {
$this->_paragraphStyle = new Paragraph; $this->paragraphStyle = new Paragraph;
$this->_paragraphStyle->setArrayStyle($paragraphStyle); $this->paragraphStyle->setArrayStyle($paragraphStyle);
} else { } else {
$this->_paragraphStyle = $paragraphStyle; $this->paragraphStyle = $paragraphStyle;
} }
} }
@ -193,8 +193,8 @@ class Font
if ($key === 'line-height') { if ($key === 'line-height') {
$this->setLineHeight($value); $this->setLineHeight($value);
null; null;
} elseif (substr($key, 0, 1) !== '_') { } elseif (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$this->setStyleValue($key, $value); $this->setStyleValue($key, $value);
} }
@ -210,7 +210,10 @@ class Font
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
$method = 'set' . substr($key, 1); if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$method = 'set' . $key;
if (method_exists($this, $method)) { if (method_exists($this, $method)) {
$this->$method($value); $this->$method($value);
} }
@ -223,7 +226,7 @@ class Font
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->name;
} }
/** /**
@ -237,7 +240,7 @@ class Font
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_NAME; $pValue = PhpWord::DEFAULT_FONT_NAME;
} }
$this->_name = $pValue; $this->name = $pValue;
return $this; return $this;
} }
@ -249,7 +252,7 @@ class Font
*/ */
public function getSize() public function getSize()
{ {
return $this->_size; return $this->size;
} }
/** /**
@ -263,7 +266,7 @@ class Font
if (!is_numeric($pValue)) { if (!is_numeric($pValue)) {
$pValue = PhpWord::DEFAULT_FONT_SIZE; $pValue = PhpWord::DEFAULT_FONT_SIZE;
} }
$this->_size = $pValue; $this->size = $pValue;
return $this; return $this;
} }
@ -274,7 +277,7 @@ class Font
*/ */
public function getBold() public function getBold()
{ {
return $this->_bold; return $this->bold;
} }
/** /**
@ -288,7 +291,7 @@ class Font
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_bold = $pValue; $this->bold = $pValue;
return $this; return $this;
} }
@ -299,7 +302,7 @@ class Font
*/ */
public function getItalic() public function getItalic()
{ {
return $this->_italic; return $this->italic;
} }
/** /**
@ -313,7 +316,7 @@ class Font
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_italic = $pValue; $this->italic = $pValue;
return $this; return $this;
} }
@ -324,7 +327,7 @@ class Font
*/ */
public function getSuperScript() public function getSuperScript()
{ {
return $this->_superScript; return $this->superScript;
} }
/** /**
@ -338,8 +341,8 @@ class Font
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_superScript = $pValue; $this->superScript = $pValue;
$this->_subScript = !$pValue; $this->subScript = !$pValue;
return $this; return $this;
} }
@ -350,7 +353,7 @@ class Font
*/ */
public function getSubScript() public function getSubScript()
{ {
return $this->_subScript; return $this->subScript;
} }
/** /**
@ -364,8 +367,8 @@ class Font
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_subScript = $pValue; $this->subScript = $pValue;
$this->_superScript = !$pValue; $this->superScript = !$pValue;
return $this; return $this;
} }
@ -376,7 +379,7 @@ class Font
*/ */
public function getUnderline() public function getUnderline()
{ {
return $this->_underline; return $this->underline;
} }
/** /**
@ -390,7 +393,7 @@ class Font
if ($pValue == '') { if ($pValue == '') {
$pValue = self::UNDERLINE_NONE; $pValue = self::UNDERLINE_NONE;
} }
$this->_underline = $pValue; $this->underline = $pValue;
return $this; return $this;
} }
@ -401,7 +404,7 @@ class Font
*/ */
public function getStrikethrough() public function getStrikethrough()
{ {
return $this->_strikethrough; return $this->strikethrough;
} }
/** /**
@ -415,7 +418,7 @@ class Font
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_strikethrough = $pValue; $this->strikethrough = $pValue;
return $this; return $this;
} }
@ -426,7 +429,7 @@ class Font
*/ */
public function getColor() public function getColor()
{ {
return $this->_color; return $this->color;
} }
/** /**
@ -440,7 +443,7 @@ class Font
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_COLOR; $pValue = PhpWord::DEFAULT_FONT_COLOR;
} }
$this->_color = $pValue; $this->color = $pValue;
return $this; return $this;
} }
@ -451,7 +454,7 @@ class Font
*/ */
public function getFgColor() public function getFgColor()
{ {
return $this->_fgColor; return $this->fgColor;
} }
/** /**
@ -462,7 +465,7 @@ class Font
*/ */
public function setFgColor($pValue = null) public function setFgColor($pValue = null)
{ {
$this->_fgColor = $pValue; $this->fgColor = $pValue;
return $this; return $this;
} }
@ -473,7 +476,7 @@ class Font
*/ */
public function getBgColor() public function getBgColor()
{ {
return $this->_bgColor; return $this->bgColor;
} }
/** /**
@ -484,7 +487,7 @@ class Font
*/ */
public function setBgColor($pValue = null) public function setBgColor($pValue = null)
{ {
$this->_bgColor = $pValue; $this->bgColor = $pValue;
return $this; return $this;
} }
@ -495,7 +498,7 @@ class Font
*/ */
public function getStyleType() public function getStyleType()
{ {
return $this->_type; return $this->type;
} }
/** /**
@ -505,7 +508,7 @@ class Font
*/ */
public function getParagraphStyle() public function getParagraphStyle()
{ {
return $this->_paragraphStyle; return $this->paragraphStyle;
} }
/** /**
@ -547,7 +550,7 @@ class Font
*/ */
public function getHint() public function getHint()
{ {
return $this->_hint; return $this->hint;
} }
/** /**
@ -561,7 +564,7 @@ class Font
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE; $pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
} }
$this->_hint = $pValue; $this->hint = $pValue;
return $this; return $this;
} }
} }

View File

@ -25,21 +25,21 @@ class Image
* *
* @var int * @var int
*/ */
private $_width; private $width;
/** /**
* Image width * Image width
* *
* @var int * @var int
*/ */
private $_height; private $height;
/** /**
* Alignment * Alignment
* *
* @var string * @var string
*/ */
private $_align; private $align;
/** /**
* Wrapping style * Wrapping style
@ -53,25 +53,25 @@ class Image
* *
* @var int * @var int
*/ */
private $_marginTop; private $marginTop;
/** /**
* Margin Left * Margin Left
* *
* @var int * @var int
*/ */
private $_marginLeft; private $marginLeft;
/** /**
* Create new image style * Create new image style
*/ */
public function __construct() public function __construct()
{ {
$this->_width = null; $this->width = null;
$this->_height = null; $this->height = null;
$this->_align = null; $this->align = null;
$this->_marginTop = null; $this->marginTop = null;
$this->_marginLeft = null; $this->marginLeft = null;
$this->setWrappingStyle(self::WRAPPING_STYLE_INLINE); $this->setWrappingStyle(self::WRAPPING_STYLE_INLINE);
} }
@ -83,6 +83,9 @@ class Image
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$this->$key = $value; $this->$key = $value;
} }
@ -91,7 +94,7 @@ class Image
*/ */
public function getWidth() public function getWidth()
{ {
return $this->_width; return $this->width;
} }
/** /**
@ -101,7 +104,7 @@ class Image
*/ */
public function setWidth($pValue = null) public function setWidth($pValue = null)
{ {
$this->_width = $pValue; $this->width = $pValue;
} }
/** /**
@ -109,7 +112,7 @@ class Image
*/ */
public function getHeight() public function getHeight()
{ {
return $this->_height; return $this->height;
} }
/** /**
@ -119,7 +122,7 @@ class Image
*/ */
public function setHeight($pValue = null) public function setHeight($pValue = null)
{ {
$this->_height = $pValue; $this->height = $pValue;
} }
/** /**
@ -127,7 +130,7 @@ class Image
*/ */
public function getAlign() public function getAlign()
{ {
return $this->_align; return $this->align;
} }
/** /**
@ -137,7 +140,7 @@ class Image
*/ */
public function setAlign($pValue = null) public function setAlign($pValue = null)
{ {
$this->_align = $pValue; $this->align = $pValue;
} }
/** /**
@ -147,7 +150,7 @@ class Image
*/ */
public function getMarginTop() public function getMarginTop()
{ {
return $this->_marginTop; return $this->marginTop;
} }
/** /**
@ -158,7 +161,7 @@ class Image
*/ */
public function setMarginTop($pValue = null) public function setMarginTop($pValue = null)
{ {
$this->_marginTop = $pValue; $this->marginTop = $pValue;
return $this; return $this;
} }
@ -169,7 +172,7 @@ class Image
*/ */
public function getMarginLeft() public function getMarginLeft()
{ {
return $this->_marginLeft; return $this->marginLeft;
} }
/** /**
@ -180,7 +183,7 @@ class Image
*/ */
public function setMarginLeft($pValue = null) public function setMarginLeft($pValue = null)
{ {
$this->_marginLeft = $pValue; $this->marginLeft = $pValue;
return $this; return $this;
} }

View File

@ -24,14 +24,14 @@ class ListItem
/** /**
* List Type * List Type
*/ */
private $_listType; private $listType;
/** /**
* Create a new ListItem Style * Create a new ListItem Style
*/ */
public function __construct() public function __construct()
{ {
$this->_listType = self::TYPE_BULLET_FILLED; $this->listType = self::TYPE_BULLET_FILLED;
} }
/** /**
@ -42,6 +42,9 @@ class ListItem
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$this->$key = $value; $this->$key = $value;
} }
@ -52,7 +55,7 @@ class ListItem
*/ */
public function setListType($pValue = self::TYPE_BULLET_FILLED) public function setListType($pValue = self::TYPE_BULLET_FILLED)
{ {
$this->_listType = $pValue; $this->listType = $pValue;
} }
/** /**
@ -60,6 +63,6 @@ class ListItem
*/ */
public function getListType() public function getListType()
{ {
return $this->_listType; return $this->listType;
} }
} }

View File

@ -30,91 +30,91 @@ class Paragraph
* *
* @var string * @var string
*/ */
private $_align; private $align;
/** /**
* Space before Paragraph * Space before Paragraph
* *
* @var int * @var int
*/ */
private $_spaceBefore; private $spaceBefore;
/** /**
* Space after Paragraph * Space after Paragraph
* *
* @var int * @var int
*/ */
private $_spaceAfter; private $spaceAfter;
/** /**
* Spacing between breaks * Spacing between breaks
* *
* @var int * @var int
*/ */
private $_spacing; private $spacing;
/** /**
* Set of Custom Tab Stops * Set of Custom Tab Stops
* *
* @var array * @var array
*/ */
private $_tabs; private $tabs;
/** /**
* Indent by how much * Indent by how much
* *
* @var int * @var int
*/ */
private $_indent; private $indent;
/** /**
* Hanging by how much * Hanging by how much
* *
* @var int * @var int
*/ */
private $_hanging; private $hanging;
/** /**
* Parent style * Parent style
* *
* @var string * @var string
*/ */
private $_basedOn = 'Normal'; private $basedOn = 'Normal';
/** /**
* Style for next paragraph * Style for next paragraph
* *
* @var string * @var string
*/ */
private $_next; private $next;
/** /**
* Allow first/last line to display on a separate page * Allow first/last line to display on a separate page
* *
* @var bool * @var bool
*/ */
private $_widowControl = true; private $widowControl = true;
/** /**
* Keep paragraph with next paragraph * Keep paragraph with next paragraph
* *
* @var bool * @var bool
*/ */
private $_keepNext = false; private $keepNext = false;
/** /**
* Keep all lines on one page * Keep all lines on one page
* *
* @var bool * @var bool
*/ */
private $_keepLines = false; private $keepLines = false;
/** /**
* Start paragraph on next page * Start paragraph on next page
* *
* @var bool * @var bool
*/ */
private $_pageBreakBefore = false; private $pageBreakBefore = false;
/** /**
* Set style by array * Set style by array
@ -127,8 +127,8 @@ class Paragraph
foreach ($style as $key => $value) { foreach ($style as $key => $value) {
if ($key === 'line-height') { if ($key === 'line-height') {
null; null;
} elseif (substr($key, 0, 1) !== '_') { } elseif (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$this->setStyleValue($key, $value); $this->setStyleValue($key, $value);
} }
@ -144,16 +144,18 @@ class Paragraph
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if ($key == '_indent' || $key == '_hanging') { if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
if ($key == 'indent' || $key == 'hanging') {
$value = $value * 720; $value = $value * 720;
} elseif ($key == '_spacing') { } elseif ($key == 'spacing') {
$value += 240; // because line height of 1 matches 240 twips $value += 240; // because line height of 1 matches 240 twips
} elseif ($key === 'line-height') { } elseif ($key === 'line-height') {
$this->setLineHeight($value); $this->setLineHeight($value);
return; return;
} }
$this->$key = $value; $method = 'set' . $key;
$method = 'set' . substr($key, 1);
if (method_exists($this, $method)) { if (method_exists($this, $method)) {
$this->$method($value); $this->$method($value);
} }
@ -166,7 +168,7 @@ class Paragraph
*/ */
public function getAlign() public function getAlign()
{ {
return $this->_align; return $this->align;
} }
/** /**
@ -181,7 +183,7 @@ class Paragraph
// justify becames both // justify becames both
$pValue = 'both'; $pValue = 'both';
} }
$this->_align = $pValue; $this->align = $pValue;
return $this; return $this;
} }
@ -192,7 +194,7 @@ class Paragraph
*/ */
public function getSpaceBefore() public function getSpaceBefore()
{ {
return $this->_spaceBefore; return $this->spaceBefore;
} }
/** /**
@ -203,7 +205,7 @@ class Paragraph
*/ */
public function setSpaceBefore($pValue = null) public function setSpaceBefore($pValue = null)
{ {
$this->_spaceBefore = $pValue; $this->spaceBefore = $pValue;
return $this; return $this;
} }
@ -214,7 +216,7 @@ class Paragraph
*/ */
public function getSpaceAfter() public function getSpaceAfter()
{ {
return $this->_spaceAfter; return $this->spaceAfter;
} }
/** /**
@ -225,7 +227,7 @@ class Paragraph
*/ */
public function setSpaceAfter($pValue = null) public function setSpaceAfter($pValue = null)
{ {
$this->_spaceAfter = $pValue; $this->spaceAfter = $pValue;
return $this; return $this;
} }
@ -236,7 +238,7 @@ class Paragraph
*/ */
public function getSpacing() public function getSpacing()
{ {
return $this->_spacing; return $this->spacing;
} }
/** /**
@ -247,7 +249,7 @@ class Paragraph
*/ */
public function setSpacing($pValue = null) public function setSpacing($pValue = null)
{ {
$this->_spacing = $pValue; $this->spacing = $pValue;
return $this; return $this;
} }
@ -258,7 +260,7 @@ class Paragraph
*/ */
public function getIndent() public function getIndent()
{ {
return $this->_indent; return $this->indent;
} }
/** /**
@ -269,7 +271,7 @@ class Paragraph
*/ */
public function setIndent($pValue = null) public function setIndent($pValue = null)
{ {
$this->_indent = $pValue; $this->indent = $pValue;
return $this; return $this;
} }
@ -280,7 +282,7 @@ class Paragraph
*/ */
public function getHanging() public function getHanging()
{ {
return $this->_hanging; return $this->hanging;
} }
/** /**
@ -291,7 +293,7 @@ class Paragraph
*/ */
public function setHanging($pValue = null) public function setHanging($pValue = null)
{ {
$this->_hanging = $pValue; $this->hanging = $pValue;
return $this; return $this;
} }
@ -302,7 +304,7 @@ class Paragraph
*/ */
public function getTabs() public function getTabs()
{ {
return $this->_tabs; return $this->tabs;
} }
/** /**
@ -314,7 +316,7 @@ class Paragraph
public function setTabs($pValue = null) public function setTabs($pValue = null)
{ {
if (is_array($pValue)) { if (is_array($pValue)) {
$this->_tabs = new Tabs($pValue); $this->tabs = new Tabs($pValue);
} }
return $this; return $this;
} }
@ -326,7 +328,7 @@ class Paragraph
*/ */
public function getBasedOn() public function getBasedOn()
{ {
return $this->_basedOn; return $this->basedOn;
} }
/** /**
@ -337,7 +339,7 @@ class Paragraph
*/ */
public function setBasedOn($pValue = 'Normal') public function setBasedOn($pValue = 'Normal')
{ {
$this->_basedOn = $pValue; $this->basedOn = $pValue;
return $this; return $this;
} }
@ -348,7 +350,7 @@ class Paragraph
*/ */
public function getNext() public function getNext()
{ {
return $this->_next; return $this->next;
} }
/** /**
@ -359,7 +361,7 @@ class Paragraph
*/ */
public function setNext($pValue = null) public function setNext($pValue = null)
{ {
$this->_next = $pValue; $this->next = $pValue;
return $this; return $this;
} }
@ -370,7 +372,7 @@ class Paragraph
*/ */
public function getWidowControl() public function getWidowControl()
{ {
return $this->_widowControl; return $this->widowControl;
} }
/** /**
@ -384,7 +386,7 @@ class Paragraph
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = true; $pValue = true;
} }
$this->_widowControl = $pValue; $this->widowControl = $pValue;
return $this; return $this;
} }
@ -395,7 +397,7 @@ class Paragraph
*/ */
public function getKeepNext() public function getKeepNext()
{ {
return $this->_keepNext; return $this->keepNext;
} }
/** /**
@ -409,7 +411,7 @@ class Paragraph
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_keepNext = $pValue; $this->keepNext = $pValue;
return $this; return $this;
} }
@ -420,7 +422,7 @@ class Paragraph
*/ */
public function getKeepLines() public function getKeepLines()
{ {
return $this->_keepLines; return $this->keepLines;
} }
/** /**
@ -434,7 +436,7 @@ class Paragraph
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_keepLines = $pValue; $this->keepLines = $pValue;
return $this; return $this;
} }
@ -445,7 +447,7 @@ class Paragraph
*/ */
public function getPageBreakBefore() public function getPageBreakBefore()
{ {
return $this->_pageBreakBefore; return $this->pageBreakBefore;
} }
/** /**
@ -459,7 +461,7 @@ class Paragraph
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_pageBreakBefore = $pValue; $this->pageBreakBefore = $pValue;
return $this; return $this;
} }

View File

@ -19,21 +19,21 @@ class Row
* *
* @var bool * @var bool
*/ */
private $_tblHeader = false; private $tblHeader = false;
/** /**
* Table row cannot break across pages * Table row cannot break across pages
* *
* @var bool * @var bool
*/ */
private $_cantSplit = false; private $cantSplit = false;
/** /**
* Table row exact height * Table row exact height
* *
* @var bool * @var bool
*/ */
private $_exactHeight = false; private $exactHeight = false;
/** /**
* Create a new row style * Create a new row style
@ -50,6 +50,9 @@ class Row
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$this->$key = $value; $this->$key = $value;
} }
@ -64,7 +67,7 @@ class Row
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_tblHeader = $pValue; $this->tblHeader = $pValue;
return $this; return $this;
} }
@ -75,7 +78,7 @@ class Row
*/ */
public function getTblHeader() public function getTblHeader()
{ {
return $this->_tblHeader; return $this->tblHeader;
} }
/** /**
@ -89,7 +92,7 @@ class Row
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_cantSplit = $pValue; $this->cantSplit = $pValue;
return $this; return $this;
} }
@ -100,7 +103,7 @@ class Row
*/ */
public function getCantSplit() public function getCantSplit()
{ {
return $this->_cantSplit; return $this->cantSplit;
} }
/** /**
@ -114,7 +117,7 @@ class Row
if (!is_bool($pValue)) { if (!is_bool($pValue)) {
$pValue = false; $pValue = false;
} }
$this->_exactHeight = $pValue; $this->exactHeight = $pValue;
return $this; return $this;
} }
@ -125,6 +128,6 @@ class Row
*/ */
public function getExactHeight() public function getExactHeight()
{ {
return $this->_exactHeight; return $this->exactHeight;
} }
} }

View File

@ -24,21 +24,21 @@ class TOC
* *
* @var string * @var string
*/ */
private $_tabLeader; private $tabLeader;
/** /**
* Tab Position * Tab Position
* *
* @var int * @var int
*/ */
private $_tabPos; private $tabPos;
/** /**
* Indent * Indent
* *
* @var int * @var int
*/ */
private $_indent; private $indent;
/** /**
@ -46,9 +46,9 @@ class TOC
*/ */
public function __construct() public function __construct()
{ {
$this->_tabPos = 9062; $this->tabPos = 9062;
$this->_tabLeader = self::TABLEADER_DOT; $this->tabLeader = self::TABLEADER_DOT;
$this->_indent = 200; $this->indent = 200;
} }
/** /**
@ -58,7 +58,7 @@ class TOC
*/ */
public function getTabPos() public function getTabPos()
{ {
return $this->_tabPos; return $this->tabPos;
} }
/** /**
@ -68,7 +68,7 @@ class TOC
*/ */
public function setTabPos($pValue) public function setTabPos($pValue)
{ {
$this->_tabPos = $pValue; $this->tabPos = $pValue;
} }
/** /**
@ -78,7 +78,7 @@ class TOC
*/ */
public function getTabLeader() public function getTabLeader()
{ {
return $this->_tabLeader; return $this->tabLeader;
} }
/** /**
@ -88,7 +88,7 @@ class TOC
*/ */
public function setTabLeader($pValue = self::TABLEADER_DOT) public function setTabLeader($pValue = self::TABLEADER_DOT)
{ {
$this->_tabLeader = $pValue; $this->tabLeader = $pValue;
} }
/** /**
@ -98,7 +98,7 @@ class TOC
*/ */
public function getIndent() public function getIndent()
{ {
return $this->_indent; return $this->indent;
} }
/** /**
@ -108,7 +108,7 @@ class TOC
*/ */
public function setIndent($pValue) public function setIndent($pValue)
{ {
$this->_indent = $pValue; $this->indent = $pValue;
} }
/** /**

View File

@ -21,21 +21,21 @@ class Tab
* *
* @var string * @var string
*/ */
private $_val; private $val;
/** /**
* Tab Leader Character * Tab Leader Character
* *
* @var string * @var string
*/ */
private $_leader; private $leader;
/** /**
* Tab Stop Position * Tab Stop Position
* *
* @var int * @var int
*/ */
private $_position; private $position;
/** /**
* Tab Stop Type * Tab Stop Type
@ -43,7 +43,7 @@ class Tab
* @var array * @var array
* @link http://www.schemacentral.com/sc/ooxml/a-w_val-26.html Tab Stop Type * @link http://www.schemacentral.com/sc/ooxml/a-w_val-26.html Tab Stop Type
*/ */
private static $_possibleStopTypes = array( private static $possibleStopTypes = array(
'clear', // No Tab Stop 'clear', // No Tab Stop
'left', // Left Tab Stop 'left', // Left Tab Stop
'center', // Center Tab Stop 'center', // Center Tab Stop
@ -59,7 +59,7 @@ class Tab
* @var array * @var array
* @link http://www.schemacentral.com/sc/ooxml/a-w_leader-1.html Tab Leader Character * @link http://www.schemacentral.com/sc/ooxml/a-w_leader-1.html Tab Leader Character
*/ */
private static $_possibleLeaders = array( private static $possibleLeaders = array(
'none', // No tab stop leader 'none', // No tab stop leader
'dot', // Dotted leader line 'dot', // Dotted leader line
'hyphen', // Dashed tab stop leader line 'hyphen', // Dashed tab stop leader line
@ -80,13 +80,13 @@ class Tab
public function __construct($val = null, $position = 0, $leader = null) public function __construct($val = null, $position = 0, $leader = null)
{ {
// Default to clear if the stop type is not matched // Default to clear if the stop type is not matched
$this->_val = (self::isStopType($val)) ? $val : 'clear'; $this->val = (self::isStopType($val)) ? $val : 'clear';
// Default to 0 if the position is non-numeric // Default to 0 if the position is non-numeric
$this->_position = (is_numeric($position)) ? intval($position) : 0; $this->position = (is_numeric($position)) ? intval($position) : 0;
// Default to NULL if no tab leader // Default to NULL if no tab leader
$this->_leader = (self::isLeaderType($leader)) ? $leader : null; $this->leader = (self::isLeaderType($leader)) ? $leader : null;
} }
/** /**
@ -98,11 +98,11 @@ class Tab
{ {
if (isset($xmlWriter)) { if (isset($xmlWriter)) {
$xmlWriter->startElement("w:tab"); $xmlWriter->startElement("w:tab");
$xmlWriter->writeAttribute("w:val", $this->_val); $xmlWriter->writeAttribute("w:val", $this->val);
if (!is_null($this->_leader)) { if (!is_null($this->leader)) {
$xmlWriter->writeAttribute("w:leader", $this->_leader); $xmlWriter->writeAttribute("w:leader", $this->leader);
} }
$xmlWriter->writeAttribute("w:pos", $this->_position); $xmlWriter->writeAttribute("w:pos", $this->position);
$xmlWriter->endElement(); $xmlWriter->endElement();
} }
} }
@ -115,7 +115,7 @@ class Tab
*/ */
private static function isStopType($attribute) private static function isStopType($attribute)
{ {
return in_array($attribute, self::$_possibleStopTypes); return in_array($attribute, self::$possibleStopTypes);
} }
/** /**
@ -126,6 +126,6 @@ class Tab
*/ */
private static function isLeaderType($attribute) private static function isLeaderType($attribute)
{ {
return in_array($attribute, self::$_possibleLeaders); return in_array($attribute, self::$possibleLeaders);
} }
} }

View File

@ -19,126 +19,126 @@ class Table
* *
* @var \PhpOffice\PhpWord\Style\Table * @var \PhpOffice\PhpWord\Style\Table
*/ */
private $_firstRow = null; private $firstRow = null;
/** /**
* Cell margin top * Cell margin top
* *
* @var int * @var int
*/ */
private $_cellMarginTop = null; private $cellMarginTop = null;
/** /**
* Cell margin left * Cell margin left
* *
* @var int * @var int
*/ */
private $_cellMarginLeft = null; private $cellMarginLeft = null;
/** /**
* Cell margin right * Cell margin right
* *
* @var int * @var int
*/ */
private $_cellMarginRight = null; private $cellMarginRight = null;
/** /**
* Cell margin bottom * Cell margin bottom
* *
* @var int * @var int
*/ */
private $_cellMarginBottom = null; private $cellMarginBottom = null;
/** /**
* Background color * Background color
* *
* @var string * @var string
*/ */
private $_bgColor; private $bgColor;
/** /**
* Border size top * Border size top
* *
* @var int * @var int
*/ */
private $_borderTopSize; private $borderTopSize;
/** /**
* Border color * Border color
* *
* @var string top * @var string top
*/ */
private $_borderTopColor; private $borderTopColor;
/** /**
* Border size left * Border size left
* *
* @var int * @var int
*/ */
private $_borderLeftSize; private $borderLeftSize;
/** /**
* Border color left * Border color left
* *
* @var string * @var string
*/ */
private $_borderLeftColor; private $borderLeftColor;
/** /**
* Border size right * Border size right
* *
* @var int * @var int
*/ */
private $_borderRightSize; private $borderRightSize;
/** /**
* Border color right * Border color right
* *
* @var string * @var string
*/ */
private $_borderRightColor; private $borderRightColor;
/** /**
* Border size bottom * Border size bottom
* *
* @var int * @var int
*/ */
private $_borderBottomSize; private $borderBottomSize;
/** /**
* Border color bottom * Border color bottom
* *
* @var string * @var string
*/ */
private $_borderBottomColor; private $borderBottomColor;
/** /**
* Border size inside horizontal * Border size inside horizontal
* *
* @var int * @var int
*/ */
private $_borderInsideHSize; private $borderInsideHSize;
/** /**
* Border color inside horizontal * Border color inside horizontal
* *
* @var string * @var string
*/ */
private $_borderInsideHColor; private $borderInsideHColor;
/** /**
* Border size inside vertical * Border size inside vertical
* *
* @var int * @var int
*/ */
private $_borderInsideVSize; private $borderInsideVSize;
/** /**
* Border color inside vertical * Border color inside vertical
* *
* @var string * @var string
*/ */
private $_borderInsideVColor; private $borderInsideVColor;
/** /**
* Create new table style * Create new table style
@ -149,30 +149,29 @@ class Table
public function __construct($styleTable = null, $styleFirstRow = null) public function __construct($styleTable = null, $styleFirstRow = null)
{ {
if (!is_null($styleFirstRow) && is_array($styleFirstRow)) { if (!is_null($styleFirstRow) && is_array($styleFirstRow)) {
$this->_firstRow = clone $this; $this->firstRow = clone $this;
unset($this->_firstRow->_firstRow); unset($this->firstRow->firstRow);
unset($this->_firstRow->_cellMarginBottom); unset($this->firstRow->cellMarginBottom);
unset($this->_firstRow->_cellMarginTop); unset($this->firstRow->cellMarginTop);
unset($this->_firstRow->_cellMarginLeft); unset($this->firstRow->cellMarginLeft);
unset($this->_firstRow->_cellMarginRight); unset($this->firstRow->cellMarginRight);
unset($this->_firstRow->_borderInsideVColor); unset($this->firstRow->borderInsideVColor);
unset($this->_firstRow->_borderInsideVSize); unset($this->firstRow->borderInsideVSize);
unset($this->_firstRow->_borderInsideHColor); unset($this->firstRow->borderInsideHColor);
unset($this->_firstRow->_borderInsideHSize); unset($this->firstRow->borderInsideHSize);
foreach ($styleFirstRow as $key => $value) { foreach ($styleFirstRow as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$this->firstRow->setStyleValue($key, $value);
$this->_firstRow->setStyleValue($key, $value);
} }
} }
if (!is_null($styleTable) && is_array($styleTable)) { if (!is_null($styleTable) && is_array($styleTable)) {
foreach ($styleTable as $key => $value) { foreach ($styleTable as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
$this->setStyleValue($key, $value); $this->setStyleValue($key, $value);
} }
@ -187,11 +186,14 @@ class Table
*/ */
public function setStyleValue($key, $value) public function setStyleValue($key, $value)
{ {
if ($key == '_borderSize') { if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
if ($key == 'borderSize') {
$this->setBorderSize($value); $this->setBorderSize($value);
} elseif ($key == '_borderColor') { } elseif ($key == 'borderColor') {
$this->setBorderColor($value); $this->setBorderColor($value);
} elseif ($key == '_cellMargin') { } elseif ($key == 'cellMargin') {
$this->setCellMargin($value); $this->setCellMargin($value);
} else { } else {
$this->$key = $value; $this->$key = $value;
@ -205,7 +207,7 @@ class Table
*/ */
public function getFirstRow() public function getFirstRow()
{ {
return $this->_firstRow; return $this->firstRow;
} }
/** /**
@ -215,7 +217,7 @@ class Table
*/ */
public function getBgColor() public function getBgColor()
{ {
return $this->_bgColor; return $this->bgColor;
} }
/** /**
@ -226,7 +228,7 @@ class Table
*/ */
public function setBgColor($pValue = null) public function setBgColor($pValue = null)
{ {
$this->_bgColor = $pValue; $this->bgColor = $pValue;
} }
/** /**
@ -236,12 +238,12 @@ class Table
*/ */
public function setBorderSize($pValue = null) public function setBorderSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
$this->_borderInsideHSize = $pValue; $this->borderInsideHSize = $pValue;
$this->_borderInsideVSize = $pValue; $this->borderInsideVSize = $pValue;
} }
/** /**
@ -267,12 +269,12 @@ class Table
*/ */
public function setBorderColor($pValue = null) public function setBorderColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
$this->_borderInsideHColor = $pValue; $this->borderInsideHColor = $pValue;
$this->_borderInsideVColor = $pValue; $this->borderInsideVColor = $pValue;
} }
/** /**
@ -299,7 +301,7 @@ class Table
*/ */
public function setBorderTopSize($pValue = null) public function setBorderTopSize($pValue = null)
{ {
$this->_borderTopSize = $pValue; $this->borderTopSize = $pValue;
} }
/** /**
@ -309,7 +311,7 @@ class Table
*/ */
public function getBorderTopSize() public function getBorderTopSize()
{ {
return $this->_borderTopSize; return $this->borderTopSize;
} }
/** /**
@ -319,7 +321,7 @@ class Table
*/ */
public function setBorderTopColor($pValue = null) public function setBorderTopColor($pValue = null)
{ {
$this->_borderTopColor = $pValue; $this->borderTopColor = $pValue;
} }
/** /**
@ -329,7 +331,7 @@ class Table
*/ */
public function getBorderTopColor() public function getBorderTopColor()
{ {
return $this->_borderTopColor; return $this->borderTopColor;
} }
/** /**
@ -339,7 +341,7 @@ class Table
*/ */
public function setBorderLeftSize($pValue = null) public function setBorderLeftSize($pValue = null)
{ {
$this->_borderLeftSize = $pValue; $this->borderLeftSize = $pValue;
} }
/** /**
@ -349,7 +351,7 @@ class Table
*/ */
public function getBorderLeftSize() public function getBorderLeftSize()
{ {
return $this->_borderLeftSize; return $this->borderLeftSize;
} }
/** /**
@ -359,7 +361,7 @@ class Table
*/ */
public function setBorderLeftColor($pValue = null) public function setBorderLeftColor($pValue = null)
{ {
$this->_borderLeftColor = $pValue; $this->borderLeftColor = $pValue;
} }
/** /**
@ -369,7 +371,7 @@ class Table
*/ */
public function getBorderLeftColor() public function getBorderLeftColor()
{ {
return $this->_borderLeftColor; return $this->borderLeftColor;
} }
/** /**
@ -379,7 +381,7 @@ class Table
*/ */
public function setBorderRightSize($pValue = null) public function setBorderRightSize($pValue = null)
{ {
$this->_borderRightSize = $pValue; $this->borderRightSize = $pValue;
} }
/** /**
@ -389,7 +391,7 @@ class Table
*/ */
public function getBorderRightSize() public function getBorderRightSize()
{ {
return $this->_borderRightSize; return $this->borderRightSize;
} }
/** /**
@ -399,7 +401,7 @@ class Table
*/ */
public function setBorderRightColor($pValue = null) public function setBorderRightColor($pValue = null)
{ {
$this->_borderRightColor = $pValue; $this->borderRightColor = $pValue;
} }
/** /**
@ -409,7 +411,7 @@ class Table
*/ */
public function getBorderRightColor() public function getBorderRightColor()
{ {
return $this->_borderRightColor; return $this->borderRightColor;
} }
/** /**
@ -419,7 +421,7 @@ class Table
*/ */
public function setBorderBottomSize($pValue = null) public function setBorderBottomSize($pValue = null)
{ {
$this->_borderBottomSize = $pValue; $this->borderBottomSize = $pValue;
} }
/** /**
@ -429,7 +431,7 @@ class Table
*/ */
public function getBorderBottomSize() public function getBorderBottomSize()
{ {
return $this->_borderBottomSize; return $this->borderBottomSize;
} }
/** /**
@ -439,7 +441,7 @@ class Table
*/ */
public function setBorderBottomColor($pValue = null) public function setBorderBottomColor($pValue = null)
{ {
$this->_borderBottomColor = $pValue; $this->borderBottomColor = $pValue;
} }
/** /**
@ -449,7 +451,7 @@ class Table
*/ */
public function getBorderBottomColor() public function getBorderBottomColor()
{ {
return $this->_borderBottomColor; return $this->borderBottomColor;
} }
/** /**
@ -459,7 +461,7 @@ class Table
*/ */
public function setBorderInsideHColor($pValue = null) public function setBorderInsideHColor($pValue = null)
{ {
$this->_borderInsideHColor = $pValue; $this->borderInsideHColor = $pValue;
} }
/** /**
@ -469,7 +471,7 @@ class Table
*/ */
public function getBorderInsideHColor() public function getBorderInsideHColor()
{ {
return (isset($this->_borderInsideHColor)) ? $this->_borderInsideHColor : null; return (isset($this->borderInsideHColor)) ? $this->borderInsideHColor : null;
} }
/** /**
@ -479,7 +481,7 @@ class Table
*/ */
public function setBorderInsideVColor($pValue = null) public function setBorderInsideVColor($pValue = null)
{ {
$this->_borderInsideVColor = $pValue; $this->borderInsideVColor = $pValue;
} }
/** /**
@ -489,7 +491,7 @@ class Table
*/ */
public function getBorderInsideVColor() public function getBorderInsideVColor()
{ {
return (isset($this->_borderInsideVColor)) ? $this->_borderInsideVColor : null; return (isset($this->borderInsideVColor)) ? $this->borderInsideVColor : null;
} }
/** /**
@ -499,7 +501,7 @@ class Table
*/ */
public function setBorderInsideHSize($pValue = null) public function setBorderInsideHSize($pValue = null)
{ {
$this->_borderInsideHSize = $pValue; $this->borderInsideHSize = $pValue;
} }
/** /**
@ -509,7 +511,7 @@ class Table
*/ */
public function getBorderInsideHSize() public function getBorderInsideHSize()
{ {
return (isset($this->_borderInsideHSize)) ? $this->_borderInsideHSize : null; return (isset($this->borderInsideHSize)) ? $this->borderInsideHSize : null;
} }
/** /**
@ -519,7 +521,7 @@ class Table
*/ */
public function setBorderInsideVSize($pValue = null) public function setBorderInsideVSize($pValue = null)
{ {
$this->_borderInsideVSize = $pValue; $this->borderInsideVSize = $pValue;
} }
/** /**
@ -529,7 +531,7 @@ class Table
*/ */
public function getBorderInsideVSize() public function getBorderInsideVSize()
{ {
return (isset($this->_borderInsideVSize)) ? $this->_borderInsideVSize : null; return (isset($this->borderInsideVSize)) ? $this->borderInsideVSize : null;
} }
/** /**
@ -539,7 +541,7 @@ class Table
*/ */
public function setCellMarginTop($pValue = null) public function setCellMarginTop($pValue = null)
{ {
$this->_cellMarginTop = $pValue; $this->cellMarginTop = $pValue;
} }
/** /**
@ -549,7 +551,7 @@ class Table
*/ */
public function getCellMarginTop() public function getCellMarginTop()
{ {
return $this->_cellMarginTop; return $this->cellMarginTop;
} }
/** /**
@ -559,7 +561,7 @@ class Table
*/ */
public function setCellMarginLeft($pValue = null) public function setCellMarginLeft($pValue = null)
{ {
$this->_cellMarginLeft = $pValue; $this->cellMarginLeft = $pValue;
} }
/** /**
@ -569,7 +571,7 @@ class Table
*/ */
public function getCellMarginLeft() public function getCellMarginLeft()
{ {
return $this->_cellMarginLeft; return $this->cellMarginLeft;
} }
/** /**
@ -579,7 +581,7 @@ class Table
*/ */
public function setCellMarginRight($pValue = null) public function setCellMarginRight($pValue = null)
{ {
$this->_cellMarginRight = $pValue; $this->cellMarginRight = $pValue;
} }
/** /**
@ -589,7 +591,7 @@ class Table
*/ */
public function getCellMarginRight() public function getCellMarginRight()
{ {
return $this->_cellMarginRight; return $this->cellMarginRight;
} }
/** /**
@ -599,7 +601,7 @@ class Table
*/ */
public function setCellMarginBottom($pValue = null) public function setCellMarginBottom($pValue = null)
{ {
$this->_cellMarginBottom = $pValue; $this->cellMarginBottom = $pValue;
} }
/** /**
@ -609,7 +611,7 @@ class Table
*/ */
public function getCellMarginBottom() public function getCellMarginBottom()
{ {
return $this->_cellMarginBottom; return $this->cellMarginBottom;
} }
/** /**
@ -619,10 +621,10 @@ class Table
*/ */
public function setCellMargin($pValue = null) public function setCellMargin($pValue = null)
{ {
$this->_cellMarginTop = $pValue; $this->cellMarginTop = $pValue;
$this->_cellMarginLeft = $pValue; $this->cellMarginLeft = $pValue;
$this->_cellMarginRight = $pValue; $this->cellMarginRight = $pValue;
$this->_cellMarginBottom = $pValue; $this->cellMarginBottom = $pValue;
} }
/** /**
@ -632,6 +634,6 @@ class Table
*/ */
public function getCellMargin() public function getCellMargin()
{ {
return array($this->_cellMarginTop, $this->_cellMarginLeft, $this->_cellMarginRight, $this->_cellMarginBottom); return array($this->cellMarginTop, $this->cellMarginLeft, $this->cellMarginRight, $this->cellMarginBottom);
} }
} }

View File

@ -21,7 +21,7 @@ class Tabs
* *
* @var array * @var array
*/ */
private $_tabs; private $tabs;
/** /**
* Create new tab collection style * Create new tab collection style
@ -30,7 +30,7 @@ class Tabs
*/ */
public function __construct(array $tabs) public function __construct(array $tabs)
{ {
$this->_tabs = $tabs; $this->tabs = $tabs;
} }
/** /**
@ -42,7 +42,7 @@ class Tabs
{ {
if (isset($xmlWriter)) { if (isset($xmlWriter)) {
$xmlWriter->startElement("w:tabs"); $xmlWriter->startElement("w:tabs");
foreach ($this->_tabs as &$tab) { foreach ($this->tabs as &$tab) {
$tab->toXml($xmlWriter); $tab->toXml($xmlWriter);
} }
$xmlWriter->endElement(); $xmlWriter->endElement();

View File

@ -82,8 +82,8 @@ class TOC
if (!is_null($styleTOC) && is_array($styleTOC)) { if (!is_null($styleTOC) && is_array($styleTOC)) {
foreach ($styleTOC as $key => $value) { foreach ($styleTOC as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
self::$TOCStyle->setStyleValue($key, $value); self::$TOCStyle->setStyleValue($key, $value);
} }
@ -93,8 +93,8 @@ class TOC
if (is_array($styleFont)) { if (is_array($styleFont)) {
self::$fontStyle = new Font(); self::$fontStyle = new Font();
foreach ($styleFont as $key => $value) { foreach ($styleFont as $key => $value) {
if (substr($key, 0, 1) != '_') { if (substr($key, 0, 1) == '_') {
$key = '_' . $key; $key = substr($key, 1);
} }
self::$fontStyle->setStyleValue($key, $value); self::$fontStyle->setStyleValue($key, $value);
} }

View File

@ -61,10 +61,10 @@ class CellTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($default, $object->getDefaultBorderColor()); $this->assertEquals($default, $object->getDefaultBorderColor());
$object->setStyleValue('_defaultBorderColor', $value); $object->setStyleValue('defaultBorderColor', $value);
$this->assertEquals($value, $object->getDefaultBorderColor()); $this->assertEquals($value, $object->getDefaultBorderColor());
$object->setStyleValue('_borderColor', $value); $object->setStyleValue('borderColor', $value);
$expected = array($value, $value, $value, $value); $expected = array($value, $value, $value, $value);
$this->assertEquals($expected, $object->getBorderColor()); $this->assertEquals($expected, $object->getBorderColor());
} }
@ -78,7 +78,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
$value = 120; $value = 120;
$expected = array($value, $value, $value, $value); $expected = array($value, $value, $value, $value);
$object->setStyleValue('_borderSize', $value); $object->setStyleValue('borderSize', $value);
$this->assertEquals($expected, $object->getBorderSize()); $this->assertEquals($expected, $object->getBorderSize());
} }
} }

View File

@ -62,9 +62,9 @@ class FontTest extends \PHPUnit_Framework_TestCase
); );
foreach ($attributes as $key => $default) { foreach ($attributes as $key => $default) {
$get = "get{$key}"; $get = "get{$key}";
$object->setStyleValue("_$key", null); $object->setStyleValue("$key", null);
$this->assertEquals($default, $object->$get()); $this->assertEquals($default, $object->$get());
$object->setStyleValue("_$key", ''); $object->setStyleValue("$key", '');
$this->assertEquals($default, $object->$get()); $this->assertEquals($default, $object->$get());
} }
} }

View File

@ -58,7 +58,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase
); );
foreach ($properties as $key => $value) { foreach ($properties as $key => $value) {
$get = "get{$key}"; $get = "get{$key}";
$object->setStyleValue("_{$key}", $value); $object->setStyleValue("{$key}", $value);
$this->assertEquals($value, $object->$get()); $this->assertEquals($value, $object->$get());
} }
} }

View File

@ -38,7 +38,7 @@ class ListItemTest extends \PHPUnit_Framework_TestCase
$object = new ListItem(); $object = new ListItem();
$value = ListItem::TYPE_ALPHANUM; $value = ListItem::TYPE_ALPHANUM;
$object->setStyleValue('_listType', $value); $object->setStyleValue('listType', $value);
$this->assertEquals($value, $object->getListType()); $this->assertEquals($value, $object->getListType());
} }

View File

@ -45,9 +45,9 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase
); );
foreach ($attributes as $key => $default) { foreach ($attributes as $key => $default) {
$get = "get{$key}"; $get = "get{$key}";
$object->setStyleValue("_$key", null); $object->setStyleValue("$key", null);
$this->assertEquals($default, $object->$get()); $this->assertEquals($default, $object->$get());
$object->setStyleValue("_$key", ''); $object->setStyleValue("$key", '');
$this->assertEquals($default, $object->$get()); $this->assertEquals($default, $object->$get());
} }
} }
@ -75,7 +75,7 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase
); );
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
$get = "get{$key}"; $get = "get{$key}";
$object->setStyleValue("_$key", $value); $object->setStyleValue("$key", $value);
if ($key == 'align') { if ($key == 'align') {
if ($value == 'justify') { if ($value == 'justify') {
$value = 'both'; $value = 'both';

View File

@ -42,7 +42,7 @@ class RowTest extends \PHPUnit_Framework_TestCase
// setStyleValue // setStyleValue
$value = !$value; $value = !$value;
$expected = $value ? 1 : 0; $expected = $value ? 1 : 0;
$object->setStyleValue("_{$key}", $value); $object->setStyleValue("{$key}", $value);
$this->assertEquals($expected, $object->$get()); $this->assertEquals($expected, $object->$get());
} }
} }

View File

@ -39,7 +39,7 @@ class TOCTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($value, $object->$get()); $this->assertEquals($value, $object->$get());
// setStyleValue // setStyleValue
$object->setStyleValue("_{$key}", null); $object->setStyleValue("{$key}", null);
$this->assertEquals(null, $object->$get()); $this->assertEquals(null, $object->$get());
} }
} }

View File

@ -143,9 +143,9 @@ class TableTest extends \PHPUnit_Framework_TestCase
public function testSetStyleValue() public function testSetStyleValue()
{ {
$object = new Table(); $object = new Table();
$object->setStyleValue('_borderSize', 120); $object->setStyleValue('borderSize', 120);
$object->setStyleValue('_cellMargin', 240); $object->setStyleValue('cellMargin', 240);
$object->setStyleValue('_borderColor', '999999'); $object->setStyleValue('borderColor', '999999');
$this->assertEquals( $this->assertEquals(
array(120, 120, 120, 120, 120, 120), array(120, 120, 120, 120, 120, 120),