Skip to content

Commit 6697057

Browse files
committed
Fix section settings failed tests
1 parent 663e900 commit 6697057

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

Classes/PHPWord/Section/Settings.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ public function getPageNumberingStart()
617617
* @return int
618618
*/
619619
public function getHeaderHeight() {
620-
return $this->headerHeight;
620+
return $this->headerHeight;
621621
}
622622

623623
/**
@@ -626,8 +626,11 @@ public function getHeaderHeight() {
626626
* @param int $pValue
627627
*/
628628
public function setHeaderHeight($pValue = '') {
629-
$this->headerHeight = $pValue;
630-
return $this;
629+
if (!is_numeric($pValue)) {
630+
$pValue = 720;
631+
}
632+
$this->headerHeight = $pValue;
633+
return $this;
631634
}
632635

633636
/**
@@ -636,7 +639,7 @@ public function setHeaderHeight($pValue = '') {
636639
* @return int
637640
*/
638641
public function getFooterHeight() {
639-
return $this->footerHeight;
642+
return $this->footerHeight;
640643
}
641644

642645
/**
@@ -645,8 +648,11 @@ public function getFooterHeight() {
645648
* @param int $pValue
646649
*/
647650
public function setFooterHeight($pValue = '') {
648-
$this->footerHeight = $pValue;
649-
return $this;
651+
if (!is_numeric($pValue)) {
652+
$pValue = 720;
653+
}
654+
$this->footerHeight = $pValue;
655+
return $this;
650656
}
651657

652658
/**
@@ -655,6 +661,9 @@ public function setFooterHeight($pValue = '') {
655661
* @param int $pValue
656662
*/
657663
public function setColsNum($pValue = '') {
664+
if (!is_numeric($pValue)) {
665+
$pValue = 1;
666+
}
658667
$this->_colsNum = $pValue;
659668
return $this;
660669
}
@@ -674,6 +683,9 @@ public function getColsNum() {
674683
* @param int $pValue
675684
*/
676685
public function setColsSpace($pValue = '') {
686+
if (!is_numeric($pValue)) {
687+
$pValue = 720;
688+
}
677689
$this->_colsSpace = $pValue;
678690
return $this;
679691
}

Tests/PHPWord/Section/SettingsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function testColumnsSpace()
217217
$this->assertEquals($iVal, $oSettings->getColsSpace());
218218

219219
$this->assertInstanceOf('PHPWord_Section_Settings', $oSettings->setColsSpace());
220-
$this->assertEquals(1, $oSettings->getColsSpace());
220+
$this->assertEquals(720, $oSettings->getColsSpace());
221221
}
222222

223223
public function testBreakType()

0 commit comments

Comments
 (0)