Skip to content

Commit 8a1d07f

Browse files
committed
Fix Travis test errors
1 parent f7dd9dd commit 8a1d07f

File tree

14 files changed

+47
-32
lines changed

14 files changed

+47
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This release changed PHPWord license from LGPL 2.1 to LGPL 3.
3131
- Refactor: PHPMD recommendation: Change all `get...` method that returns `boolean` into `is...` or `has...` - @ivanlanin
3232
- Docs: Create gh-pages branch for API documentation - @Progi1984 GH-154
3333
- QA: Add `.scrutinizer.yml` and include `composer.lock` for preparation to Scrutinizer - @ivanlanin GH-186
34-
- Word2007 Writer: Refactor writer parts using composite pattern - @ivanlanin
34+
- Writer: Refactor writer parts using composite pattern - @ivanlanin
3535
- Docs: Show code quality and test code coverage badge on README
3636

3737
## 0.10.0 - 4 May 2014

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "phpoffice/phpword",
3-
"description": "PHPWord - Read, Create, and Write DOCX, ODT, and RTF documents in PHP",
3+
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (DOCX, ODT, RTF, HTML, PDF)",
44
"keywords": [
55
"PHP", "PhpOffice", "office", "PhpWord", "word", "template", "reader", "writer",
66
"docx", "OOXML", "OpenXML", "Office Open XML", "ISO IEC 29500", "WordprocessingML",
7-
"RTF", "Rich Text Format", "doc", "odt", "OpenDocument"
7+
"RTF", "Rich Text Format", "doc", "odt", "OpenDocument", "PDF", "HTML"
88
],
99
"homepage": "http://phpoffice.github.io",
1010
"type": "library",

src/PhpWord/Element/TextBox.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class TextBox extends AbstractContainer
3636
/**
3737
* Create a new textbox
3838
*
39-
* @param string $docPart
40-
* @param integer $docPartId
4139
* @param mixed $style
4240
*/
4341
public function __construct($style = null)

src/PhpWord/Style/AbstractStyle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ protected function setFloatVal($value, $default = null)
230230
*/
231231
protected function setEnumVal($value = null, $enum = array(), $default = null)
232232
{
233-
if (!is_null($value) && !empty($enum) && !in_array($value, $enum)) {
233+
if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) {
234234
throw new \InvalidArgumentException('Invalid style value.');
235-
} elseif (is_null($value)) {
235+
} elseif (is_null($value) || trim($value) == '') {
236236
$value = $default;
237237
}
238238

src/PhpWord/Style/Font.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Style;
1919

20-
use PhpOffice\PhpWord\Exception\InvalidStyleException;
2120
use PhpOffice\PhpWord\PhpWord;
2221

2322
/**
@@ -652,7 +651,7 @@ public function setShading($value = null)
652651
/**
653652
* Toggle $target property to false when $source true
654653
*
655-
* @param mixed $target Target property
654+
* @param bool $target Target property
656655
* @param bool $sourceValue
657656
*/
658657
private function toggleFalse(&$target, $sourceValue)

src/PhpWord/Style/NumberingLevel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,11 @@ public function getHint()
377377
* @param string $value
378378
* @return self
379379
*/
380-
public function setHint($value)
380+
public function setHint($value = null)
381381
{
382382
$enum = array('default', 'eastAsia', 'cs');
383383
$this->hint = $this->setEnumVal($value, $enum, $this->hint);
384+
384385
return $this;
385386
}
386387
}

src/PhpWord/Style/TextBox.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,24 @@ public function getInnerMargin()
169169
return array($this->innerMarginLeft, $this->innerMarginTop, $this->innerMarginRight, $this->innerMarginBottom);
170170
}
171171

172+
/**
173+
* Has inner margin?
174+
*
175+
* @return bool
176+
*/
177+
public function hasInnerMargins()
178+
{
179+
$hasInnerMargins = false;
180+
$margins = $this->getInnerMargins();
181+
for ($i = 0; $i < count($margins); $i++) {
182+
if (!is_null($margins[$i])) {
183+
$hasInnerMargins = true;
184+
}
185+
}
186+
187+
return $hasInnerMargins;
188+
}
189+
172190
/**
173191
* Set border size
174192
*

src/PhpWord/Writer/ODText/Element/Table.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\ODText\Element;
1919

20-
use PhpOffice\PhpWord\Element\TextBreak as TextBreakElement;
21-
use PhpOffice\PhpWord\Writer\ODText\Element\Element as ElementWriter;
22-
2320
/**
2421
* Table element writer
2522
*

src/PhpWord/Writer/Word2007/Element/TextBox.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
1919

20-
use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle;
2120
use PhpOffice\PhpWord\Writer\Word2007\Style\TextBox as TextBoxStyleWriter;
2221

2322
/**
@@ -35,11 +34,7 @@ public function write()
3534
$xmlWriter = $this->getXmlWriter();
3635
$element = $this->getElement();
3736
$style = $element->getStyle();
38-
39-
if ($style instanceof TextBoxStyle) {
40-
$styleWriter = new TextBoxStyleWriter($xmlWriter, $style);
41-
$styleWriter->write();
42-
}
37+
$styleWriter = new TextBoxStyleWriter($xmlWriter, $style);
4338

4439
if (!$this->withoutP) {
4540
$xmlWriter->startElement('w:p');
@@ -57,20 +52,15 @@ public function write()
5752
$xmlWriter->startElement('v:shape');
5853
$xmlWriter->writeAttribute('type', '#_x0000_t0202');
5954
$styleWriter->write();
60-
6155
$xmlWriter->startElement('v:textbox');
62-
$margins = implode(', ', $style->getInnerMargin());
63-
$xmlWriter->writeAttribute('inset', $margins);
64-
56+
$styleWriter->writeInnerMargin();
6557
$xmlWriter->startElement('w:txbxContent');
6658
$xmlWriter->startElement('w:p');
6759
$containerWriter = new Container($xmlWriter, $element);
6860
$containerWriter->write();
6961
$xmlWriter->endElement(); // w:p
7062
$xmlWriter->endElement(); // w:txbxContent
71-
7263
$xmlWriter->endElement(); // v: textbox
73-
7464
$styleWriter->writeW10Wrap();
7565
$xmlWriter->endElement(); // v:shape
7666
$xmlWriter->endElement(); // w:pict

src/PhpWord/Writer/Word2007/Element/TextRun.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
1919

20-
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
21-
2220
/**
2321
* TextRun element writer
2422
*

0 commit comments

Comments
 (0)