general updates

Change "some" code to comply to php-cs rules
Update copyright year to 2010-2017
This commit is contained in:
troosan 2017-09-24 22:15:42 +02:00
commit a8ade6d22d
383 changed files with 1287 additions and 1805 deletions

View File

@ -1,8 +1,8 @@
<?php
$finder = PhpCsFixer\Finder::create()
->exclude('vendor')
->notPath('src/PhpWord/Shared/PCLZip/pclzip.lib.php')
->notName('pclzip.lib.php')
->notName('OLERead.php')
->in('samples')
->in('src')
->in('tests');
@ -10,18 +10,18 @@ $finder = PhpCsFixer\Finder::create()
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'array_syntax' => ['syntax' => 'long'],
'binary_operator_spaces' => ['align_double_arrow' => true],
->setRules(array(
'array_syntax' => array('syntax' => 'long'),
'binary_operator_spaces' => array('align_double_arrow' => true),
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_after_opening_tag' => false,
'blank_line_before_return' => true,
'braces' => true,
'cast_spaces' => true,
'class_definition' => true,
'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'concat_space' => array('spacing' => 'one'),
'declare_equal_normalize' => true,
'declare_strict_types' => false, // Too early to adopt strict types
'dir_constant' => true,
@ -58,7 +58,7 @@ return PhpCsFixer\Config::create()
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'],
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'useTrait', 'curly_brace_block', 'parenthesis_brace_block', 'square_brace_block'),
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
@ -99,7 +99,7 @@ return PhpCsFixer\Config::create()
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => false, //@see instead of @link
'phpdoc_no_empty_return' => true,
'phpdoc_no_empty_return' => false, //TODO: reactivate
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
@ -113,7 +113,7 @@ return PhpCsFixer\Config::create()
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => false,
'pre_increment' => true,
'pre_increment' => false,
'protected_to_private' => true,
'psr0' => true,
'psr4' => true,
@ -143,4 +143,4 @@ return PhpCsFixer\Config::create()
'unary_operator_spaces' => true,
'visibility_required' => true,
'whitespace_after_comma_in_array' => true,
]);
));

View File

@ -22,6 +22,7 @@ cache:
directories:
- vendor
- $HOME/.composer/cache
- $HOME/.php-cs-fixer
env:
global:
@ -46,7 +47,7 @@ script:
## PHP_CodeSniffer
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip ; fi
## PHP-CS-Fixer
#- if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run ; fi
- if [ -z "$COVERAGE" ]; then ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run --cache-dir=$HOME/.php-cs-fixer ; fi
## PHP Mess Detector
- if [ -z "$COVERAGE" ]; then ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php ; fi
## PHPUnit

View File

@ -11,7 +11,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

14
run_tests.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
## PHP_CodeSniffer
./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
## PHP-CS-Fixer
./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run
## PHP Mess Detector
./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
## PHPUnit
./vendor/bin/phpunit -c ./ --no-coverage

View File

@ -14,7 +14,7 @@ $phpWord->addParagraphStyle(
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
)
),
)
);

View File

@ -50,7 +50,7 @@ for ($i = 1; $i <= 8; $i++) {
$table->addCell(500)->addText($text);
}
/**
/*
* 3. colspan (gridSpan) and rowspan (vMerge)
* ---------------------
* | | B | |
@ -93,7 +93,7 @@ $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered);
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
$table->addCell(null, $cellRowContinue);
/**
/*
* 4. colspan (gridSpan) and rowspan (vMerge)
* ---------------------
* | | B | 1 |
@ -104,6 +104,7 @@ $table->addCell(null, $cellRowContinue);
* ---------------------
* @see https://github.com/PHPOffice/PHPWord/issues/806
*/
$section->addPageBreak();
$section->addText('Table with colspan and rowspan', $header);
@ -114,12 +115,12 @@ $table = $section->addTable('Colspan Rowspan');
$row = $table->addRow();
$row->addCell(null, array('vMerge' => 'restart'))->addText('A');
$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart',))->addText('B');
$row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B');
$row->addCell()->addText('1');
$row = $table->addRow();
$row->addCell(null, array('vMerge' => 'continue'));
$row->addCell(null, array('vMerge' => 'continue','gridSpan' => 2,));
$row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2));
$row->addCell()->addText('2');
$row = $table->addRow();
$row->addCell(null, array('vMerge' => 'continue'));

View File

@ -23,7 +23,7 @@ $section->addImage($source);
// Image from string
$source = 'resources/_mars.jpg';
$fileContent = file_get_contents($source);
$section->addText("Image from string");
$section->addText('Image from string');
$section->addImage($fileContent);
//Wrapping style

View File

@ -28,7 +28,7 @@ $textrun->addText('here:');
$indexEntryText = new TextRun();
$indexEntryText->addText('My ');
$indexEntryText->addText('bold index', ['bold' => true]);
$indexEntryText->addText('bold index', array('bold' => true));
$indexEntryText->addText(' entry');
$textrun = $section->addTextRun();

View File

@ -47,7 +47,7 @@ $image->setCommentRangeStart($commentOnImage);
$section->addTextBreak(2);
// We can also do things the other way round, link the comment to the element
$anotherText = $section->addText("another text");
$anotherText = $section->addText('another text');
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
$comment1->addText('Test', array('bold' => true));
@ -55,7 +55,6 @@ $comment1->setStartElement($anotherText);
$comment1->setEndElement($anotherText);
$phpWord->addComment($comment1);
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {

View File

@ -89,8 +89,8 @@ function getEndingNotes($writers)
// Do not show execution time for index
if (!IS_INDEX) {
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
$result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
$result .= date('H:i:s') . ' Done writing file(s)' . EOL;
$result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL;
}
// Return

View File

@ -25,14 +25,14 @@ if (!CLI) {
<?php
}
if (!CLI) {
echo "<h3>Requirement check:</h3>";
echo "<ul>";
echo '<h3>Requirement check:</h3>';
echo '<ul>';
foreach ($requirements as $key => $value) {
list($label, $result) = $value;
$status = $result ? 'passed' : 'failed';
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
}
echo "</ul>";
echo '</ul>';
include_once 'Sample_Footer.php';
} else {
echo 'Requirement check:' . PHP_EOL;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**
@ -51,9 +50,9 @@ abstract class AbstractCollection
{
if (array_key_exists($index, $this->items)) {
return $this->items[$index];
} else {
return null;
}
return null;
}
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Collection;
/**

View File

@ -11,7 +11,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\ComplexType;
@ -25,7 +25,6 @@ use PhpOffice\PhpWord\SimpleType\NumberFormat;
*/
final class FootnoteProperties
{
const RESTART_NUMBER_CONTINUOUS = 'continuous';
const RESTART_NUMBER_EACH_SECTION = 'eachSect';
const RESTART_NUMBER_EACH_PAGE = 'eachPage';
@ -52,7 +51,7 @@ final class FootnoteProperties
/**
* Footnote and Endnote Numbering Starting Value
*
* @var double
* @var float
*/
private $numStart;
@ -86,14 +85,15 @@ final class FootnoteProperties
self::POSITION_PAGE_BOTTOM,
self::POSITION_BENEATH_TEXT,
self::POSITION_SECTION_END,
self::POSITION_DOC_END
self::POSITION_DOC_END,
);
if (in_array($pos, $position)) {
$this->pos = $pos;
} else {
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $position) . " possible");
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $position) . ' possible');
}
return $this;
}
@ -117,13 +117,14 @@ final class FootnoteProperties
{
NumberFormat::validate($numFmt);
$this->numFmt = $numFmt;
return $this;
}
/**
* Get the Footnote Numbering Format
*
* @return double
* @return float
*/
public function getNumStart()
{
@ -133,12 +134,13 @@ final class FootnoteProperties
/**
* Set the Footnote Numbering Format
*
* @param double $numStart
* @param float $numStart
* @return self
*/
public function setNumStart($numStart)
{
$this->numStart = $numStart;
return $this;
}
@ -164,14 +166,15 @@ final class FootnoteProperties
$restartNumbers = array(
self::RESTART_NUMBER_CONTINUOUS,
self::RESTART_NUMBER_EACH_SECTION,
self::RESTART_NUMBER_EACH_PAGE
self::RESTART_NUMBER_EACH_PAGE,
);
if (in_array($numRestart, $restartNumbers)) {
$this->numRestart = $numRestart;
} else {
throw new \InvalidArgumentException("Invalid value, on of " . implode(', ', $restartNumbers) . " possible");
throw new \InvalidArgumentException('Invalid value, on of ' . implode(', ', $restartNumbers) . ' possible');
}
return $this;
}
}

View File

@ -11,7 +11,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\ComplexType;
@ -23,7 +23,6 @@ namespace PhpOffice\PhpWord\ComplexType;
*/
final class ProofState
{
/**
* Check Completed
*/
@ -60,8 +59,9 @@ final class ProofState
if ($spelling == self::CLEAN || $spelling == self::DIRTY) {
$this->spelling = $spelling;
} else {
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
}
return $this;
}
@ -87,8 +87,9 @@ final class ProofState
if ($grammar == self::CLEAN || $grammar == self::DIRTY) {
$this->grammar = $grammar;
} else {
throw new \InvalidArgumentException("Invalid value, dirty or clean possible");
throw new \InvalidArgumentException('Invalid value, dirty or clean possible');
}
return $this;
}

View File

@ -11,7 +11,7 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\ComplexType;
@ -23,46 +23,45 @@ namespace PhpOffice\PhpWord\ComplexType;
*/
final class TrackChangesView
{
/**
* Display Visual Indicator Of Markup Area
*
* @var boolean
* @var bool
*/
private $markup;
/**
* Display Comments
*
* @var boolean
* @var bool
*/
private $comments;
/**
* Display Content Revisions
*
* @var boolean
* @var bool
*/
private $insDel;
/**
* Display Formatting Revisions
*
* @var boolean
* @var bool
*/
private $formatting;
/**
* Display Ink Annotations
*
* @var boolean
* @var bool
*/
private $inkAnnotations;
/**
* Get Display Visual Indicator Of Markup Area
*
* @return boolean True if markup is shown
* @return bool True if markup is shown
*/
public function hasMarkup()
{
@ -72,7 +71,7 @@ final class TrackChangesView
/**
* Set Display Visual Indicator Of Markup Area
*
* @param boolean $markup
* @param bool $markup
* Set to true to show markup
*/
public function setMarkup($markup)
@ -83,7 +82,7 @@ final class TrackChangesView
/**
* Get Display Comments
*
* @return boolean True if comments are shown
* @return bool True if comments are shown
*/
public function hasComments()
{
@ -93,7 +92,7 @@ final class TrackChangesView
/**
* Set Display Comments
*
* @param boolean $comments
* @param bool $comments
* Set to true to show comments
*/
public function setComments($comments)
@ -104,7 +103,7 @@ final class TrackChangesView
/**
* Get Display Content Revisions
*
* @return boolean True if content revisions are shown
* @return bool True if content revisions are shown
*/
public function hasInsDel()
{
@ -114,7 +113,7 @@ final class TrackChangesView
/**
* Set Display Content Revisions
*
* @param boolean $insDel
* @param bool $insDel
* Set to true to show content revisions
*/
public function setInsDel($insDel)
@ -125,7 +124,7 @@ final class TrackChangesView
/**
* Get Display Formatting Revisions
*
* @return boolean True if formatting revisions are shown
* @return bool True if formatting revisions are shown
*/
public function hasFormatting()
{
@ -135,7 +134,7 @@ final class TrackChangesView
/**
* Set Display Formatting Revisions
*
* @param boolean $insDel
* @param bool $formatting
* Set to true to show formatting revisions
*/
public function setFormatting($formatting)
@ -146,7 +145,7 @@ final class TrackChangesView
/**
* Get Display Ink Annotations
*
* @return boolean True if ink annotations are shown
* @return bool True if ink annotations are shown
*/
public function hasInkAnnotations()
{
@ -156,7 +155,7 @@ final class TrackChangesView
/**
* Set Display Ink Annotations
*
* @param boolean $inkAnnotations
* @param bool $inkAnnotations
* Set to true to show ink annotations
*/
public function setInkAnnotations($inkAnnotations)

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**
@ -37,7 +36,7 @@ namespace PhpOffice\PhpWord\Element;
* @method PageBreak addPageBreak()
* @method Table addTable(mixed $style = null)
* @method Image addImage(string $source, mixed $style = null, bool $isWatermark = false)
* @method Object addObject(string $source, mixed $style = null)
* @method \PhpOffice\PhpWord\Element\Object addObject(string $source, mixed $style = null)
* @method TextBox addTextBox(mixed $style = null)
* @method Field addField(string $type = null, array $properties = array(), array $options = array(), mixed $text = null)
* @method Line addLine(mixed $lineStyle = null)
@ -83,7 +82,7 @@ abstract class AbstractContainer extends AbstractElement
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object',
'Footnote', 'Endnote', 'CheckBox', 'TextBox', 'Field',
'Line', 'Shape', 'Title', 'TOC', 'PageBreak',
'Chart', 'FormField', 'SDT', 'Comment'
'Chart', 'FormField', 'SDT', 'Comment',
);
$functions = array();
foreach ($elements as $element) {
@ -105,9 +104,8 @@ abstract class AbstractContainer extends AbstractElement
for ($i = 1; $i <= $count; $i++) {
$this->addElement($element, $fontStyle, $paragraphStyle);
}
// All other elements
} else {
// All other elements
array_unshift($args, $element); // Prepend element name to the beginning of args array
return call_user_func_array(array($this, 'addElement'), $args);
}
@ -181,9 +179,8 @@ abstract class AbstractContainer extends AbstractElement
*
* @param string $method
*
* @return bool
*
* @throws \BadMethodCallException
* @return bool
*/
private function checkValidity($method)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Media;
@ -142,7 +141,6 @@ abstract class AbstractElement
* Set PhpWord as reference.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function setPhpWord(PhpWord $phpWord = null)
{
@ -164,7 +162,6 @@ abstract class AbstractElement
*
* @param string $docPart
* @param int $docPartId
* @return void
*/
public function setDocPart($docPart, $docPartId = 1)
{
@ -221,7 +218,6 @@ abstract class AbstractElement
* Set element index.
*
* @param int $value
* @return void
*/
public function setElementIndex($value)
{
@ -240,8 +236,6 @@ abstract class AbstractElement
/**
* Set element unique ID from 6 first digit of md5.
*
* @return void
*/
public function setElementId()
{
@ -262,7 +256,6 @@ abstract class AbstractElement
* Set relation Id.
*
* @param int $value
* @return void
*/
public function setRelationId($value)
{
@ -297,7 +290,7 @@ abstract class AbstractElement
public function setCommentRangeStart(Comment $value)
{
if ($this instanceof Comment) {
throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
throw new \InvalidArgumentException('Cannot set a Comment on a Comment');
}
$this->commentRangeStart = $value;
$this->commentRangeStart->setStartElement($this);
@ -317,12 +310,11 @@ abstract class AbstractElement
* Set comment end
*
* @param Comment $value
* @return void
*/
public function setCommentRangeEnd(Comment $value)
{
if ($this instanceof Comment) {
throw new \InvalidArgumentException("Cannot set a Comment on a Comment");
throw new \InvalidArgumentException('Cannot set a Comment on a Comment');
}
$this->commentRangeEnd = $value;
$this->commentRangeEnd->setEndElement($this);
@ -334,7 +326,6 @@ abstract class AbstractElement
* Passed parameter should be a container, except for Table (contain Row) and Row (contain Cell)
*
* @param \PhpOffice\PhpWord\Element\AbstractElement $container
* @return void
*/
public function setParentContainer(AbstractElement $container)
{
@ -363,8 +354,6 @@ abstract class AbstractElement
*
* - Image element needs to be passed to Media object
* - Icon needs to be set for Object element
*
* @return void
*/
private function setMediaRelation()
{
@ -391,8 +380,6 @@ abstract class AbstractElement
/**
* Set relation Id for elements that will be registered in the Collection subnamespaces.
*
* @return void
*/
private function setCollectionRelation()
{
@ -411,7 +398,7 @@ abstract class AbstractElement
*/
public function isInSection()
{
return ($this->docPart == 'Section');
return $this->docPart == 'Section';
}
/**
@ -441,9 +428,8 @@ abstract class AbstractElement
* @param array $enum
* @param mixed $default
*
* @return mixed
*
* @throws \InvalidArgumentException
* @return mixed
*
* @todo Merge with the same method in AbstractStyle
*/

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;
@ -45,8 +44,8 @@ class Bookmark extends AbstractElement
*/
public function __construct($name)
{
$this->name = CommonText::toUTF8($name);
return $this;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Cell as CellStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Chart as ChartStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**
@ -61,6 +60,7 @@ class Comment extends TrackChange
{
parent::__construct($author, $date);
$this->initials = $initials;
return $this;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Paragraph;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**
@ -36,32 +35,32 @@ class Field extends AbstractElement
'properties' => array(
'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'),
),
'options'=>array('PreserveFormat')
'options' => array('PreserveFormat'),
),
'NUMPAGES' => array(
'properties' => array(
'format' => array('Arabic', 'ArabicDash', 'CardText', 'DollarText', 'Ordinal', 'OrdText',
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper'),
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%')
'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN', 'Caps', 'FirstCap', 'Lower', 'Upper', ),
'numformat' => array('0', '0,00', '#.##0', '#.##0,00', '€ #.##0,00(€ #.##0,00)', '0%', '0,00%'),
),
'options'=>array('PreserveFormat')
'options' => array('PreserveFormat'),
),
'DATE' => array(
'properties' => array(
'dateformat' => array('d-M-yyyy', 'dddd d MMMM yyyy', 'd MMMM yyyy', 'd-M-yy', 'yyyy-MM-dd',
'd-MMM-yy', 'd/M/yyyy', 'd MMM. yy', 'd/M/yy', 'MMM-yy', 'd-M-yyy H:mm', 'd-M-yyyy H:mm:ss',
'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss')
'h:mm am/pm', 'h:mm:ss am/pm', 'HH:mm', 'HH:mm:ss', ),
),
'options'=>array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat')
'options' => array('PreserveFormat', 'LunarCalendar', 'SakaEraCalendar', 'LastUsedFormat'),
),
'XE' => array(
'properties' => array(),
'options' => array('Bold', 'Italic')
'options' => array('Bold', 'Italic'),
),
'INDEX' => array(
'properties' => array(),
'options' => array('PreserveFormat')
)
'options' => array('PreserveFormat'),
),
);
/**
@ -113,9 +112,8 @@ class Field extends AbstractElement
*
* @param string $type
*
* @return string
*
* @throws \InvalidArgumentException
* @return string
*/
public function setType($type = null)
{
@ -126,6 +124,7 @@ class Field extends AbstractElement
throw new \InvalidArgumentException("Invalid type '$type'");
}
}
return $this->type;
}
@ -144,9 +143,8 @@ class Field extends AbstractElement
*
* @param array $properties
*
* @return self
*
* @throws \InvalidArgumentException
* @return self
*/
public function setProperties($properties = array())
{
@ -158,6 +156,7 @@ class Field extends AbstractElement
}
$this->properties = array_merge($this->properties, $properties);
}
return $this->properties;
}
@ -176,9 +175,8 @@ class Field extends AbstractElement
*
* @param array $options
*
* @return self
*
* @throws \InvalidArgumentException
* @return self
*/
public function setOptions($options = array())
{
@ -190,6 +188,7 @@ class Field extends AbstractElement
}
$this->options = array_merge($this->options, $options);
}
return $this->options;
}
@ -208,9 +207,8 @@ class Field extends AbstractElement
*
* @param string | TextRun $text
*
* @return string | TextRun
*
* @throws \InvalidArgumentException
* @return string | TextRun
*/
public function setText($text)
{
@ -218,9 +216,10 @@ class Field extends AbstractElement
if (is_string($text) || $text instanceof TextRun) {
$this->text = $text;
} else {
throw new \InvalidArgumentException("Invalid text");
throw new \InvalidArgumentException('Invalid text');
}
}
return $this->text;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Paragraph;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
@ -61,7 +60,7 @@ class Image extends AbstractElement
/**
* Is watermark
*
* @var boolean
* @var bool
*/
private $watermark;
@ -96,7 +95,7 @@ class Image extends AbstractElement
/**
* Is memory image
*
* @var boolean
* @var bool
*/
private $memoryImage;
@ -110,7 +109,7 @@ class Image extends AbstractElement
/**
* Image media index
*
* @var integer
* @var int
*/
private $mediaIndex;
@ -126,7 +125,7 @@ class Image extends AbstractElement
*
* @param string $source
* @param mixed $style
* @param boolean $watermark
* @param bool $watermark
*
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
@ -183,7 +182,7 @@ class Image extends AbstractElement
/**
* Get is watermark
*
* @return boolean
* @return bool
*/
public function isWatermark()
{
@ -193,7 +192,7 @@ class Image extends AbstractElement
/**
* Set is watermark
*
* @param boolean $value
* @param bool $value
*/
public function setIsWatermark($value)
{
@ -243,7 +242,7 @@ class Image extends AbstractElement
/**
* Get is memory image
*
* @return boolean
* @return bool
*/
public function isMemImage()
{
@ -264,7 +263,6 @@ class Image extends AbstractElement
* Set target file name.
*
* @param string $value
* @return void
*/
public function setTarget($value)
{
@ -274,7 +272,7 @@ class Image extends AbstractElement
/**
* Get media index
*
* @return integer
* @return int
*/
public function getMediaIndex()
{
@ -284,8 +282,7 @@ class Image extends AbstractElement
/**
* Set media index.
*
* @param integer $value
* @return void
* @param int $value
*/
public function setMediaIndex($value)
{
@ -368,8 +365,6 @@ class Image extends AbstractElement
/**
* Check memory image, supported type, image functions, and proportional width/height.
*
* @return void
*
* @throws \PhpOffice\PhpWord\Exception\InvalidImageException
* @throws \PhpOffice\PhpWord\Exception\UnsupportedImageTypeException
*/
@ -407,8 +402,6 @@ class Image extends AbstractElement
/**
* Set source type.
*
* @return void
*/
private function setSourceType()
{
@ -443,9 +436,9 @@ class Image extends AbstractElement
*
* @param string $source
*
* @return array|null
*
* @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException
*
* @return array|null
*/
private function getArchiveImageSize($source)
{
@ -483,19 +476,19 @@ class Image extends AbstractElement
*/
private function getStringImageSize($source)
{
$result = false;
if (!function_exists('getimagesizefromstring')) {
$uri = 'data://application/octet-stream;base64,' . base64_encode($source);
return @getimagesize($uri);
$result = @getimagesize($uri);
} else {
return @getimagesizefromstring($source);
$result = @getimagesizefromstring($source);
}
return false;
return $result;
}
/**
* Set image functions and extensions.
*
* @return void
*/
private function setFunctions()
{
@ -530,9 +523,8 @@ class Image extends AbstractElement
/**
* Set proportional width/height if one dimension not available.
*
* @param integer $actualWidth
* @param integer $actualHeight
* @return void
* @param int $actualWidth
* @param int $actualHeight
*/
private function setProportionalSize($actualWidth, $actualHeight)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Line as LineStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;
@ -75,6 +74,7 @@ class Link extends AbstractElement
* @param string $text
* @param mixed $fontStyle
* @param mixed $paragraphStyle
* @param bool $internal
*/
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
{
@ -83,6 +83,7 @@ class Link extends AbstractElement
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
$this->internal = $internal;
return $this;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Exception\InvalidObjectException;
@ -84,9 +83,9 @@ class Object extends AbstractElement
$this->icon = realpath(__DIR__ . "/../resources/{$ext}.png");
return $this;
} else {
throw new InvalidObjectException();
}
throw new InvalidObjectException();
}
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;
@ -47,7 +46,6 @@ class PreserveText extends AbstractElement
*/
private $paragraphStyle;
/**
* Create a new Preserve Text Element
*

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Row as RowStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\ComplexType\FootnoteProperties;
@ -172,7 +171,7 @@ class Section extends AbstractContainer
* If any of the Header instances have a type of Header::FIRST then this method returns true.
* False otherwise.
*
* @return boolean
* @return bool
*/
public function hasDifferentFirstPage()
{
@ -186,6 +185,7 @@ class Section extends AbstractContainer
return true;
}
}
return false;
}
@ -195,11 +195,11 @@ class Section extends AbstractContainer
* @since 0.10.0
*
* @param string $type
* @param boolean $header
*
* @return Header|Footer
* @param bool $header
*
* @throws \Exception
*
* @return Header|Footer
*/
private function addHeaderFooter($type = Header::AUTO, $header = true)
{
@ -215,11 +215,10 @@ class Section extends AbstractContainer
$container->setPhpWord($this->phpWord);
$collection[$index] = $container;
return $container;
} else {
throw new \Exception('Invalid header/footer type.');
}
return $container;
}
throw new \Exception('Invalid header/footer type.');
}
/**
@ -291,8 +290,8 @@ class Section extends AbstractContainer
{
if (empty($this->footers)) {
return null;
} else {
}
return $this->footers[1];
}
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Shape as ShapeStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\PhpWord;
@ -54,14 +53,13 @@ class TOC extends AbstractElement
*/
private $maxDepth = 9;
/**
* Create a new Table-of-Contents Element
*
* @param mixed $fontStyle
* @param array $tocStyle
* @param integer $minDepth
* @param integer $maxDepth
* @param int $minDepth
* @param int $maxDepth
*/
public function __construct($fontStyle = null, $tocStyle = null, $minDepth = 1, $maxDepth = 9)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Table as TableStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;
@ -105,12 +104,12 @@ class Text extends AbstractElement
public function setParagraphStyle($style = null)
{
if (is_array($style)) {
$this->paragraphStyle = new Paragraph;
$this->paragraphStyle = new Paragraph();
$this->paragraphStyle->setStyleByArray($style);
} elseif ($style instanceof Paragraph) {
$this->paragraphStyle = $style;
} elseif (null === $style) {
$this->paragraphStyle = new Paragraph;
$this->paragraphStyle = new Paragraph();
} else {
$this->paragraphStyle = $style;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Font;
@ -74,6 +73,7 @@ class TextBreak extends AbstractElement
$this->fontStyle = $style;
$this->setParagraphStyle($paragraphStyle);
}
return $this->fontStyle;
}
@ -96,13 +96,14 @@ class TextBreak extends AbstractElement
public function setParagraphStyle($style = null)
{
if (is_array($style)) {
$this->paragraphStyle = new Paragraph;
$this->paragraphStyle = new Paragraph();
$this->paragraphStyle->setStyleByArray($style);
} elseif ($style instanceof Paragraph) {
$this->paragraphStyle = $style;
} else {
$this->paragraphStyle = $style;
}
return $this->paragraphStyle;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\PhpWord\Style\Paragraph;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
use PhpOffice\Common\Text as CommonText;
@ -83,7 +82,7 @@ class Title extends AbstractElement
/**
* Get depth
*
* @return integer
* @return int
*/
public function getDepth()
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Element;
/**
@ -49,9 +48,9 @@ class TrackChange extends AbstractContainer
*/
public function __construct($author, \DateTime $date)
{
$this->author = $author;
$this->date = $date;
return $this;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Escaper;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Escaper;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Escaper;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Escaper;
/**
@ -28,9 +27,9 @@ class Rtf extends AbstractEscaper
{
if (20 > $code || $code >= 80) {
return '{\u' . $code . '}';
} else {
return chr($code);
}
return chr($code);
}
protected function escapeMultibyteCharacter($code)
@ -40,6 +39,7 @@ class Rtf extends AbstractEscaper
/**
* @see http://www.randomchaos.com/documents/?source=php_and_unicode
* @param string $input
*/
protected function escapeSingleValue($input)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Escaper;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**
@ -23,10 +22,10 @@ namespace PhpOffice\PhpWord\Exception;
final class CopyFileException extends Exception
{
/**
* @param string $source The fully qualified source file name.
* @param string $destination The fully qualified destination file name.
* @param integer $code The user defined exception code.
* @param \Exception $previous The previous exception used for the exception chaining.
* @param string $source The fully qualified source file name
* @param string $destination The fully qualified destination file name
* @param int $code The user defined exception code
* @param \Exception $previous The previous exception used for the exception chaining
*/
final public function __construct($source, $destination, $code = 0, \Exception $previous = null)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**
@ -23,8 +22,8 @@ namespace PhpOffice\PhpWord\Exception;
final class CreateTemporaryFileException extends Exception
{
/**
* @param integer $code The user defined exception code.
* @param \Exception $previous The previous exception used for the exception chaining.
* @param int $code The user defined exception code
* @param \Exception $previous The previous exception used for the exception chaining
*/
final public function __construct($code = 0, \Exception $previous = null)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
use InvalidArgumentException;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Exception;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord;
use PhpOffice\PhpWord\Exception\Exception;
@ -29,9 +28,9 @@ abstract class IOFactory
* @param PhpWord $phpWord
* @param string $name
*
* @return WriterInterface
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return WriterInterface
*/
public static function createWriter(PhpWord $phpWord, $name = 'Word2007')
{
@ -49,9 +48,9 @@ abstract class IOFactory
*
* @param string $name
*
* @return ReaderInterface
*
* @throws Exception
*
* @return ReaderInterface
*/
public static function createReader($name = 'Word2007')
{
@ -65,19 +64,19 @@ abstract class IOFactory
* @param string $name
* @param \PhpOffice\PhpWord\PhpWord $phpWord
*
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return \PhpOffice\PhpWord\Writer\WriterInterface|\PhpOffice\PhpWord\Reader\ReaderInterface
*/
private static function createObject($type, $name, $phpWord = null)
{
$class = "PhpOffice\\PhpWord\\{$type}\\{$name}";
if (class_exists($class) && self::isConcreteClass($class)) {
return new $class($phpWord);
} else {
}
throw new Exception("\"{$name}\" is not a valid {$type}.");
}
}
/**
* Loads PhpWord from file
*
@ -89,8 +88,10 @@ abstract class IOFactory
{
/** @var \PhpOffice\PhpWord\Reader\ReaderInterface $reader */
$reader = self::createReader($readerName);
return $reader->load($filename);
}
/**
* Check if it's a concrete class (not abstract nor interface)
*
@ -100,6 +101,7 @@ abstract class IOFactory
private static function isConcreteClass($class)
{
$reflection = new \ReflectionClass($class);
return !$reflection->isAbstract() && !$reflection->isInterface();
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord;
use PhpOffice\PhpWord\Element\Image;
@ -43,9 +42,9 @@ class Media
* @param string $source
* @param \PhpOffice\PhpWord\Element\Image $image
*
* @return integer
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return int
*/
public static function addElement($container, $mediaType, $source, Image $image = null)
{
@ -83,12 +82,10 @@ class Media
$image->setTarget($target);
$image->setMediaIndex($mediaTypeCount);
break;
// Objects
case 'object':
$target = "{$container}_oleObject{$mediaTypeCount}.bin";
break;
// Links
case 'link':
$target = $source;
@ -100,23 +97,25 @@ class Media
$mediaData['type'] = $mediaType;
$mediaData['rID'] = $rId;
self::$elements[$container][$mediaId] = $mediaData;
return $rId;
} else {
}
$mediaData = self::$elements[$container][$mediaId];
if (!is_null($image)) {
$image->setTarget($mediaData['target']);
$image->setMediaIndex($mediaData['mediaIndex']);
}
return $mediaData['rID'];
}
}
/**
* Get media elements count
*
* @param string $container section|headerx|footerx|footnote|endnote
* @param string $mediaType image|object|link
* @return integer
* @return int
* @since 0.10.0
*/
public static function countElements($container, $mediaType = null)
@ -157,14 +156,16 @@ class Media
$elements[$key] = $val;
}
}
return $elements;
} else {
}
if (!isset(self::$elements[$container])) {
return $elements;
}
return self::getElementsByType($container, $type);
}
}
/**
* Get elements by media type
@ -208,7 +209,7 @@ class Media
* @param string $type
* @param \PhpOffice\PhpWord\Element\Image $image
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -224,7 +225,7 @@ class Media
*
* @param string $linkSrc
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -256,7 +257,7 @@ class Media
*
* @param string $key
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -270,11 +271,11 @@ class Media
*
* @deprecated 0.10.0
*
* @param integer $headerCount
* @param int $headerCount
* @param string $src
* @param \PhpOffice\PhpWord\Element\Image $image
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -290,7 +291,7 @@ class Media
*
* @param string $key
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -318,11 +319,11 @@ class Media
*
* @deprecated 0.10.0
*
* @param integer $footerCount
* @param int $footerCount
* @param string $src
* @param \PhpOffice\PhpWord\Element\Image $image
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/
@ -338,7 +339,7 @@ class Media
*
* @param string $key
*
* @return integer
* @return int
*
* @codeCoverageIgnore
*/

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Metadata;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Metadata;
/**
@ -399,7 +398,7 @@ class DocInfo
* Check if a Custom Property is defined
*
* @param string $propertyName
* @return boolean
* @return bool
*/
public function isCustomPropertySet($propertyName)
{
@ -416,9 +415,9 @@ class DocInfo
{
if ($this->isCustomPropertySet($propertyName)) {
return $this->customProperties[$propertyName]['value'];
} else {
return null;
}
return null;
}
/**
@ -431,9 +430,9 @@ class DocInfo
{
if ($this->isCustomPropertySet($propertyName)) {
return $this->customProperties[$propertyName]['type'];
} else {
return null;
}
return null;
}
/**
@ -456,7 +455,7 @@ class DocInfo
self::PROPERTY_TYPE_FLOAT,
self::PROPERTY_TYPE_STRING,
self::PROPERTY_TYPE_DATE,
self::PROPERTY_TYPE_BOOLEAN
self::PROPERTY_TYPE_BOOLEAN,
);
if (($propertyType === null) || (!in_array($propertyType, $propertyTypes))) {
if ($propertyValue === null) {
@ -474,8 +473,9 @@ class DocInfo
$this->customProperties[$propertyName] = array(
'value' => $propertyValue,
'type' => $propertyType
'type' => $propertyType,
);
return $this;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Metadata;
/**

View File

@ -11,14 +11,14 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Metadata;
use PhpOffice\PhpWord\ComplexType\ProofState;
use PhpOffice\PhpWord\SimpleType\Zoom;
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
use PhpOffice\PhpWord\SimpleType\Zoom;
/**
* Setting class
@ -28,7 +28,6 @@ use PhpOffice\PhpWord\ComplexType\TrackChangesView;
*/
class Settings
{
/**
* Magnification Setting
*
@ -40,14 +39,14 @@ class Settings
/**
* Hide spelling errors
*
* @var boolean
* @var bool
*/
private $hideSpellingErrors = false;
/**
* Hide grammatical errors
*
* @var boolean
* @var bool
*/
private $hideGrammaticalErrors = false;
@ -61,21 +60,21 @@ class Settings
/**
* Track Revisions to Document
*
* @var boolean
* @var bool
*/
private $trackRevisions = false;
/**
* Do Not Use Move Syntax When Tracking Revisions
*
* @var boolean
* @var bool
*/
private $doNotTrackMoves = false;
/**
* Do Not Track Formatting Revisions When Tracking Revisions
*
* @var boolean
* @var bool
*/
private $doNotTrackFormatting = false;
@ -115,6 +114,7 @@ class Settings
if ($this->documentProtection == null) {
$this->documentProtection = new Protection();
}
return $this->documentProtection;
}
@ -134,6 +134,7 @@ class Settings
if ($this->proofState == null) {
$this->proofState = new ProofState();
}
return $this->proofState;
}
@ -148,7 +149,7 @@ class Settings
/**
* Are spelling errors hidden
*
* @return boolean
* @return bool
*/
public function hasHideSpellingErrors()
{
@ -158,7 +159,7 @@ class Settings
/**
* Hide spelling errors
*
* @param boolean $hideSpellingErrors
* @param bool $hideSpellingErrors
*/
public function setHideSpellingErrors($hideSpellingErrors)
{
@ -168,7 +169,7 @@ class Settings
/**
* Are grammatical errors hidden
*
* @return boolean
* @return bool
*/
public function hasHideGrammaticalErrors()
{
@ -178,7 +179,7 @@ class Settings
/**
* Hide grammatical errors
*
* @param boolean $hideGrammaticalErrors
* @param bool $hideGrammaticalErrors
*/
public function setHideGrammaticalErrors($hideGrammaticalErrors)
{
@ -186,7 +187,7 @@ class Settings
}
/**
* @return boolean
* @return bool
*/
public function hasEvenAndOddHeaders()
{
@ -194,7 +195,7 @@ class Settings
}
/**
* @param boolean $evenAndOddHeaders
* @param bool $evenAndOddHeaders
*/
public function setEvenAndOddHeaders($evenAndOddHeaders)
{
@ -222,7 +223,7 @@ class Settings
}
/**
* @return boolean
* @return bool
*/
public function hasTrackRevisions()
{
@ -230,7 +231,7 @@ class Settings
}
/**
* @param boolean $trackRevisions
* @param bool $trackRevisions
*/
public function setTrackRevisions($trackRevisions)
{
@ -238,7 +239,7 @@ class Settings
}
/**
* @return boolean
* @return bool
*/
public function hasDoNotTrackMoves()
{
@ -246,7 +247,7 @@ class Settings
}
/**
* @param boolean $doNotTrackMoves
* @param bool $doNotTrackMoves
*/
public function setDoNotTrackMoves($doNotTrackMoves)
{
@ -254,7 +255,7 @@ class Settings
}
/**
* @return boolean
* @return bool
*/
public function hasDoNotTrackFormatting()
{
@ -262,7 +263,7 @@ class Settings
}
/**
* @param boolean $doNotTrackFormatting
* @param bool $doNotTrackFormatting
*/
public function setDoNotTrackFormatting($doNotTrackFormatting)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord;
use PhpOffice\PhpWord\Element\Section;
@ -108,9 +107,9 @@ class PhpWord
* @param mixed $function
* @param mixed $args
*
* @return mixed
*
* @throws \BadMethodCallException
*
* @return mixed
*/
public function __call($function, $args)
{
@ -251,7 +250,7 @@ class PhpWord
/**
* Get default font size
*
* @return integer
* @return int
*/
public function getDefaultFontSize()
{
@ -285,21 +284,20 @@ class PhpWord
*
* @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead.
*
* @param string $filename Fully qualified filename.
*
* @return TemplateProcessor
* @param string $filename Fully qualified filename
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return TemplateProcessor
*
* @codeCoverageIgnore
*/
public function loadTemplate($filename)
{
if (file_exists($filename)) {
return new TemplateProcessor($filename);
} else {
throw new Exception("Template file {$filename} not found.");
}
throw new Exception("Template file {$filename} not found.");
}
/**
@ -325,7 +323,7 @@ class PhpWord
$writer = IOFactory::createWriter($this, $format);
if ($download === true) {
header("Content-Description: File Transfer");
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Content-Type: ' . $mime[$format]);
header('Content-Transfer-Encoding: binary');

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\PhpWord\Exception\Exception;
@ -62,6 +61,7 @@ abstract class AbstractReader implements ReaderInterface
public function setReadDataOnly($value = true)
{
$this->readDataOnly = $value;
return $this;
}
@ -70,21 +70,21 @@ abstract class AbstractReader implements ReaderInterface
*
* @param string $filename
*
* @return resource
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return resource
*/
protected function openFile($filename)
{
// Check if file exists
if (!file_exists($filename) || !is_readable($filename)) {
throw new Exception("Could not open " . $filename . " for reading! File does not exist.");
throw new Exception("Could not open $filename for reading! File does not exist.");
}
// Open file
$this->fileHandle = fopen($filename, 'r');
if ($this->fileHandle === false) {
throw new Exception("Could not open file " . $filename . " for reading.");
throw new Exception("Could not open file $filename for reading.");
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\PhpWord\PhpWord;

View File

@ -11,16 +11,15 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\Common\Drawing;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Shared\OLERead;
use PhpOffice\PhpWord\Style;
/**
* Reader for Word97
@ -164,13 +163,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
$arrayCP[$inc] = self::getInt4d($data, $posMem);
$posMem += 4;
}
return $arrayCP;
}
/**
*
* @link http://msdn.microsoft.com/en-us/library/dd949344%28v=office.12%29.aspx
* @link https://igor.io/2012/09/24/binary-parsing.html
* @param string $data
*/
private function readFib($data)
{
@ -1095,6 +1095,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
$this->arrayFib['lcbColorSchemeMapping'] = self::getInt4d($data, $pos);
$pos += 4;
}
return $pos;
}
@ -1500,12 +1501,13 @@ class MsDoc extends AbstractReader implements ReaderInterface
$oSprm->f = ($sprm / 512) & 0x0001;
$oSprm->sgc = ($sprm / 1024) & 0x0007;
$oSprm->spra = ($sprm / 8192);
return $oSprm;
}
/**
* @param string $data
* @param integer $pos
* @param int $pos
* @param \stdClass $oSprm
* @return array
*/
@ -1564,8 +1566,9 @@ class MsDoc extends AbstractReader implements ReaderInterface
}
/**
* @param $data integer
* @param $pos integer
* @param $data int
* @param $pos int
* @param $cbNum int
* @return \stdClass
* @link http://msdn.microsoft.com/en-us/library/dd772849%28v=office.12%29.aspx
*/
@ -1925,7 +1928,6 @@ class MsDoc extends AbstractReader implements ReaderInterface
default:
// print_r('@todo Section : 0x'.dechex($oSprm->isPmd));
// print_r(PHP_EOL);
}
break;
// Table property
@ -2193,13 +2195,14 @@ class MsDoc extends AbstractReader implements ReaderInterface
}
$oStylePrl->length = $pos - $posStart;
return $oStylePrl;
}
/**
* Read a record header
* @param string $stream
* @param integer $pos
* @param int $pos
* @return array
*/
private function loadRecordHeader($stream, $pos)
@ -2207,6 +2210,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
$rec = self::getInt2d($stream, $pos);
$recType = self::getInt2d($stream, $pos + 2);
$recLen = self::getInt4d($stream, $pos + 4);
return array(
'recVer' => ($rec >> 0) & bindec('1111'),
'recInstance' => ($rec >> 4) & bindec('111111111111'),
@ -2285,7 +2289,6 @@ class MsDoc extends AbstractReader implements ReaderInterface
}
}
}
}
}
@ -2344,6 +2347,7 @@ class MsDoc extends AbstractReader implements ReaderInterface
} else {
$ord24 = ($or24 & 127) << 24;
}
return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24;
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\Common\XMLReader;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\ODText;
use PhpOffice\PhpWord\Reader\Word2007\AbstractPart as Word2007AbstractPart;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\ODText;
use PhpOffice\Common\XMLReader;
@ -44,16 +43,13 @@ class Content extends AbstractPart
foreach ($nodes as $node) {
// $styleName = $xmlReader->getAttribute('text:style-name', $node);
switch ($node->nodeName) {
case 'text:h': // Heading
$depth = $xmlReader->getAttribute('text:outline-level', $node);
$section->addTitle($node->nodeValue, $depth);
break;
case 'text:p': // Paragraph
$section->addText($node->nodeValue);
break;
case 'text:list': // List
$listItems = $xmlReader->getElements('text:list-item/text:p', $node);
foreach ($listItems as $listItem) {

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\ODText;
use PhpOffice\Common\XMLReader;
@ -70,9 +69,8 @@ class Meta extends AbstractPart
if (in_array($property, array('Category', 'Company', 'Manager'))) {
$method = "set{$property}";
$docProps->$method($propertyNode->nodeValue);
// Set other custom properties
} else {
// Set other custom properties
$docProps->setCustomProperty($property, $propertyNode->nodeValue);
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\PhpWord\PhpWord;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\RTF;
use PhpOffice\PhpWord\PhpWord;
@ -163,7 +162,7 @@ class Document
if (false === $this->isControl) { // Non control word: Push character
$this->pushText($char);
} else {
if (preg_match("/^[a-zA-Z0-9-]?$/", $char)) { // No delimiter: Buffer control
if (preg_match('/^[a-zA-Z0-9-]?$/', $char)) { // No delimiter: Buffer control
$this->control .= $char;
$this->isFirst = false;
} else { // Delimiter found: Parse buffered control
@ -256,7 +255,7 @@ class Document
*/
private function flushControl($isControl = false)
{
if (1 === preg_match("/^([A-Za-z]+)(-?[0-9]*) ?$/", $this->control, $match)) {
if (1 === preg_match('/^([A-Za-z]+)(-?[0-9]*) ?$/', $this->control, $match)) {
list(, $control, $parameter) = $match;
$this->parseControl($control, $parameter);
}
@ -313,9 +312,9 @@ class Document
private function pushText($char)
{
if ('<' == $char) {
$this->text .= "&lt;";
$this->text .= '&lt;';
} elseif ('>' == $char) {
$this->text .= "&gt;";
$this->text .= '&gt;';
} else {
$this->text .= $char;
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
/**
@ -28,7 +27,7 @@ interface ReaderInterface
* Can the current ReaderInterface read the file?
*
* @param string $filename
* @return boolean
* @return bool
*/
public function canRead($filename);

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader;
use PhpOffice\Common\XMLReader;
@ -94,7 +93,6 @@ class Word2007 extends AbstractReader implements ReaderInterface
$part->setRels($relationships);
$part->read($phpWord);
}
}
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;
@ -137,9 +136,8 @@ abstract class AbstractPart
}
}
$parent->addPreserveText($textContent, $fontStyle, $paragraphStyle);
// List item
} elseif ($xmlReader->elementExists('w:pPr/w:numPr', $domNode)) {
// List item
$textContent = '';
$numId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:numId');
$levelId = $xmlReader->getAttribute('w:val', $domNode, 'w:pPr/w:numPr/w:ilvl');
@ -148,18 +146,16 @@ abstract class AbstractPart
$textContent .= $xmlReader->getValue('w:t', $node);
}
$parent->addListItem($textContent, $levelId, null, "PHPWordList{$numId}", $paragraphStyle);
// Heading
} elseif (!empty($headingMatches)) {
// Heading
$textContent = '';
$nodes = $xmlReader->getElements('w:r', $domNode);
foreach ($nodes as $node) {
$textContent .= $xmlReader->getValue('w:t', $node);
}
$parent->addTitle($textContent, $headingMatches[1]);
// Text and TextRun
} else {
// Text and TextRun
$runCount = $xmlReader->countElements('w:r', $domNode);
$linkCount = $xmlReader->countElements('w:hyperlink', $domNode);
$runLinkCount = $runCount + $linkCount;
@ -205,25 +201,22 @@ abstract class AbstractPart
$parent->addLink($target, $textContent, $fontStyle, $paragraphStyle);
}
} else {
// Footnote
if ($xmlReader->elementExists('w:footnoteReference', $domNode)) {
// Footnote
$parent->addFootnote();
// Endnote
} elseif ($xmlReader->elementExists('w:endnoteReference', $domNode)) {
// Endnote
$parent->addEndnote();
// Image
} elseif ($xmlReader->elementExists('w:pict', $domNode)) {
// Image
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:pict/v:shape/v:imagedata');
$target = $this->getMediaTarget($docPart, $rId);
if (!is_null($target)) {
$imageSource = "zip://{$this->docFile}#{$target}";
$parent->addImage($imageSource);
}
// Object
} elseif ($xmlReader->elementExists('w:object', $domNode)) {
// Object
$rId = $xmlReader->getAttribute('r:id', $domNode, 'w:object/o:OLEObject');
// $rIdIcon = $xmlReader->getAttribute('r:id', $domNode, 'w:object/v:shape/v:imagedata');
$target = $this->getMediaTarget($docPart, $rId);
@ -231,9 +224,8 @@ abstract class AbstractPart
$textContent = "<Object: {$target}>";
$parent->addText($textContent, $fontStyle, $paragraphStyle);
}
// TextRun
} else {
// TextRun
$textContent = $xmlReader->getValue('w:t', $domNode);
$parent->addText($textContent, $fontStyle, $paragraphStyle);
}
@ -263,7 +255,6 @@ abstract class AbstractPart
foreach ($tblNodes as $tblNode) {
if ('w:tblGrid' == $tblNode->nodeName) { // Column
// @todo Do something with table columns
} elseif ('w:tr' == $tblNode->nodeName) { // Row
$rowHeight = $xmlReader->getAttribute('w:val', $tblNode, 'w:trPr/w:trHeight');
$rowHRule = $xmlReader->getAttribute('w:hRule', $tblNode, 'w:trPr/w:trHeight');
@ -279,7 +270,6 @@ abstract class AbstractPart
foreach ($rowNodes as $rowNode) {
if ('w:trPr' == $rowNode->nodeName) { // Row style
// @todo Do something with row style
} elseif ('w:tc' == $rowNode->nodeName) { // Cell
$cellWidth = $xmlReader->getAttribute('w:w', $rowNode, 'w:tcPr/w:tcW');
$cellStyle = null;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;
@ -40,7 +39,6 @@ class Document extends AbstractPart
* Read document.xml.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord $phpWord)
{
@ -66,7 +64,6 @@ class Document extends AbstractPart
*
* @param array $settings
* @param \PhpOffice\PhpWord\Element\Section &$section
* @return void
*/
private function readHeaderFooter($settings, Section &$section)
{
@ -145,7 +142,6 @@ class Document extends AbstractPart
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $node
* @param \PhpOffice\PhpWord\Element\Section &$section
* @return void
*
* @todo <w:lastRenderedPageBreak>
*/
@ -175,7 +171,6 @@ class Document extends AbstractPart
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $node
* @param \PhpOffice\PhpWord\Element\Section &$section
* @return void
*/
private function readWSectPrNode(XMLReader $xmlReader, \DOMElement $node, Section &$section)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;
@ -31,7 +30,6 @@ class Numbering extends AbstractPart
* Read numbering.xml.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord $phpWord)
{
@ -92,7 +90,7 @@ class Numbering extends AbstractPart
*
* @param \PhpOffice\Common\XMLReader $xmlReader
* @param \DOMElement $subnode
* @param integer $levelId
* @param int $levelId
* @return array
*/
private function readLevel(XMLReader $xmlReader, \DOMElement $subnode, $levelId)

View File

@ -11,15 +11,14 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\ComplexType\TrackChangesView;
use PhpOffice\PhpWord\PhpWord;
/**
* Settings reader
@ -28,14 +27,12 @@ use PhpOffice\PhpWord\ComplexType\TrackChangesView;
*/
class Settings extends AbstractPart
{
private static $booleanProperties = array('hideSpellingErrors', 'hideGrammaticalErrors', 'trackRevisions', 'doNotTrackMoves', 'doNotTrackFormatting', 'evenAndOddHeaders');
/**
* Read settings.xml.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord $phpWord)
{

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\Common\XMLReader;
@ -31,7 +30,6 @@ class Styles extends AbstractPart
* Read styles.xml.
*
* @param \PhpOffice\PhpWord\PhpWord $phpWord
* @return void
*/
public function read(PhpWord $phpWord)
{
@ -49,7 +47,6 @@ class Styles extends AbstractPart
preg_match('/Heading(\d)/', $name, $headingMatches);
// $default = ($xmlReader->getAttribute('w:default', $node) == 1);
switch ($type) {
case 'paragraph':
$paragraphStyle = $this->readParagraphStyle($xmlReader, $node);
$fontStyle = $this->readFontStyle($xmlReader, $node);
@ -65,14 +62,12 @@ class Styles extends AbstractPart
}
}
break;
case 'character':
$fontStyle = $this->readFontStyle($xmlReader, $node);
if (!empty($fontStyle)) {
$phpWord->addFontStyle($name, $fontStyle);
}
break;
case 'table':
$tStyle = $this->readTableStyle($xmlReader, $node);
if (!empty($tStyle)) {

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord;
/**
@ -180,6 +179,7 @@ class Settings
{
if (in_array($zipClass, array(self::PCLZIP, self::ZIPARCHIVE, self::OLD_LIB))) {
self::$zipClass = $zipClass;
return true;
}
@ -229,7 +229,6 @@ class Settings
return true;
}
/**
* Return the directory path to the PDF Rendering Library.
*
@ -275,7 +274,7 @@ class Settings
public static function setMeasurementUnit($value)
{
$units = array(self::UNIT_TWIP, self::UNIT_CM, self::UNIT_MM, self::UNIT_INCH,
self::UNIT_POINT, self::UNIT_PICA);
self::UNIT_POINT, self::UNIT_PICA, );
if (!in_array($value, $units)) {
return false;
}
@ -289,7 +288,7 @@ class Settings
*
* @since 0.12.0
*
* @param string $tempDir The user defined path to temporary directory.
* @param string $tempDir The user defined path to temporary directory
*
* @return void
*/
@ -319,7 +318,7 @@ class Settings
/**
* @since 0.13.0
*
* @return boolean
* @return bool
*
* @codeCoverageIgnore
*/
@ -331,7 +330,7 @@ class Settings
/**
* @since 0.13.0
*
* @param boolean $outputEscapingEnabled
* @param bool $outputEscapingEnabled
*
* @codeCoverageIgnore
*/
@ -360,6 +359,7 @@ class Settings
{
if (is_string($value) && trim($value) !== '') {
self::$defaultFontName = $value;
return true;
}
@ -369,7 +369,7 @@ class Settings
/**
* Get default font size
*
* @return integer
* @return int
*/
public static function getDefaultFontSize()
{
@ -384,9 +384,10 @@ class Settings
*/
public static function setDefaultFontSize($value)
{
$value = intval($value);
$value = (int) $value;
if ($value > 0) {
self::$defaultFontSize = $value;
return true;
}

View File

@ -3,7 +3,6 @@ namespace PhpOffice\PhpWord\Shared;
abstract class AbstractEnum
{
private static $constCacheArray = null;
private static function getConstants()
@ -16,6 +15,7 @@ abstract class AbstractEnum
$reflect = new \ReflectionClass($calledClass);
self::$constCacheArray[$calledClass] = $reflect->getConstants();
}
return self::$constCacheArray[$calledClass];
}
@ -33,11 +33,12 @@ abstract class AbstractEnum
* Returns true the value is valid for this enum
*
* @param strign $value
* @return boolean true if value is valid
* @return bool true if value is valid
*/
public static function isValid($value)
{
$values = array_values(self::getConstants());
return in_array($value, $values, true);
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
use PhpOffice\PhpWord\Element\AbstractContainer;
@ -364,10 +363,10 @@ class Html
$styles['alignment'] = $cValue; // todo: any mapping?
break;
case 'color':
$styles['color'] = trim($cValue, "#");
$styles['color'] = trim($cValue, '#');
break;
case 'background-color':
$styles['bgColor'] = trim($cValue, "#");
$styles['bgColor'] = trim($cValue, '#');
break;
}
}

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
use PhpOffice\PhpWord\Exception\Exception;
@ -294,7 +293,6 @@ class OLERead
$offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
}
}
/**

View File

@ -11,10 +11,9 @@
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2016 PHPWord contributors
* @copyright 2010-2017 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/
namespace PhpOffice\PhpWord\Shared;
use PhpOffice\PhpWord\Exception\Exception;
@ -150,10 +149,10 @@ class ZipArchive
/**
* Close the active archive
*
* @return bool
*
* @throws \PhpOffice\PhpWord\Exception\Exception
*
* @return bool
*
* @codeCoverageIgnore Can't find any test case. Uncomment when found.
*/
public function close()
@ -183,9 +182,9 @@ class ZipArchive
if (!$this->usePclzip) {
return $this->zip->extractTo($destination, $entries);
} else {
return $this->pclzipExtractTo($destination, $entries);
}
return $this->pclzipExtractTo($destination, $entries);
}
/**
@ -301,6 +300,7 @@ class ZipArchive
// Extract all files
if (is_null($entries)) {
$result = $zip->extract(PCLZIP_OPT_PATH, $destination);
return ($result > 0) ? true : false;
}
@ -360,9 +360,9 @@ class ZipArchive
$list = $zip->listContent();
if (isset($list[$index])) {
return $list[$index]['filename'];
} else {
return false;
}
return false;
}
/**

Some files were not shown because too many files have changed in this diff Show More