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
- 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
- General: Remove underscore prefix from all private properties name
## 0.9.1 - 27 Mar 2014

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,21 +21,21 @@ class Tab
*
* @var string
*/
private $_val;
private $val;
/**
* Tab Leader Character
*
* @var string
*/
private $_leader;
private $leader;
/**
* Tab Stop Position
*
* @var int
*/
private $_position;
private $position;
/**
* Tab Stop Type
@ -43,7 +43,7 @@ class Tab
* @var array
* @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
'left', // Left Tab Stop
'center', // Center Tab Stop
@ -59,7 +59,7 @@ class Tab
* @var array
* @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
'dot', // Dotted leader line
'hyphen', // Dashed tab stop leader line
@ -80,13 +80,13 @@ class Tab
public function __construct($val = null, $position = 0, $leader = null)
{
// 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
$this->_position = (is_numeric($position)) ? intval($position) : 0;
$this->position = (is_numeric($position)) ? intval($position) : 0;
// 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)) {
$xmlWriter->startElement("w:tab");
$xmlWriter->writeAttribute("w:val", $this->_val);
if (!is_null($this->_leader)) {
$xmlWriter->writeAttribute("w:leader", $this->_leader);
$xmlWriter->writeAttribute("w:val", $this->val);
if (!is_null($this->leader)) {
$xmlWriter->writeAttribute("w:leader", $this->leader);
}
$xmlWriter->writeAttribute("w:pos", $this->_position);
$xmlWriter->writeAttribute("w:pos", $this->position);
$xmlWriter->endElement();
}
}
@ -115,7 +115,7 @@ class Tab
*/
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)
{
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
*/
private $_firstRow = null;
private $firstRow = null;
/**
* Cell margin top
*
* @var int
*/
private $_cellMarginTop = null;
private $cellMarginTop = null;
/**
* Cell margin left
*
* @var int
*/
private $_cellMarginLeft = null;
private $cellMarginLeft = null;
/**
* Cell margin right
*
* @var int
*/
private $_cellMarginRight = null;
private $cellMarginRight = null;
/**
* Cell margin bottom
*
* @var int
*/
private $_cellMarginBottom = null;
private $cellMarginBottom = null;
/**
* Background color
*
* @var string
*/
private $_bgColor;
private $bgColor;
/**
* Border size top
*
* @var int
*/
private $_borderTopSize;
private $borderTopSize;
/**
* Border color
*
* @var string top
*/
private $_borderTopColor;
private $borderTopColor;
/**
* Border size left
*
* @var int
*/
private $_borderLeftSize;
private $borderLeftSize;
/**
* Border color left
*
* @var string
*/
private $_borderLeftColor;
private $borderLeftColor;
/**
* Border size right
*
* @var int
*/
private $_borderRightSize;
private $borderRightSize;
/**
* Border color right
*
* @var string
*/
private $_borderRightColor;
private $borderRightColor;
/**
* Border size bottom
*
* @var int
*/
private $_borderBottomSize;
private $borderBottomSize;
/**
* Border color bottom
*
* @var string
*/
private $_borderBottomColor;
private $borderBottomColor;
/**
* Border size inside horizontal
*
* @var int
*/
private $_borderInsideHSize;
private $borderInsideHSize;
/**
* Border color inside horizontal
*
* @var string
*/
private $_borderInsideHColor;
private $borderInsideHColor;
/**
* Border size inside vertical
*
* @var int
*/
private $_borderInsideVSize;
private $borderInsideVSize;
/**
* Border color inside vertical
*
* @var string
*/
private $_borderInsideVColor;
private $borderInsideVColor;
/**
* Create new table style
@ -149,30 +149,29 @@ class Table
public function __construct($styleTable = null, $styleFirstRow = null)
{
if (!is_null($styleFirstRow) && is_array($styleFirstRow)) {
$this->_firstRow = clone $this;
$this->firstRow = clone $this;
unset($this->_firstRow->_firstRow);
unset($this->_firstRow->_cellMarginBottom);
unset($this->_firstRow->_cellMarginTop);
unset($this->_firstRow->_cellMarginLeft);
unset($this->_firstRow->_cellMarginRight);
unset($this->_firstRow->_borderInsideVColor);
unset($this->_firstRow->_borderInsideVSize);
unset($this->_firstRow->_borderInsideHColor);
unset($this->_firstRow->_borderInsideHSize);
unset($this->firstRow->firstRow);
unset($this->firstRow->cellMarginBottom);
unset($this->firstRow->cellMarginTop);
unset($this->firstRow->cellMarginLeft);
unset($this->firstRow->cellMarginRight);
unset($this->firstRow->borderInsideVColor);
unset($this->firstRow->borderInsideVSize);
unset($this->firstRow->borderInsideHColor);
unset($this->firstRow->borderInsideHSize);
foreach ($styleFirstRow as $key => $value) {
if (substr($key, 0, 1) != '_') {
$key = '_' . $key;
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$this->_firstRow->setStyleValue($key, $value);
$this->firstRow->setStyleValue($key, $value);
}
}
if (!is_null($styleTable) && is_array($styleTable)) {
foreach ($styleTable as $key => $value) {
if (substr($key, 0, 1) != '_') {
$key = '_' . $key;
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
$this->setStyleValue($key, $value);
}
@ -187,11 +186,14 @@ class Table
*/
public function setStyleValue($key, $value)
{
if ($key == '_borderSize') {
if (substr($key, 0, 1) == '_') {
$key = substr($key, 1);
}
if ($key == 'borderSize') {
$this->setBorderSize($value);
} elseif ($key == '_borderColor') {
} elseif ($key == 'borderColor') {
$this->setBorderColor($value);
} elseif ($key == '_cellMargin') {
} elseif ($key == 'cellMargin') {
$this->setCellMargin($value);
} else {
$this->$key = $value;
@ -205,7 +207,7 @@ class Table
*/
public function getFirstRow()
{
return $this->_firstRow;
return $this->firstRow;
}
/**
@ -215,7 +217,7 @@ class Table
*/
public function getBgColor()
{
return $this->_bgColor;
return $this->bgColor;
}
/**
@ -226,7 +228,7 @@ class Table
*/
public function setBgColor($pValue = null)
{
$this->_bgColor = $pValue;
$this->bgColor = $pValue;
}
/**
@ -236,12 +238,12 @@ class Table
*/
public function setBorderSize($pValue = null)
{
$this->_borderTopSize = $pValue;
$this->_borderLeftSize = $pValue;
$this->_borderRightSize = $pValue;
$this->_borderBottomSize = $pValue;
$this->_borderInsideHSize = $pValue;
$this->_borderInsideVSize = $pValue;
$this->borderTopSize = $pValue;
$this->borderLeftSize = $pValue;
$this->borderRightSize = $pValue;
$this->borderBottomSize = $pValue;
$this->borderInsideHSize = $pValue;
$this->borderInsideVSize = $pValue;
}
/**
@ -267,12 +269,12 @@ class Table
*/
public function setBorderColor($pValue = null)
{
$this->_borderTopColor = $pValue;
$this->_borderLeftColor = $pValue;
$this->_borderRightColor = $pValue;
$this->_borderBottomColor = $pValue;
$this->_borderInsideHColor = $pValue;
$this->_borderInsideVColor = $pValue;
$this->borderTopColor = $pValue;
$this->borderLeftColor = $pValue;
$this->borderRightColor = $pValue;
$this->borderBottomColor = $pValue;
$this->borderInsideHColor = $pValue;
$this->borderInsideVColor = $pValue;
}
/**
@ -299,7 +301,7 @@ class Table
*/
public function setBorderTopSize($pValue = null)
{
$this->_borderTopSize = $pValue;
$this->borderTopSize = $pValue;
}
/**
@ -309,7 +311,7 @@ class Table
*/
public function getBorderTopSize()
{
return $this->_borderTopSize;
return $this->borderTopSize;
}
/**
@ -319,7 +321,7 @@ class Table
*/
public function setBorderTopColor($pValue = null)
{
$this->_borderTopColor = $pValue;
$this->borderTopColor = $pValue;
}
/**
@ -329,7 +331,7 @@ class Table
*/
public function getBorderTopColor()
{
return $this->_borderTopColor;
return $this->borderTopColor;
}
/**
@ -339,7 +341,7 @@ class Table
*/
public function setBorderLeftSize($pValue = null)
{
$this->_borderLeftSize = $pValue;
$this->borderLeftSize = $pValue;
}
/**
@ -349,7 +351,7 @@ class Table
*/
public function getBorderLeftSize()
{
return $this->_borderLeftSize;
return $this->borderLeftSize;
}
/**
@ -359,7 +361,7 @@ class Table
*/
public function setBorderLeftColor($pValue = null)
{
$this->_borderLeftColor = $pValue;
$this->borderLeftColor = $pValue;
}
/**
@ -369,7 +371,7 @@ class Table
*/
public function getBorderLeftColor()
{
return $this->_borderLeftColor;
return $this->borderLeftColor;
}
/**
@ -379,7 +381,7 @@ class Table
*/
public function setBorderRightSize($pValue = null)
{
$this->_borderRightSize = $pValue;
$this->borderRightSize = $pValue;
}
/**
@ -389,7 +391,7 @@ class Table
*/
public function getBorderRightSize()
{
return $this->_borderRightSize;
return $this->borderRightSize;
}
/**
@ -399,7 +401,7 @@ class Table
*/
public function setBorderRightColor($pValue = null)
{
$this->_borderRightColor = $pValue;
$this->borderRightColor = $pValue;
}
/**
@ -409,7 +411,7 @@ class Table
*/
public function getBorderRightColor()
{
return $this->_borderRightColor;
return $this->borderRightColor;
}
/**
@ -419,7 +421,7 @@ class Table
*/
public function setBorderBottomSize($pValue = null)
{
$this->_borderBottomSize = $pValue;
$this->borderBottomSize = $pValue;
}
/**
@ -429,7 +431,7 @@ class Table
*/
public function getBorderBottomSize()
{
return $this->_borderBottomSize;
return $this->borderBottomSize;
}
/**
@ -439,7 +441,7 @@ class Table
*/
public function setBorderBottomColor($pValue = null)
{
$this->_borderBottomColor = $pValue;
$this->borderBottomColor = $pValue;
}
/**
@ -449,7 +451,7 @@ class Table
*/
public function getBorderBottomColor()
{
return $this->_borderBottomColor;
return $this->borderBottomColor;
}
/**
@ -459,7 +461,7 @@ class Table
*/
public function setBorderInsideHColor($pValue = null)
{
$this->_borderInsideHColor = $pValue;
$this->borderInsideHColor = $pValue;
}
/**
@ -469,7 +471,7 @@ class Table
*/
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)
{
$this->_borderInsideVColor = $pValue;
$this->borderInsideVColor = $pValue;
}
/**
@ -489,7 +491,7 @@ class Table
*/
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)
{
$this->_borderInsideHSize = $pValue;
$this->borderInsideHSize = $pValue;
}
/**
@ -509,7 +511,7 @@ class Table
*/
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)
{
$this->_borderInsideVSize = $pValue;
$this->borderInsideVSize = $pValue;
}
/**
@ -529,7 +531,7 @@ class Table
*/
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)
{
$this->_cellMarginTop = $pValue;
$this->cellMarginTop = $pValue;
}
/**
@ -549,7 +551,7 @@ class Table
*/
public function getCellMarginTop()
{
return $this->_cellMarginTop;
return $this->cellMarginTop;
}
/**
@ -559,7 +561,7 @@ class Table
*/
public function setCellMarginLeft($pValue = null)
{
$this->_cellMarginLeft = $pValue;
$this->cellMarginLeft = $pValue;
}
/**
@ -569,7 +571,7 @@ class Table
*/
public function getCellMarginLeft()
{
return $this->_cellMarginLeft;
return $this->cellMarginLeft;
}
/**
@ -579,7 +581,7 @@ class Table
*/
public function setCellMarginRight($pValue = null)
{
$this->_cellMarginRight = $pValue;
$this->cellMarginRight = $pValue;
}
/**
@ -589,7 +591,7 @@ class Table
*/
public function getCellMarginRight()
{
return $this->_cellMarginRight;
return $this->cellMarginRight;
}
/**
@ -599,7 +601,7 @@ class Table
*/
public function setCellMarginBottom($pValue = null)
{
$this->_cellMarginBottom = $pValue;
$this->cellMarginBottom = $pValue;
}
/**
@ -609,7 +611,7 @@ class Table
*/
public function getCellMarginBottom()
{
return $this->_cellMarginBottom;
return $this->cellMarginBottom;
}
/**
@ -619,10 +621,10 @@ class Table
*/
public function setCellMargin($pValue = null)
{
$this->_cellMarginTop = $pValue;
$this->_cellMarginLeft = $pValue;
$this->_cellMarginRight = $pValue;
$this->_cellMarginBottom = $pValue;
$this->cellMarginTop = $pValue;
$this->cellMarginLeft = $pValue;
$this->cellMarginRight = $pValue;
$this->cellMarginBottom = $pValue;
}
/**
@ -632,6 +634,6 @@ class Table
*/
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
*/
private $_tabs;
private $tabs;
/**
* Create new tab collection style
@ -30,7 +30,7 @@ class Tabs
*/
public function __construct(array $tabs)
{
$this->_tabs = $tabs;
$this->tabs = $tabs;
}
/**
@ -42,7 +42,7 @@ class Tabs
{
if (isset($xmlWriter)) {
$xmlWriter->startElement("w:tabs");
foreach ($this->_tabs as &$tab) {
foreach ($this->tabs as &$tab) {
$tab->toXml($xmlWriter);
}
$xmlWriter->endElement();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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