Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Ivan Lanin 2014-03-13 20:23:55 +07:00
commit fd95a1c1ec

View File

@ -30,8 +30,8 @@ use PhpOffice\PhpWord\Exceptions\InvalidStyleException;
/**
* Class PHPWord_Style_Font
*/
class PHPWord_Style_Font {
class PHPWord_Style_Font
{
const UNDERLINE_NONE = 'none';
const UNDERLINE_DASH = 'dash';
const UNDERLINE_DASHHEAVY = 'dashHeavy';
@ -170,7 +170,8 @@ class PHPWord_Style_Font {
* @param string $type Type of font
* @param array $paragraphStyle Paragraph styles definition
*/
public function __construct($type = 'text', $paragraphStyle = null) {
public function __construct($type = 'text', $paragraphStyle = null)
{
$this->_type = $type;
if ($paragraphStyle instanceof PHPWord_Style_Paragraph) {
@ -187,7 +188,8 @@ class PHPWord_Style_Font {
* @param array $style
* @return $this
*/
public function setArrayStyle(array $style = array()) {
public function setArrayStyle(array $style = array())
{
foreach ($style as $key => $value) {
if ($key === 'line-height') {
$this->setLineHeight($value);
@ -207,7 +209,8 @@ class PHPWord_Style_Font {
* @param string $key
* @param mixed $value
*/
public function setStyleValue($key, $value) {
public function setStyleValue($key, $value)
{
$method = 'set' . substr($key, 1);
if (method_exists($this, $method)) {
$this->$method($value);
@ -219,7 +222,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -229,7 +233,8 @@ class PHPWord_Style_Font {
* @param string $pValue
* @return PHPWord_Style_Font
*/
public function setName($pValue = PHPWord::DEFAULT_FONT_NAME) {
public function setName($pValue = PHPWord::DEFAULT_FONT_NAME)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_NAME;
}
@ -243,7 +248,8 @@ class PHPWord_Style_Font {
*
* @return int|float
*/
public function getSize() {
public function getSize()
{
return $this->_size;
}
@ -253,7 +259,8 @@ class PHPWord_Style_Font {
* @param int|float $pValue
* @return PHPWord_Style_Font
*/
public function setSize($pValue = PHPWord::DEFAULT_FONT_SIZE) {
public function setSize($pValue = PHPWord::DEFAULT_FONT_SIZE)
{
if (!is_numeric($pValue)) {
$pValue = PHPWord::DEFAULT_FONT_SIZE;
}
@ -266,7 +273,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getBold() {
public function getBold()
{
return $this->_bold;
}
@ -276,7 +284,8 @@ class PHPWord_Style_Font {
* @param bool $pValue
* @return PHPWord_Style_Font
*/
public function setBold($pValue = false) {
public function setBold($pValue = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
@ -289,7 +298,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getItalic() {
public function getItalic()
{
return $this->_italic;
}
@ -299,7 +309,8 @@ class PHPWord_Style_Font {
* @param bool $pValue
* @return PHPWord_Style_Font
*/
public function setItalic($pValue = false) {
public function setItalic($pValue = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
@ -312,7 +323,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getSuperScript() {
public function getSuperScript()
{
return $this->_superScript;
}
@ -322,7 +334,8 @@ class PHPWord_Style_Font {
* @param bool $pValue
* @return PHPWord_Style_Font
*/
public function setSuperScript($pValue = false) {
public function setSuperScript($pValue = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
@ -336,7 +349,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getSubScript() {
public function getSubScript()
{
return $this->_subScript;
}
@ -346,7 +360,8 @@ class PHPWord_Style_Font {
* @param bool $pValue
* @return PHPWord_Style_Font
*/
public function setSubScript($pValue = false) {
public function setSubScript($pValue = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
@ -360,7 +375,8 @@ class PHPWord_Style_Font {
*
* @return string
*/
public function getUnderline() {
public function getUnderline()
{
return $this->_underline;
}
@ -370,7 +386,8 @@ class PHPWord_Style_Font {
* @param string $pValue
* @return PHPWord_Style_Font
*/
public function setUnderline($pValue = PHPWord_Style_Font::UNDERLINE_NONE) {
public function setUnderline($pValue = PHPWord_Style_Font::UNDERLINE_NONE)
{
if ($pValue == '') {
$pValue = PHPWord_Style_Font::UNDERLINE_NONE;
}
@ -383,7 +400,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getStrikethrough() {
public function getStrikethrough()
{
return $this->_strikethrough;
}
@ -393,7 +411,8 @@ class PHPWord_Style_Font {
* @param bool $pValue
* @return PHPWord_Style_Font
*/
public function setStrikethrough($pValue = false) {
public function setStrikethrough($pValue = false)
{
if (!is_bool($pValue)) {
$pValue = false;
}
@ -406,7 +425,8 @@ class PHPWord_Style_Font {
*
* @return string
*/
public function getColor() {
public function getColor()
{
return $this->_color;
}
@ -416,7 +436,8 @@ class PHPWord_Style_Font {
* @param string $pValue
* @return PHPWord_Style_Font
*/
public function setColor($pValue = PHPWord::DEFAULT_FONT_COLOR) {
public function setColor($pValue = PHPWord::DEFAULT_FONT_COLOR)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_COLOR;
}
@ -429,7 +450,8 @@ class PHPWord_Style_Font {
*
* @return bool
*/
public function getFgColor() {
public function getFgColor()
{
return $this->_fgColor;
}
@ -439,7 +461,8 @@ class PHPWord_Style_Font {
* @param string $pValue
* @return PHPWord_Style_Font
*/
public function setFgColor($pValue = null) {
public function setFgColor($pValue = null)
{
$this->_fgColor = $pValue;
return $this;
}
@ -449,7 +472,8 @@ class PHPWord_Style_Font {
*
* @return string
*/
public function getStyleType() {
public function getStyleType()
{
return $this->_type;
}
@ -458,7 +482,8 @@ class PHPWord_Style_Font {
*
* @return PHPWord_Style_Paragraph
*/
public function getParagraphStyle() {
public function getParagraphStyle()
{
return $this->_paragraphStyle;
}
@ -469,7 +494,8 @@ class PHPWord_Style_Font {
* @return $this
* @throws InvalidStyleException
*/
public function setLineHeight($lineHeight) {
public function setLineHeight($lineHeight)
{
if (is_string($lineHeight)) {
$lineHeight = floatval(preg_replace('/[^0-9\.\,]/', '', $lineHeight));
}
@ -486,24 +512,29 @@ class PHPWord_Style_Font {
/**
* @return int|float
*/
public function getLineHeight() {
public function getLineHeight()
{
return $this->lineHeight;
}
/**
* Get Font Content Type
*
* @return bool
*/
public function getHint() {
public function getHint()
{
return $this->_hint;
}
/**
* Set Font Content Type
*
* @param string $pValue
* @return PHPWord_Style_Font
*/
public function setHint($pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE) {
public function setHint($pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE)
{
if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE;
}