Formatted code in PHPWord_Style_Font class
This commit is contained in:
parent
1dcd267d7e
commit
f711e8a0e9
|
|
@ -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) {
|
||||
|
|
@ -189,7 +190,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);
|
||||
|
|
@ -209,7 +211,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);
|
||||
|
|
@ -221,7 +224,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
|
|
@ -231,21 +235,23 @@ 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;
|
||||
}
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get font size
|
||||
*
|
||||
* @return int|float
|
||||
*/
|
||||
public function getSize() {
|
||||
public function getSize()
|
||||
{
|
||||
return $this->_size;
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +261,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;
|
||||
}
|
||||
|
|
@ -268,7 +275,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getBold() {
|
||||
public function getBold()
|
||||
{
|
||||
return $this->_bold;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +286,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;
|
||||
}
|
||||
|
|
@ -291,7 +300,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getItalic() {
|
||||
public function getItalic()
|
||||
{
|
||||
return $this->_italic;
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +311,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;
|
||||
}
|
||||
|
|
@ -314,7 +325,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getSuperScript() {
|
||||
public function getSuperScript()
|
||||
{
|
||||
return $this->_superScript;
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +336,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;
|
||||
}
|
||||
|
|
@ -338,7 +351,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getSubScript() {
|
||||
public function getSubScript()
|
||||
{
|
||||
return $this->_subScript;
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +362,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;
|
||||
}
|
||||
|
|
@ -362,7 +377,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUnderline() {
|
||||
public function getUnderline()
|
||||
{
|
||||
return $this->_underline;
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +388,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;
|
||||
}
|
||||
|
|
@ -385,7 +402,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getStrikethrough() {
|
||||
public function getStrikethrough()
|
||||
{
|
||||
return $this->_strikethrough;
|
||||
}
|
||||
|
||||
|
|
@ -395,7 +413,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;
|
||||
}
|
||||
|
|
@ -408,7 +427,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getColor() {
|
||||
public function getColor()
|
||||
{
|
||||
return $this->_color;
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +438,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;
|
||||
}
|
||||
|
|
@ -431,7 +452,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getFgColor() {
|
||||
public function getFgColor()
|
||||
{
|
||||
return $this->_fgColor;
|
||||
}
|
||||
|
||||
|
|
@ -441,7 +463,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;
|
||||
}
|
||||
|
|
@ -451,7 +474,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStyleType() {
|
||||
public function getStyleType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
|
|
@ -460,7 +484,8 @@ class PHPWord_Style_Font {
|
|||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
*/
|
||||
public function getParagraphStyle() {
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
return $this->_paragraphStyle;
|
||||
}
|
||||
|
||||
|
|
@ -471,7 +496,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));
|
||||
}
|
||||
|
|
@ -488,24 +514,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue