diff --git a/.php_cs.dist b/.php_cs.dist index a08e2b21..d441972b 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -1,8 +1,8 @@ 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, - ]); + )); diff --git a/.travis.yml b/.travis.yml index 37234348..fbcc4dd5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/bootstrap.php b/bootstrap.php index 11939fee..4bef8451 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -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 */ diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..6b81d69c --- /dev/null +++ b/run_tests.sh @@ -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 + diff --git a/samples/Sample_02_TabStops.php b/samples/Sample_02_TabStops.php index 17021987..4f588ee7 100644 --- a/samples/Sample_02_TabStops.php +++ b/samples/Sample_02_TabStops.php @@ -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), - ) + ), ) ); diff --git a/samples/Sample_07_TemplateCloneRow.php b/samples/Sample_07_TemplateCloneRow.php index 22a68537..e845362c 100644 --- a/samples/Sample_07_TemplateCloneRow.php +++ b/samples/Sample_07_TemplateCloneRow.php @@ -1,62 +1,62 @@ -setValue('weekday', date('l')); // On section/content -$templateProcessor->setValue('time', date('H:i')); // On footer -$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header - -// Simple table -$templateProcessor->cloneRow('rowValue', 10); - -$templateProcessor->setValue('rowValue#1', 'Sun'); -$templateProcessor->setValue('rowValue#2', 'Mercury'); -$templateProcessor->setValue('rowValue#3', 'Venus'); -$templateProcessor->setValue('rowValue#4', 'Earth'); -$templateProcessor->setValue('rowValue#5', 'Mars'); -$templateProcessor->setValue('rowValue#6', 'Jupiter'); -$templateProcessor->setValue('rowValue#7', 'Saturn'); -$templateProcessor->setValue('rowValue#8', 'Uranus'); -$templateProcessor->setValue('rowValue#9', 'Neptun'); -$templateProcessor->setValue('rowValue#10', 'Pluto'); - -$templateProcessor->setValue('rowNumber#1', '1'); -$templateProcessor->setValue('rowNumber#2', '2'); -$templateProcessor->setValue('rowNumber#3', '3'); -$templateProcessor->setValue('rowNumber#4', '4'); -$templateProcessor->setValue('rowNumber#5', '5'); -$templateProcessor->setValue('rowNumber#6', '6'); -$templateProcessor->setValue('rowNumber#7', '7'); -$templateProcessor->setValue('rowNumber#8', '8'); -$templateProcessor->setValue('rowNumber#9', '9'); -$templateProcessor->setValue('rowNumber#10', '10'); - -// Table with a spanned cell -$templateProcessor->cloneRow('userId', 3); - -$templateProcessor->setValue('userId#1', '1'); -$templateProcessor->setValue('userFirstName#1', 'James'); -$templateProcessor->setValue('userName#1', 'Taylor'); -$templateProcessor->setValue('userPhone#1', '+1 428 889 773'); - -$templateProcessor->setValue('userId#2', '2'); -$templateProcessor->setValue('userFirstName#2', 'Robert'); -$templateProcessor->setValue('userName#2', 'Bell'); -$templateProcessor->setValue('userPhone#2', '+1 428 889 774'); - -$templateProcessor->setValue('userId#3', '3'); -$templateProcessor->setValue('userFirstName#3', 'Michael'); -$templateProcessor->setValue('userName#3', 'Ray'); -$templateProcessor->setValue('userPhone#3', '+1 428 889 775'); - -echo date('H:i:s'), ' Saving the result document...', EOL; -$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); - -echo getEndingNotes(array('Word2007' => 'docx')); -if (!CLI) { - include_once 'Sample_Footer.php'; -} +setValue('weekday', date('l')); // On section/content +$templateProcessor->setValue('time', date('H:i')); // On footer +$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header + +// Simple table +$templateProcessor->cloneRow('rowValue', 10); + +$templateProcessor->setValue('rowValue#1', 'Sun'); +$templateProcessor->setValue('rowValue#2', 'Mercury'); +$templateProcessor->setValue('rowValue#3', 'Venus'); +$templateProcessor->setValue('rowValue#4', 'Earth'); +$templateProcessor->setValue('rowValue#5', 'Mars'); +$templateProcessor->setValue('rowValue#6', 'Jupiter'); +$templateProcessor->setValue('rowValue#7', 'Saturn'); +$templateProcessor->setValue('rowValue#8', 'Uranus'); +$templateProcessor->setValue('rowValue#9', 'Neptun'); +$templateProcessor->setValue('rowValue#10', 'Pluto'); + +$templateProcessor->setValue('rowNumber#1', '1'); +$templateProcessor->setValue('rowNumber#2', '2'); +$templateProcessor->setValue('rowNumber#3', '3'); +$templateProcessor->setValue('rowNumber#4', '4'); +$templateProcessor->setValue('rowNumber#5', '5'); +$templateProcessor->setValue('rowNumber#6', '6'); +$templateProcessor->setValue('rowNumber#7', '7'); +$templateProcessor->setValue('rowNumber#8', '8'); +$templateProcessor->setValue('rowNumber#9', '9'); +$templateProcessor->setValue('rowNumber#10', '10'); + +// Table with a spanned cell +$templateProcessor->cloneRow('userId', 3); + +$templateProcessor->setValue('userId#1', '1'); +$templateProcessor->setValue('userFirstName#1', 'James'); +$templateProcessor->setValue('userName#1', 'Taylor'); +$templateProcessor->setValue('userPhone#1', '+1 428 889 773'); + +$templateProcessor->setValue('userId#2', '2'); +$templateProcessor->setValue('userFirstName#2', 'Robert'); +$templateProcessor->setValue('userName#2', 'Bell'); +$templateProcessor->setValue('userPhone#2', '+1 428 889 774'); + +$templateProcessor->setValue('userId#3', '3'); +$templateProcessor->setValue('userFirstName#3', 'Michael'); +$templateProcessor->setValue('userName#3', 'Ray'); +$templateProcessor->setValue('userPhone#3', '+1 428 889 775'); + +echo date('H:i:s'), ' Saving the result document...', EOL; +$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); + +echo getEndingNotes(array('Word2007' => 'docx')); +if (!CLI) { + include_once 'Sample_Footer.php'; +} diff --git a/samples/Sample_08_ParagraphPagination.php b/samples/Sample_08_ParagraphPagination.php index f91b1c56..3c21b138 100644 --- a/samples/Sample_08_ParagraphPagination.php +++ b/samples/Sample_08_ParagraphPagination.php @@ -19,7 +19,7 @@ $section->addText( 'Below are the samples on how to control your paragraph ' . 'pagination. See "Line and Page Break" tab on paragraph properties ' . 'window to see the attribute set by these controls.', - array('bold' => true), + array('bold' => true), array('space' => array('before' => 360, 'after' => 480)) ); diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index e3edc605..c4be7c9e 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -46,11 +46,11 @@ for ($i = 1; $i <= 8; $i++) { $table->addCell(2000)->addText("Cell {$i}"); $table->addCell(2000)->addText("Cell {$i}"); $table->addCell(2000)->addText("Cell {$i}"); - $text = (0== $i % 2) ? 'X' : ''; + $text = (0 == $i % 2) ? 'X' : ''; $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')); diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index 1e6943db..6c7033b0 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -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 diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index b5be12ca..ec9dbe25 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -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(); diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php index 670e914b..5c0e8abc 100644 --- a/samples/Sample_37_Comments.php +++ b/samples/Sample_37_Comments.php @@ -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) { diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index 90bdf4fa..1d6b14a1 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -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 diff --git a/samples/index.php b/samples/index.php index a65d8fd9..3dbc09ff 100644 --- a/samples/index.php +++ b/samples/index.php @@ -13,7 +13,7 @@ $requirements = array( 'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')), ); if (!CLI) { -?> + ?>

Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).

 

@@ -25,14 +25,14 @@ if (!CLI) { Requirement check:"; - echo "'; include_once 'Sample_Footer.php'; } else { echo 'Requirement check:' . PHP_EOL; diff --git a/src/PhpWord/Collection/AbstractCollection.php b/src/PhpWord/Collection/AbstractCollection.php index beff290e..39e8f1d3 100644 --- a/src/PhpWord/Collection/AbstractCollection.php +++ b/src/PhpWord/Collection/AbstractCollection.php @@ -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; } /** diff --git a/src/PhpWord/Collection/Bookmarks.php b/src/PhpWord/Collection/Bookmarks.php index b263cda7..d1a07755 100644 --- a/src/PhpWord/Collection/Bookmarks.php +++ b/src/PhpWord/Collection/Bookmarks.php @@ -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; /** diff --git a/src/PhpWord/Collection/Charts.php b/src/PhpWord/Collection/Charts.php index 01f3f72e..117cdaf0 100644 --- a/src/PhpWord/Collection/Charts.php +++ b/src/PhpWord/Collection/Charts.php @@ -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; /** diff --git a/src/PhpWord/Collection/Comments.php b/src/PhpWord/Collection/Comments.php index e0383814..75ee8a9b 100644 --- a/src/PhpWord/Collection/Comments.php +++ b/src/PhpWord/Collection/Comments.php @@ -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; /** diff --git a/src/PhpWord/Collection/Endnotes.php b/src/PhpWord/Collection/Endnotes.php index 083142ed..11f2d136 100644 --- a/src/PhpWord/Collection/Endnotes.php +++ b/src/PhpWord/Collection/Endnotes.php @@ -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; /** diff --git a/src/PhpWord/Collection/Footnotes.php b/src/PhpWord/Collection/Footnotes.php index 0c094a53..d93a6124 100644 --- a/src/PhpWord/Collection/Footnotes.php +++ b/src/PhpWord/Collection/Footnotes.php @@ -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; /** diff --git a/src/PhpWord/Collection/Titles.php b/src/PhpWord/Collection/Titles.php index 80e2d9d7..4c2cc6de 100644 --- a/src/PhpWord/Collection/Titles.php +++ b/src/PhpWord/Collection/Titles.php @@ -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; /** diff --git a/src/PhpWord/ComplexType/FootnoteProperties.php b/src/PhpWord/ComplexType/FootnoteProperties.php index 882834d5..b96b6255 100644 --- a/src/PhpWord/ComplexType/FootnoteProperties.php +++ b/src/PhpWord/ComplexType/FootnoteProperties.php @@ -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; @@ -65,7 +64,7 @@ final class FootnoteProperties /** * Get the Footnote Positioning Location - * + * * @return string */ public function getPos() @@ -75,7 +74,7 @@ final class FootnoteProperties /** * Set the Footnote Positioning Location (pageBottom, beneathText, sectEnd, docEnd) - * + * * @param string $pos * @throws \InvalidArgumentException * @return self @@ -86,20 +85,21 @@ 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; } /** * Get the Footnote Numbering Format - * + * * @return string */ public function getNumFmt() @@ -109,7 +109,7 @@ final class FootnoteProperties /** * Set the Footnote Numbering Format - * + * * @param string $numFmt One of NumberFormat * @return self */ @@ -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() { @@ -132,19 +133,20 @@ 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; } /** * Get the Footnote and Endnote Numbering Starting Value - * + * * @return string */ public function getNumRestart() @@ -154,7 +156,7 @@ final class FootnoteProperties /** * Set the Footnote and Endnote Numbering Starting Value (continuous, eachSect, eachPage) - * + * * @param string $numRestart * @throws \InvalidArgumentException * @return self @@ -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; + $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; } } diff --git a/src/PhpWord/ComplexType/ProofState.php b/src/PhpWord/ComplexType/ProofState.php index e5ac9c20..2e91abbf 100644 --- a/src/PhpWord/ComplexType/ProofState.php +++ b/src/PhpWord/ComplexType/ProofState.php @@ -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 */ @@ -51,7 +50,7 @@ final class ProofState /** * Set the Spell Checking State (dirty or clean) * - * @param string $spelling + * @param string $spelling * @throws \InvalidArgumentException * @return self */ @@ -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; } @@ -78,7 +78,7 @@ final class ProofState /** * Set the Grammatical Checking State (dirty or clean) * - * @param string $grammar + * @param string $grammar * @throws \InvalidArgumentException * @return self */ @@ -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; } diff --git a/src/PhpWord/ComplexType/TrackChangesView.php b/src/PhpWord/ComplexType/TrackChangesView.php index ea26bc3c..ed777a55 100644 --- a/src/PhpWord/ComplexType/TrackChangesView.php +++ b/src/PhpWord/ComplexType/TrackChangesView.php @@ -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) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index d5b4cc62..7fddb6fc 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -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) { diff --git a/src/PhpWord/Element/AbstractElement.php b/src/PhpWord/Element/AbstractElement.php index 8ff64194..cdb6b0ee 100644 --- a/src/PhpWord/Element/AbstractElement.php +++ b/src/PhpWord/Element/AbstractElement.php @@ -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; @@ -116,14 +115,14 @@ abstract class AbstractElement /** * The start position for the linked comment - * + * * @var Comment */ protected $commentRangeStart; /** * The end position for the linked comment - * + * * @var Comment */ protected $commentRangeEnd; @@ -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) { @@ -291,15 +284,15 @@ abstract class AbstractElement /** * Set comment start - * + * * @param Comment $value */ 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 = $value; $this->commentRangeStart->setStartElement($this); } @@ -317,14 +310,13 @@ 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 = $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 */ diff --git a/src/PhpWord/Element/Bookmark.php b/src/PhpWord/Element/Bookmark.php index c865893f..5f304047 100644 --- a/src/PhpWord/Element/Bookmark.php +++ b/src/PhpWord/Element/Bookmark.php @@ -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; } diff --git a/src/PhpWord/Element/Cell.php b/src/PhpWord/Element/Cell.php index 28e517fd..c01cfb4d 100644 --- a/src/PhpWord/Element/Cell.php +++ b/src/PhpWord/Element/Cell.php @@ -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; diff --git a/src/PhpWord/Element/Chart.php b/src/PhpWord/Element/Chart.php index f98c1d74..1a4ee327 100644 --- a/src/PhpWord/Element/Chart.php +++ b/src/PhpWord/Element/Chart.php @@ -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; diff --git a/src/PhpWord/Element/CheckBox.php b/src/PhpWord/Element/CheckBox.php index 3fc578ef..27f031a4 100644 --- a/src/PhpWord/Element/CheckBox.php +++ b/src/PhpWord/Element/CheckBox.php @@ -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; diff --git a/src/PhpWord/Element/Comment.php b/src/PhpWord/Element/Comment.php index def9d5a8..91a6cf78 100644 --- a/src/PhpWord/Element/Comment.php +++ b/src/PhpWord/Element/Comment.php @@ -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; /** @@ -31,14 +30,14 @@ class Comment extends TrackChange /** * The Element where this comment starts - * + * * @var AbstractElement */ private $startElement; /** * The Element where this comment ends - * + * * @var AbstractElement */ private $endElement; @@ -61,6 +60,7 @@ class Comment extends TrackChange { parent::__construct($author, $date); $this->initials = $initials; + return $this; } @@ -76,7 +76,7 @@ class Comment extends TrackChange /** * Sets the element where this comment starts - * + * * @param \PhpOffice\PhpWord\Element\AbstractElement $value */ public function setStartElement(AbstractElement $value) @@ -89,7 +89,7 @@ class Comment extends TrackChange /** * Get the element where this comment starts - * + * * @return \PhpOffice\PhpWord\Element\AbstractElement */ public function getStartElement() @@ -99,7 +99,7 @@ class Comment extends TrackChange /** * Sets the element where this comment ends - * + * * @param \PhpOffice\PhpWord\Element\AbstractElement $value */ public function setEndElement(AbstractElement $value) @@ -112,7 +112,7 @@ class Comment extends TrackChange /** * Get the element where this comment ends - * + * * @return \PhpOffice\PhpWord\Element\AbstractElement */ public function getEndElement() diff --git a/src/PhpWord/Element/Endnote.php b/src/PhpWord/Element/Endnote.php index 2d8e4731..3b3d55f9 100644 --- a/src/PhpWord/Element/Endnote.php +++ b/src/PhpWord/Element/Endnote.php @@ -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; diff --git a/src/PhpWord/Element/Field.php b/src/PhpWord/Element/Field.php index 380d7a92..6048530a 100644 --- a/src/PhpWord/Element/Field.php +++ b/src/PhpWord/Element/Field.php @@ -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; /** @@ -32,36 +31,36 @@ class Field extends AbstractElement * @var array */ protected $fieldsArray = array( - 'PAGE'=>array( - 'properties'=>array( + 'PAGE' => array( + 'properties' => array( 'format' => array('Arabic', 'ArabicDash', 'alphabetic', 'ALPHABETIC', 'roman', 'ROMAN'), ), - 'options'=>array('PreserveFormat') + 'options' => array('PreserveFormat'), ), - 'NUMPAGES'=>array( - 'properties'=>array( + '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', + '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( + 'XE' => array( 'properties' => array(), - 'options' => array('Bold', 'Italic') + 'options' => array('Bold', 'Italic'), ), - 'INDEX'=>array( + '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; } diff --git a/src/PhpWord/Element/Footer.php b/src/PhpWord/Element/Footer.php index b3196f3f..5aaf802b 100644 --- a/src/PhpWord/Element/Footer.php +++ b/src/PhpWord/Element/Footer.php @@ -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; /** @@ -28,9 +27,9 @@ class Footer extends AbstractContainer * @var string * @link http://www.datypic.com/sc/ooxml/t-w_ST_HdrFtr.html Header or Footer Type */ - const AUTO = 'default'; // default and odd pages + const AUTO = 'default'; // default and odd pages const FIRST = 'first'; - const EVEN = 'even'; + const EVEN = 'even'; /** * @var string Container type diff --git a/src/PhpWord/Element/Footnote.php b/src/PhpWord/Element/Footnote.php index 73350bb7..e4e13b6b 100644 --- a/src/PhpWord/Element/Footnote.php +++ b/src/PhpWord/Element/Footnote.php @@ -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; diff --git a/src/PhpWord/Element/FormField.php b/src/PhpWord/Element/FormField.php index c7cb44d2..77edcabd 100644 --- a/src/PhpWord/Element/FormField.php +++ b/src/PhpWord/Element/FormField.php @@ -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; /** diff --git a/src/PhpWord/Element/Header.php b/src/PhpWord/Element/Header.php index d4afdb86..79faed90 100644 --- a/src/PhpWord/Element/Header.php +++ b/src/PhpWord/Element/Header.php @@ -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; /** diff --git a/src/PhpWord/Element/Image.php b/src/PhpWord/Element/Image.php index b8b5cca1..25ca706c 100644 --- a/src/PhpWord/Element/Image.php +++ b/src/PhpWord/Element/Image.php @@ -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 */ @@ -380,7 +375,7 @@ class Image extends AbstractElement // Check image data if ($this->sourceType == self::SOURCE_ARCHIVE) { $imageData = $this->getArchiveImageSize($this->source); - } else if ($this->sourceType == self::SOURCE_STRING) { + } elseif ($this->sourceType == self::SOURCE_STRING) { $imageData = $this->getStringImageSize($this->source); } else { $imageData = @getimagesize($this->source); @@ -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) { @@ -476,26 +469,26 @@ class Image extends AbstractElement /** * get image size from string - * + * * @param string $source - * + * * @codeCoverageIgnore this method is just a replacement for getimagesizefromstring which exists only as of PHP 5.4 */ private function getStringImageSize($source) { + $result = false; if (!function_exists('getimagesizefromstring')) { - $uri = 'data://application/octet-stream;base64,' . base64_encode($source); - return @getimagesize($uri); + $uri = 'data://application/octet-stream;base64,' . base64_encode($source); + $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) { diff --git a/src/PhpWord/Element/Line.php b/src/PhpWord/Element/Line.php index 3e94a3a6..3da26317 100644 --- a/src/PhpWord/Element/Line.php +++ b/src/PhpWord/Element/Line.php @@ -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; diff --git a/src/PhpWord/Element/Link.php b/src/PhpWord/Element/Link.php index 4a72e167..d41cd50c 100644 --- a/src/PhpWord/Element/Link.php +++ b/src/PhpWord/Element/Link.php @@ -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; } diff --git a/src/PhpWord/Element/ListItem.php b/src/PhpWord/Element/ListItem.php index 25ace090..ce8e58d5 100644 --- a/src/PhpWord/Element/ListItem.php +++ b/src/PhpWord/Element/ListItem.php @@ -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; diff --git a/src/PhpWord/Element/ListItemRun.php b/src/PhpWord/Element/ListItemRun.php index 53440db6..061a9274 100644 --- a/src/PhpWord/Element/ListItemRun.php +++ b/src/PhpWord/Element/ListItemRun.php @@ -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; @@ -74,10 +73,10 @@ class ListItemRun extends TextRun return $this->style; } - /** + /** * Get ListItem depth. - * - * @return int + * + * @return int */ public function getDepth() { diff --git a/src/PhpWord/Element/Object.php b/src/PhpWord/Element/Object.php index 7285030c..cd32ab95 100644 --- a/src/PhpWord/Element/Object.php +++ b/src/PhpWord/Element/Object.php @@ -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(); } /** diff --git a/src/PhpWord/Element/PageBreak.php b/src/PhpWord/Element/PageBreak.php index d9d4bc64..fc44700f 100644 --- a/src/PhpWord/Element/PageBreak.php +++ b/src/PhpWord/Element/PageBreak.php @@ -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; /** diff --git a/src/PhpWord/Element/PreserveText.php b/src/PhpWord/Element/PreserveText.php index 65e17e35..7a0aaa6d 100644 --- a/src/PhpWord/Element/PreserveText.php +++ b/src/PhpWord/Element/PreserveText.php @@ -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 * diff --git a/src/PhpWord/Element/Row.php b/src/PhpWord/Element/Row.php index 05fde7e4..213f1450 100644 --- a/src/PhpWord/Element/Row.php +++ b/src/PhpWord/Element/Row.php @@ -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; diff --git a/src/PhpWord/Element/SDT.php b/src/PhpWord/Element/SDT.php index 58a477d9..7135b060 100644 --- a/src/PhpWord/Element/SDT.php +++ b/src/PhpWord/Element/SDT.php @@ -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; /** diff --git a/src/PhpWord/Element/Section.php b/src/PhpWord/Element/Section.php index 3758af99..6b6f770d 100644 --- a/src/PhpWord/Element/Section.php +++ b/src/PhpWord/Element/Section.php @@ -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; @@ -50,7 +49,7 @@ class Section extends AbstractContainer /** * The properties for the footnote of this section - * + * * @var FootnoteProperties */ private $footnoteProperties; @@ -148,7 +147,7 @@ class Section extends AbstractContainer /** * Get the footnote properties - * + * * @return \PhpOffice\PhpWord\Element\FooterProperties */ public function getFootnotePropoperties() @@ -158,7 +157,7 @@ class Section extends AbstractContainer /** * Set the footnote properties - * + * * @param FootnoteProperties $footnoteProperties */ public function setFootnoteProperties(FootnoteProperties $footnoteProperties = null) @@ -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]; } + + return $this->footers[1]; } } diff --git a/src/PhpWord/Element/Shape.php b/src/PhpWord/Element/Shape.php index 4717afb8..e5405468 100644 --- a/src/PhpWord/Element/Shape.php +++ b/src/PhpWord/Element/Shape.php @@ -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; diff --git a/src/PhpWord/Element/TOC.php b/src/PhpWord/Element/TOC.php index 54ae3844..c9b37e00 100644 --- a/src/PhpWord/Element/TOC.php +++ b/src/PhpWord/Element/TOC.php @@ -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) { diff --git a/src/PhpWord/Element/Table.php b/src/PhpWord/Element/Table.php index 357af37a..016d2a60 100644 --- a/src/PhpWord/Element/Table.php +++ b/src/PhpWord/Element/Table.php @@ -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; diff --git a/src/PhpWord/Element/Text.php b/src/PhpWord/Element/Text.php index 0de9cdea..89c62ee7 100644 --- a/src/PhpWord/Element/Text.php +++ b/src/PhpWord/Element/Text.php @@ -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; } diff --git a/src/PhpWord/Element/TextBox.php b/src/PhpWord/Element/TextBox.php index 4a1e5131..dbeaae92 100644 --- a/src/PhpWord/Element/TextBox.php +++ b/src/PhpWord/Element/TextBox.php @@ -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; diff --git a/src/PhpWord/Element/TextBreak.php b/src/PhpWord/Element/TextBreak.php index 893fa875..0a216e7a 100644 --- a/src/PhpWord/Element/TextBreak.php +++ b/src/PhpWord/Element/TextBreak.php @@ -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; } diff --git a/src/PhpWord/Element/TextRun.php b/src/PhpWord/Element/TextRun.php index c2ce4f99..f114dcef 100644 --- a/src/PhpWord/Element/TextRun.php +++ b/src/PhpWord/Element/TextRun.php @@ -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; diff --git a/src/PhpWord/Element/Title.php b/src/PhpWord/Element/Title.php index eabb1feb..dd1db965 100644 --- a/src/PhpWord/Element/Title.php +++ b/src/PhpWord/Element/Title.php @@ -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() { diff --git a/src/PhpWord/Element/TrackChange.php b/src/PhpWord/Element/TrackChange.php index 782e6f35..df88ea8f 100644 --- a/src/PhpWord/Element/TrackChange.php +++ b/src/PhpWord/Element/TrackChange.php @@ -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; } diff --git a/src/PhpWord/Escaper/AbstractEscaper.php b/src/PhpWord/Escaper/AbstractEscaper.php index 6ddcbb51..d1309dfb 100644 --- a/src/PhpWord/Escaper/AbstractEscaper.php +++ b/src/PhpWord/Escaper/AbstractEscaper.php @@ -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\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ abstract class AbstractEscaper implements EscaperInterface diff --git a/src/PhpWord/Escaper/EscaperInterface.php b/src/PhpWord/Escaper/EscaperInterface.php index c34cf370..a77da3c5 100644 --- a/src/PhpWord/Escaper/EscaperInterface.php +++ b/src/PhpWord/Escaper/EscaperInterface.php @@ -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\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ interface EscaperInterface diff --git a/src/PhpWord/Escaper/RegExp.php b/src/PhpWord/Escaper/RegExp.php index de510bcf..99691074 100644 --- a/src/PhpWord/Escaper/RegExp.php +++ b/src/PhpWord/Escaper/RegExp.php @@ -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\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class RegExp extends AbstractEscaper diff --git a/src/PhpWord/Escaper/Rtf.php b/src/PhpWord/Escaper/Rtf.php index 6f83604d..332a69ab 100644 --- a/src/PhpWord/Escaper/Rtf.php +++ b/src/PhpWord/Escaper/Rtf.php @@ -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\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class Rtf extends AbstractEscaper @@ -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) { @@ -57,9 +57,9 @@ class Rtf extends AbstractEscaper if (0 == count($bytes)) { if ($asciiCode < 224) { $numberOfBytes = 2; - } else if ($asciiCode < 240) { + } elseif ($asciiCode < 240) { $numberOfBytes = 3; - } else if ($asciiCode < 248) { + } elseif ($asciiCode < 248) { $numberOfBytes = 4; } } diff --git a/src/PhpWord/Escaper/Xml.php b/src/PhpWord/Escaper/Xml.php index 274cade5..f45d8f8a 100644 --- a/src/PhpWord/Escaper/Xml.php +++ b/src/PhpWord/Escaper/Xml.php @@ -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\Escaper; /** * @since 0.13.0 - * + * * @codeCoverageIgnore */ class Xml extends AbstractEscaper diff --git a/src/PhpWord/Exception/CopyFileException.php b/src/PhpWord/Exception/CopyFileException.php index c172657f..7557616b 100644 --- a/src/PhpWord/Exception/CopyFileException.php +++ b/src/PhpWord/Exception/CopyFileException.php @@ -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) { diff --git a/src/PhpWord/Exception/CreateTemporaryFileException.php b/src/PhpWord/Exception/CreateTemporaryFileException.php index 67d969ba..ade359ee 100644 --- a/src/PhpWord/Exception/CreateTemporaryFileException.php +++ b/src/PhpWord/Exception/CreateTemporaryFileException.php @@ -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) { diff --git a/src/PhpWord/Exception/Exception.php b/src/PhpWord/Exception/Exception.php index a9c49f7f..dd6dfbc6 100644 --- a/src/PhpWord/Exception/Exception.php +++ b/src/PhpWord/Exception/Exception.php @@ -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; /** diff --git a/src/PhpWord/Exception/InvalidImageException.php b/src/PhpWord/Exception/InvalidImageException.php index 21c885ee..ed422a25 100644 --- a/src/PhpWord/Exception/InvalidImageException.php +++ b/src/PhpWord/Exception/InvalidImageException.php @@ -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; /** diff --git a/src/PhpWord/Exception/InvalidObjectException.php b/src/PhpWord/Exception/InvalidObjectException.php index ad564d47..9e9f185a 100644 --- a/src/PhpWord/Exception/InvalidObjectException.php +++ b/src/PhpWord/Exception/InvalidObjectException.php @@ -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; /** diff --git a/src/PhpWord/Exception/InvalidStyleException.php b/src/PhpWord/Exception/InvalidStyleException.php index 44980842..ef0ca430 100644 --- a/src/PhpWord/Exception/InvalidStyleException.php +++ b/src/PhpWord/Exception/InvalidStyleException.php @@ -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; diff --git a/src/PhpWord/Exception/UnsupportedImageTypeException.php b/src/PhpWord/Exception/UnsupportedImageTypeException.php index 1b09bc8f..4c4d6c39 100644 --- a/src/PhpWord/Exception/UnsupportedImageTypeException.php +++ b/src/PhpWord/Exception/UnsupportedImageTypeException.php @@ -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; /** diff --git a/src/PhpWord/IOFactory.php b/src/PhpWord/IOFactory.php index c868841a..f33b2500 100644 --- a/src/PhpWord/IOFactory.php +++ b/src/PhpWord/IOFactory.php @@ -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}."); } + 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(); } } diff --git a/src/PhpWord/Media.php b/src/PhpWord/Media.php index df337854..b696d796 100644 --- a/src/PhpWord/Media.php +++ b/src/PhpWord/Media.php @@ -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,15 +97,17 @@ 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']; } + + $mediaData = self::$elements[$container][$mediaId]; + if (!is_null($image)) { + $image->setTarget($mediaData['target']); + $image->setMediaIndex($mediaData['mediaIndex']); + } + + return $mediaData['rID']; } /** @@ -116,7 +115,7 @@ class Media * * @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,13 +156,15 @@ class Media $elements[$key] = $val; } } + return $elements; - } else { - if (!isset(self::$elements[$container])) { - return $elements; - } - return self::getElementsByType($container, $type); } + + if (!isset(self::$elements[$container])) { + return $elements; + } + + return self::getElementsByType($container, $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 */ diff --git a/src/PhpWord/Metadata/Compatibility.php b/src/PhpWord/Metadata/Compatibility.php index eb93274d..b6cc3b61 100644 --- a/src/PhpWord/Metadata/Compatibility.php +++ b/src/PhpWord/Metadata/Compatibility.php @@ -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; /** diff --git a/src/PhpWord/Metadata/DocInfo.php b/src/PhpWord/Metadata/DocInfo.php index 63a7d515..9239f71f 100644 --- a/src/PhpWord/Metadata/DocInfo.php +++ b/src/PhpWord/Metadata/DocInfo.php @@ -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; /** @@ -119,17 +118,17 @@ class DocInfo */ public function __construct() { - $this->creator = ''; + $this->creator = ''; $this->lastModifiedBy = $this->creator; - $this->created = time(); - $this->modified = time(); - $this->title = ''; - $this->subject = ''; - $this->description = ''; - $this->keywords = ''; - $this->category = ''; - $this->company = ''; - $this->manager = ''; + $this->created = time(); + $this->modified = time(); + $this->title = ''; + $this->subject = ''; + $this->description = ''; + $this->keywords = ''; + $this->category = ''; + $this->company = ''; + $this->manager = ''; } /** @@ -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; } diff --git a/src/PhpWord/Metadata/Protection.php b/src/PhpWord/Metadata/Protection.php index 0e2ee7c1..18747061 100644 --- a/src/PhpWord/Metadata/Protection.php +++ b/src/PhpWord/Metadata/Protection.php @@ -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; /** diff --git a/src/PhpWord/Metadata/Settings.php b/src/PhpWord/Metadata/Settings.php index 9b2c2285..7cf79b2e 100644 --- a/src/PhpWord/Metadata/Settings.php +++ b/src/PhpWord/Metadata/Settings.php @@ -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) { @@ -203,7 +204,7 @@ class Settings /** * Get the Visibility of Annotation Types - * + * * @return \PhpOffice\PhpWord\ComplexType\TrackChangesView */ public function getRevisionView() @@ -213,7 +214,7 @@ class Settings /** * Set the Visibility of Annotation Types - * + * * @param TrackChangesView $trackChangesView */ public function setRevisionView(TrackChangesView $trackChangesView = null) @@ -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) { @@ -293,7 +294,7 @@ class Settings /** * Returns the Radix Point for Field Code Evaluation - * + * * @return string */ public function getDecimalSymbol() @@ -303,7 +304,7 @@ class Settings /** * sets the Radix Point for Field Code Evaluation - * + * * @param string $decimalSymbol */ public function setDecimalSymbol($decimalSymbol) diff --git a/src/PhpWord/PhpWord.php b/src/PhpWord/PhpWord.php index 1571537e..c3dfac70 100644 --- a/src/PhpWord/PhpWord.php +++ b/src/PhpWord/PhpWord.php @@ -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'); diff --git a/src/PhpWord/Reader/AbstractReader.php b/src/PhpWord/Reader/AbstractReader.php index 93288c3b..be1a2a09 100644 --- a/src/PhpWord/Reader/AbstractReader.php +++ b/src/PhpWord/Reader/AbstractReader.php @@ -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."); } } diff --git a/src/PhpWord/Reader/HTML.php b/src/PhpWord/Reader/HTML.php index 824573e9..d58908e5 100644 --- a/src/PhpWord/Reader/HTML.php +++ b/src/PhpWord/Reader/HTML.php @@ -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; diff --git a/src/PhpWord/Reader/MsDoc.php b/src/PhpWord/Reader/MsDoc.php index f21b2bf4..e5fd3ca3 100644 --- a/src/PhpWord/Reader/MsDoc.php +++ b/src/PhpWord/Reader/MsDoc.php @@ -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; } @@ -1215,7 +1216,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } $this->arrayFonts[] = array( 'main' => $xszFfn, - 'alt' => $xszAlt, + 'alt' => $xszAlt, ); } } @@ -1303,7 +1304,7 @@ class MsDoc extends AbstractReader implements ReaderInterface print_r('$sprm.ispmd : 0x'.dechex($sprm_IsPmd).PHP_EOL); print_r('$sprm.f : 0x'.dechex($sprm_F).PHP_EOL); print_r('$sprm.sgc : 0x'.dechex($sprm_Sgc)); - switch(dechex($sprm_Sgc)) { + switch (dechex($sprm_Sgc)) { case 0x01: print_r(' (Paragraph property)'); break; @@ -1322,12 +1323,12 @@ class MsDoc extends AbstractReader implements ReaderInterface } print_r(PHP_EOL); print_r('$sprm.spra : 0x'.dechex($sprm_Spra).PHP_EOL); - switch(dechex($sprm_Spra)) { + switch (dechex($sprm_Spra)) { case 0x0: $operand = self::getInt1d($this->dataWorkDocument, $offset); $offset += 1; $cb -= 1; - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $operand = 'OFF'; break; @@ -1376,9 +1377,9 @@ class MsDoc extends AbstractReader implements ReaderInterface } // - switch(dechex($sprm_Sgc)) { + switch (dechex($sprm_Sgc)) { case 0x01: // Sprm is modifying a paragraph property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { case 0x0A: // sprmPIlvl print_r('sprmPIlvl : '.$operand.PHP_EOL.PHP_EOL); break; @@ -1391,28 +1392,28 @@ class MsDoc extends AbstractReader implements ReaderInterface } break; case 0x02: // Sprm is modifying a character property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(2) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x03: // Sprm is modifying a picture property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(3) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x04: // Sprm is modifying a section property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; } break; case 0x05: // Sprm is modifying a table property. - switch($sprm_IsPmd) { + switch ($sprm_IsPmd) { default: print_r('$sprm_IsPmd(4) : '.$sprm_IsPmd.PHP_EOL.PHP_EOL); break; @@ -1471,7 +1472,7 @@ class MsDoc extends AbstractReader implements ReaderInterface foreach ($arrayRGB as $keyRGB => $rgb) { $oStyle = new \stdClass(); $oStyle->pos_start = $start; - $oStyle->pos_len = (int)ceil((($arrayRGFC[$keyRGB] -1) - $arrayRGFC[$keyRGB -1]) / 2); + $oStyle->pos_len = (int) ceil((($arrayRGFC[$keyRGB] - 1) - $arrayRGFC[$keyRGB - 1]) / 2); $start += $oStyle->pos_len; if ($rgb > 0) { @@ -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 */ @@ -1514,11 +1516,11 @@ class MsDoc extends AbstractReader implements ReaderInterface $length = 0; $operand = null; - switch(dechex($oSprm->spra)) { + switch (dechex($oSprm->spra)) { case 0x0: $operand = self::getInt1d($data, $pos); $length = 1; - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $operand = false; break; @@ -1558,14 +1560,15 @@ class MsDoc extends AbstractReader implements ReaderInterface } return array( - 'length' => $length, + 'length' => $length, 'operand' => $operand, ); } /** - * @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 */ @@ -1593,7 +1596,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $cbNum -= $arrayReturn['length']; $operand = $arrayReturn['operand']; - switch(dechex($oSprm->sgc)) { + switch (dechex($oSprm->sgc)) { // Paragraph property case 0x01: break; @@ -1602,7 +1605,7 @@ class MsDoc extends AbstractReader implements ReaderInterface if (!isset($oStylePrl->styleFont)) { $oStylePrl->styleFont = array(); } - switch($oSprm->isPmd) { + switch ($oSprm->isPmd) { // sprmCFRMarkIns case 0x01: break; @@ -1620,7 +1623,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFItalic case 0x36: // By default, text is not italicized. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['italic'] = $operand; @@ -1640,7 +1643,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFBold case 0x35: // By default, text is not bold. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['bold'] = $operand; @@ -1656,7 +1659,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCFStrike case 0x37: // By default, text is not struck through. - switch($operand) { + switch ($operand) { case false: case true: $oStylePrl->styleFont['strikethrough'] = $operand; @@ -1671,7 +1674,7 @@ class MsDoc extends AbstractReader implements ReaderInterface break; // sprmCKul case 0x3E: - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: $oStylePrl->styleFont['underline'] = Style\Font::UNDERLINE_NONE; break; @@ -1734,7 +1737,7 @@ class MsDoc extends AbstractReader implements ReaderInterface // sprmCIco //@link http://msdn.microsoft.com/en-us/library/dd773060%28v=office.12%29.aspx case 0x42: - switch(dechex($operand)) { + switch (dechex($operand)) { case 0x00: case 0x01: $oStylePrl->styleFont['color'] = '000000'; @@ -1787,7 +1790,7 @@ class MsDoc extends AbstractReader implements ReaderInterface break; // sprmCHps case 0x43: - $oStylePrl->styleFont['size'] = dechex($operand/2); + $oStylePrl->styleFont['size'] = dechex($operand / 2); break; // sprmCIss case 0x48: @@ -1857,7 +1860,7 @@ class MsDoc extends AbstractReader implements ReaderInterface $blue = str_pad(dechex(self::getInt1d($this->dataWorkDocument, $pos)), 2, '0', STR_PAD_LEFT); $pos += 1; $pos += 1; - $oStylePrl->styleFont['color'] = $red.$green.$blue; + $oStylePrl->styleFont['color'] = $red . $green . $blue; $cbNum -= 4; break; default: @@ -1873,7 +1876,7 @@ class MsDoc extends AbstractReader implements ReaderInterface if (!isset($oStylePrl->styleSection)) { $oStylePrl->styleSection = array(); } - switch($oSprm->isPmd) { + switch ($oSprm->isPmd) { // sprmSNfcPgn case 0x0E: // numbering format used for page numbers @@ -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,11 +2210,12 @@ 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'), + 'recVer' => ($rec >> 0) & bindec('1111'), 'recInstance' => ($rec >> 4) & bindec('111111111111'), - 'recType' => $recType, - 'recLen' => $recLen, + 'recType' => $recType, + 'recLen' => $recLen, ); } @@ -2274,7 +2278,7 @@ class MsDoc extends AbstractReader implements ReaderInterface } if (ord($sText[0]) == 1) { if (isset($oCharacters->style->image)) { - $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc').'.'.$oCharacters->style->image['format']; + $fileImage = tempnam(sys_get_temp_dir(), 'PHPWord_MsDoc') . '.' . $oCharacters->style->image['format']; file_put_contents($fileImage, $oCharacters->style->image['data']); $oSection->addImage($fileImage, array('width' => $oCharacters->style->image['width'], 'height' => $oCharacters->style->image['height'])); // print_r('>addImage<'.$fileImage.'>'.EOL); @@ -2285,7 +2289,6 @@ class MsDoc extends AbstractReader implements ReaderInterface } } } - } } @@ -2310,7 +2313,7 @@ class MsDoc extends AbstractReader implements ReaderInterface */ public static function getInt2d($data, $pos) { - return ord($data[$pos]) | (ord($data[$pos+1]) << 8); + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); } /** @@ -2322,7 +2325,7 @@ class MsDoc extends AbstractReader implements ReaderInterface */ public static function getInt3d($data, $pos) { - return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16); + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16); } /** @@ -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; + + return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24; } } diff --git a/src/PhpWord/Reader/ODText.php b/src/PhpWord/Reader/ODText.php index e8c86886..6fd135cd 100644 --- a/src/PhpWord/Reader/ODText.php +++ b/src/PhpWord/Reader/ODText.php @@ -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; @@ -40,7 +39,7 @@ class ODText extends AbstractReader implements ReaderInterface $readerParts = array( 'content.xml' => 'Content', - 'meta.xml' => 'Meta', + 'meta.xml' => 'Meta', ); foreach ($readerParts as $xmlFile => $partName) { diff --git a/src/PhpWord/Reader/ODText/AbstractPart.php b/src/PhpWord/Reader/ODText/AbstractPart.php index 5ec2f22d..f38eff7c 100644 --- a/src/PhpWord/Reader/ODText/AbstractPart.php +++ b/src/PhpWord/Reader/ODText/AbstractPart.php @@ -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; diff --git a/src/PhpWord/Reader/ODText/Content.php b/src/PhpWord/Reader/ODText/Content.php index 7362b02c..bc699abe 100644 --- a/src/PhpWord/Reader/ODText/Content.php +++ b/src/PhpWord/Reader/ODText/Content.php @@ -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) { diff --git a/src/PhpWord/Reader/ODText/Meta.php b/src/PhpWord/Reader/ODText/Meta.php index 9533c38b..6bd490a7 100644 --- a/src/PhpWord/Reader/ODText/Meta.php +++ b/src/PhpWord/Reader/ODText/Meta.php @@ -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); } } diff --git a/src/PhpWord/Reader/RTF.php b/src/PhpWord/Reader/RTF.php index b6d2e21e..982e1d1a 100644 --- a/src/PhpWord/Reader/RTF.php +++ b/src/PhpWord/Reader/RTF.php @@ -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; diff --git a/src/PhpWord/Reader/RTF/Document.php b/src/PhpWord/Reader/RTF/Document.php index 4e0f2c35..e41caba5 100644 --- a/src/PhpWord/Reader/RTF/Document.php +++ b/src/PhpWord/Reader/RTF/Document.php @@ -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; @@ -153,7 +152,7 @@ class Document // Walk each characters while ($this->offset < $this->length) { - $char = $this->rtf[$this->offset]; + $char = $this->rtf[$this->offset]; $ascii = ord($char); if (isset($markers[$ascii])) { // Marker found: {, }, \, LF, or CR @@ -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 .= "<"; + $this->text .= '<'; } elseif ('>' == $char) { - $this->text .= ">"; + $this->text .= '>'; } else { $this->text .= $char; } @@ -332,13 +331,13 @@ class Document { $controls = array( 'par' => array(self::PARA, 'paragraph', true), - 'b' => array(self::STYL, 'font', 'bold', true), - 'i' => array(self::STYL, 'font', 'italic', true), - 'u' => array(self::STYL, 'font', 'underline', true), - 'strike' => array(self::STYL, 'font', 'strikethrough',true), - 'fs' => array(self::STYL, 'font', 'size', $parameter), - 'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER), - 'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter), + 'b' => array(self::STYL, 'font', 'bold', true), + 'i' => array(self::STYL, 'font', 'italic', true), + 'u' => array(self::STYL, 'font', 'underline', true), + 'strike' => array(self::STYL, 'font', 'strikethrough', true), + 'fs' => array(self::STYL, 'font', 'size', $parameter), + 'qc' => array(self::STYL, 'paragraph', 'alignment', Jc::CENTER), + 'sa' => array(self::STYL, 'paragraph', 'spaceAfter', $parameter), 'fonttbl' => array(self::SKIP, 'fonttbl', null), 'colortbl' => array(self::SKIP, 'colortbl', null), 'info' => array(self::SKIP, 'info', null), diff --git a/src/PhpWord/Reader/ReaderInterface.php b/src/PhpWord/Reader/ReaderInterface.php index 4f5231a7..b1c3535a 100644 --- a/src/PhpWord/Reader/ReaderInterface.php +++ b/src/PhpWord/Reader/ReaderInterface.php @@ -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); diff --git a/src/PhpWord/Reader/Word2007.php b/src/PhpWord/Reader/Word2007.php index 875415a3..14ce3242 100644 --- a/src/PhpWord/Reader/Word2007.php +++ b/src/PhpWord/Reader/Word2007.php @@ -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; @@ -55,7 +54,7 @@ class Word2007 extends AbstractReader implements ReaderInterface array('stepPart' => 'document', 'stepItems' => array( 'endnotes' => 'Endnotes', 'footnotes' => 'Footnotes', - 'settings' => 'Settings', + 'settings' => 'Settings', )), ); @@ -94,7 +93,6 @@ class Word2007 extends AbstractReader implements ReaderInterface $part->setRels($relationships); $part->read($phpWord); } - } /** diff --git a/src/PhpWord/Reader/Word2007/AbstractPart.php b/src/PhpWord/Reader/Word2007/AbstractPart.php index 51970a06..93bf8a01 100644 --- a/src/PhpWord/Reader/Word2007/AbstractPart.php +++ b/src/PhpWord/Reader/Word2007/AbstractPart.php @@ -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; @@ -36,9 +35,9 @@ abstract class AbstractPart */ const READ_VALUE = 'attributeValue'; // Read attribute value const READ_EQUAL = 'attributeEquals'; // Read `true` when attribute value equals specified value - const READ_TRUE = 'attributeTrue'; // Read `true` when element exists + const READ_TRUE = 'attributeTrue'; // Read `true` when element exists const READ_FALSE = 'attributeFalse'; // Read `false` when element exists - const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size + const READ_SIZE = 'attributeMultiplyByTwo'; // Read special attribute value for Font::$size /** * Document file @@ -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 = ""; $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; diff --git a/src/PhpWord/Reader/Word2007/DocPropsApp.php b/src/PhpWord/Reader/Word2007/DocPropsApp.php index 6b1410a5..679abbcf 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsApp.php +++ b/src/PhpWord/Reader/Word2007/DocPropsApp.php @@ -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; /** diff --git a/src/PhpWord/Reader/Word2007/DocPropsCore.php b/src/PhpWord/Reader/Word2007/DocPropsCore.php index 417a93bd..4261ce79 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCore.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCore.php @@ -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; @@ -33,15 +32,15 @@ class DocPropsCore extends AbstractPart * @var array */ protected $mapping = array( - 'dc:creator' => 'setCreator', - 'dc:title' => 'setTitle', - 'dc:description' => 'setDescription', - 'dc:subject' => 'setSubject', - 'cp:keywords' => 'setKeywords', - 'cp:category' => 'setCategory', + 'dc:creator' => 'setCreator', + 'dc:title' => 'setTitle', + 'dc:description' => 'setDescription', + 'dc:subject' => 'setSubject', + 'cp:keywords' => 'setKeywords', + 'cp:category' => 'setCategory', 'cp:lastModifiedBy' => 'setLastModifiedBy', - 'dcterms:created' => 'setCreated', - 'dcterms:modified' => 'setModified', + 'dcterms:created' => 'setCreated', + 'dcterms:modified' => 'setModified', ); /** diff --git a/src/PhpWord/Reader/Word2007/DocPropsCustom.php b/src/PhpWord/Reader/Word2007/DocPropsCustom.php index 979a2441..9b44cd51 100644 --- a/src/PhpWord/Reader/Word2007/DocPropsCustom.php +++ b/src/PhpWord/Reader/Word2007/DocPropsCustom.php @@ -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; diff --git a/src/PhpWord/Reader/Word2007/Document.php b/src/PhpWord/Reader/Word2007/Document.php index e5063fd9..5a8f091b 100644 --- a/src/PhpWord/Reader/Word2007/Document.php +++ b/src/PhpWord/Reader/Word2007/Document.php @@ -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) { @@ -131,7 +128,7 @@ class Document extends AbstractPart $id = $xmlReader->getAttribute('r:id', $node); $styles['hf'][$id] = array( 'method' => str_replace('w:', '', str_replace('Reference', '', $node->nodeName)), - 'type' => $xmlReader->getAttribute('w:type', $node), + 'type' => $xmlReader->getAttribute('w:type', $node), ); } } @@ -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 */ @@ -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) { diff --git a/src/PhpWord/Reader/Word2007/Endnotes.php b/src/PhpWord/Reader/Word2007/Endnotes.php index 7bcafc6a..010591c3 100644 --- a/src/PhpWord/Reader/Word2007/Endnotes.php +++ b/src/PhpWord/Reader/Word2007/Endnotes.php @@ -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; /** diff --git a/src/PhpWord/Reader/Word2007/Footnotes.php b/src/PhpWord/Reader/Word2007/Footnotes.php index 3d85af71..ba1e2c69 100644 --- a/src/PhpWord/Reader/Word2007/Footnotes.php +++ b/src/PhpWord/Reader/Word2007/Footnotes.php @@ -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; diff --git a/src/PhpWord/Reader/Word2007/Numbering.php b/src/PhpWord/Reader/Word2007/Numbering.php index a00a6307..c16af7b2 100644 --- a/src/PhpWord/Reader/Word2007/Numbering.php +++ b/src/PhpWord/Reader/Word2007/Numbering.php @@ -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) diff --git a/src/PhpWord/Reader/Word2007/Settings.php b/src/PhpWord/Reader/Word2007/Settings.php index d2ffc1f3..58f32ec6 100644 --- a/src/PhpWord/Reader/Word2007/Settings.php +++ b/src/PhpWord/Reader/Word2007/Settings.php @@ -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) { @@ -57,9 +54,9 @@ class Settings extends AbstractPart } else { $docSettings->$method(true); } - } else if (method_exists($this, $method)) { + } elseif (method_exists($this, $method)) { $this->$method($xmlReader, $phpWord, $node); - } else if (method_exists($docSettings, $method)) { + } elseif (method_exists($docSettings, $method)) { $docSettings->$method($value); } } @@ -68,7 +65,7 @@ class Settings extends AbstractPart /** * Sets the document protection - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -83,7 +80,7 @@ class Settings extends AbstractPart /** * Sets the proof state - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -105,7 +102,7 @@ class Settings extends AbstractPart /** * Sets the proof state - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node @@ -122,7 +119,7 @@ class Settings extends AbstractPart /** * Set the Revision view - * + * * @param XMLReader $xmlReader * @param PhpWord $phpWord * @param \DOMNode $node diff --git a/src/PhpWord/Reader/Word2007/Styles.php b/src/PhpWord/Reader/Word2007/Styles.php index 645c9830..6e90360e 100644 --- a/src/PhpWord/Reader/Word2007/Styles.php +++ b/src/PhpWord/Reader/Word2007/Styles.php @@ -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)) { diff --git a/src/PhpWord/Settings.php b/src/PhpWord/Settings.php index 70fad3e8..38965e35 100644 --- a/src/PhpWord/Settings.php +++ b/src/PhpWord/Settings.php @@ -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; /** @@ -30,8 +29,8 @@ class Settings * @const string */ const ZIPARCHIVE = 'ZipArchive'; - const PCLZIP = 'PclZip'; - const OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'; // @deprecated 0.11 + const PCLZIP = 'PclZip'; + const OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'; // @deprecated 0.11 /** * PDF rendering libraries @@ -39,8 +38,8 @@ class Settings * @const string */ const PDF_RENDERER_DOMPDF = 'DomPDF'; - const PDF_RENDERER_TCPDF = 'TCPDF'; - const PDF_RENDERER_MPDF = 'MPDF'; + const PDF_RENDERER_TCPDF = 'TCPDF'; + const PDF_RENDERER_MPDF = 'MPDF'; /** * Measurement units multiplication factor @@ -53,12 +52,12 @@ class Settings * * @const string */ - const UNIT_TWIP = 'twip'; // = 1/20 point - const UNIT_CM = 'cm'; - const UNIT_MM = 'mm'; - const UNIT_INCH = 'inch'; + const UNIT_TWIP = 'twip'; // = 1/20 point + const UNIT_CM = 'cm'; + const UNIT_MM = 'mm'; + const UNIT_INCH = 'inch'; const UNIT_POINT = 'point'; // = 1/72 inch - const UNIT_PICA = 'pica'; // = 1/6 inch = 12 points + const UNIT_PICA = 'pica'; // = 1/6 inch = 12 points /** * Default font settings @@ -154,7 +153,7 @@ class Settings */ public static function setCompatibility($compatibility) { - $compatibility = (bool)$compatibility; + $compatibility = (bool) $compatibility; self::$xmlWriterCompatibility = $compatibility; return true; @@ -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 */ @@ -318,8 +317,8 @@ class Settings /** * @since 0.13.0 - * - * @return boolean + * + * @return bool * * @codeCoverageIgnore */ @@ -330,8 +329,8 @@ 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; } diff --git a/src/PhpWord/Shared/AbstractEnum.php b/src/PhpWord/Shared/AbstractEnum.php index f116e511..d7839c4f 100644 --- a/src/PhpWord/Shared/AbstractEnum.php +++ b/src/PhpWord/Shared/AbstractEnum.php @@ -3,7 +3,6 @@ namespace PhpOffice\PhpWord\Shared; abstract class AbstractEnum { - private static $constCacheArray = null; private static function getConstants() @@ -12,16 +11,17 @@ abstract class AbstractEnum self::$constCacheArray = array(); } $calledClass = get_called_class(); - if (! array_key_exists($calledClass, self::$constCacheArray)) { + if (!array_key_exists($calledClass, self::$constCacheArray)) { $reflect = new \ReflectionClass($calledClass); self::$constCacheArray[$calledClass] = $reflect->getConstants(); } + return self::$constCacheArray[$calledClass]; } /** * Returns all values for this enum - * + * * @return array */ public static function values() @@ -31,19 +31,20 @@ 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); } /** * Validates that the value passed is a valid value - * + * * @param string $value * @throws \InvalidArgumentException if the value passed is not valid for this enum */ diff --git a/src/PhpWord/Shared/Converter.php b/src/PhpWord/Shared/Converter.php index e5cb5b25..19615286 100644 --- a/src/PhpWord/Shared/Converter.php +++ b/src/PhpWord/Shared/Converter.php @@ -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; /** @@ -22,12 +21,12 @@ namespace PhpOffice\PhpWord\Shared; */ class Converter { - const INCH_TO_CM = 2.54; - const INCH_TO_TWIP = 1440; - const INCH_TO_PIXEL = 96; - const INCH_TO_POINT = 72; - const PIXEL_TO_EMU = 9525; - const DEGREE_TO_ANGLE = 60000; + const INCH_TO_CM = 2.54; + const INCH_TO_TWIP = 1440; + const INCH_TO_PIXEL = 96; + const INCH_TO_POINT = 72; + const PIXEL_TO_EMU = 9525; + const DEGREE_TO_ANGLE = 60000; /** * Convert centimeter to twip @@ -235,7 +234,7 @@ class Converter */ public static function degreeToAngle($degree = 1) { - return (int)round($degree * self::DEGREE_TO_ANGLE); + return (int) round($degree * self::DEGREE_TO_ANGLE); } /** diff --git a/src/PhpWord/Shared/Html.php b/src/PhpWord/Shared/Html.php index d03d0adf..b3c38f00 100644 --- a/src/PhpWord/Shared/Html.php +++ b/src/PhpWord/Shared/Html.php @@ -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; @@ -235,7 +234,7 @@ class Html // Commented as source of bug #257. `method_exists` doesn't seems to work properly in this case. // @todo Find better error checking for this one // if (method_exists($element, 'addText')) { - $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); + $element->addText($node->nodeValue, $styles['font'], $styles['paragraph']); // } return null; @@ -275,14 +274,14 @@ class Html // $attributes = $node->attributes; // if ($attributes->getNamedItem('width') !== null) { - // $newElement->setWidth($attributes->getNamedItem('width')->value); + // $newElement->setWidth($attributes->getNamedItem('width')->value); // } // if ($attributes->getNamedItem('height') !== null) { - // $newElement->setHeight($attributes->getNamedItem('height')->value); + // $newElement->setHeight($attributes->getNamedItem('height')->value); // } // if ($attributes->getNamedItem('width') !== null) { - // $newElement=$element->addCell($width=$attributes->getNamedItem('width')->value); + // $newElement=$element->addCell($width=$attributes->getNamedItem('width')->value); // } return $newElement; @@ -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; } } diff --git a/src/PhpWord/Shared/OLERead.php b/src/PhpWord/Shared/OLERead.php index cf9b15d3..398f28b3 100644 --- a/src/PhpWord/Shared/OLERead.php +++ b/src/PhpWord/Shared/OLERead.php @@ -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; } - } /** diff --git a/src/PhpWord/Shared/ZipArchive.php b/src/PhpWord/Shared/ZipArchive.php index 4dc4af4e..1bd8f2b0 100644 --- a/src/PhpWord/Shared/ZipArchive.php +++ b/src/PhpWord/Shared/ZipArchive.php @@ -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; @@ -37,7 +36,7 @@ use PhpOffice\PhpWord\Settings; class ZipArchive { /** @const int Flags for open method */ - const CREATE = 1; // Emulate \ZipArchive::CREATE + const CREATE = 1; // Emulate \ZipArchive::CREATE const OVERWRITE = 8; // Emulate \ZipArchive::OVERWRITE /** @@ -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; } /** diff --git a/src/PhpWord/SimpleType/Jc.php b/src/PhpWord/SimpleType/Jc.php index 5c399a16..ad035518 100644 --- a/src/PhpWord/SimpleType/Jc.php +++ b/src/PhpWord/SimpleType/Jc.php @@ -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\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/JcTable.php b/src/PhpWord/SimpleType/JcTable.php index 865b25a8..f0278b4c 100644 --- a/src/PhpWord/SimpleType/JcTable.php +++ b/src/PhpWord/SimpleType/JcTable.php @@ -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\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/NumberFormat.php b/src/PhpWord/SimpleType/NumberFormat.php index 9d24a2b3..8e4ccb9e 100644 --- a/src/PhpWord/SimpleType/NumberFormat.php +++ b/src/PhpWord/SimpleType/NumberFormat.php @@ -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\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/SimpleType/Zoom.php b/src/PhpWord/SimpleType/Zoom.php index 3b78fdf9..679632c3 100644 --- a/src/PhpWord/SimpleType/Zoom.php +++ b/src/PhpWord/SimpleType/Zoom.php @@ -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\SimpleType; use PhpOffice\PhpWord\Shared\AbstractEnum; diff --git a/src/PhpWord/Style.php b/src/PhpWord/Style.php index 57d9d692..31324564 100644 --- a/src/PhpWord/Style.php +++ b/src/PhpWord/Style.php @@ -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\Style\AbstractStyle; @@ -126,8 +125,6 @@ class Style * Reset styles. * * @since 0.10.0 - * - * @return void */ public static function resetStyles() { @@ -165,9 +162,9 @@ class Style { if (isset(self::$styles[$styleName])) { return self::$styles[$styleName]; - } else { - return null; } + + return null; } /** diff --git a/src/PhpWord/Style/AbstractStyle.php b/src/PhpWord/Style/AbstractStyle.php index 05c79ea2..e42c8ca6 100644 --- a/src/PhpWord/Style/AbstractStyle.php +++ b/src/PhpWord/Style/AbstractStyle.php @@ -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\Style; use PhpOffice\Common\Text; @@ -138,10 +137,11 @@ abstract class AbstractStyle { if ($substyleObject !== null) { $method = "get{$substyleProperty}"; + return $substyleObject->$method(); - } else { - return null; } + + return null; } /** @@ -242,12 +242,12 @@ abstract class AbstractStyle protected function setIntVal($value, $default = null) { if (is_string($value) && (preg_match('/[^\d]/', $value) == 0)) { - $value = intval($value); + $value = (int) $value; } if (!is_numeric($value)) { $value = $default; } else { - $value = intval($value); + $value = (int) $value; } return $value; @@ -263,7 +263,7 @@ abstract class AbstractStyle protected function setFloatVal($value, $default = null) { if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) { - $value = floatval($value); + $value = (float) $value; } if (!is_numeric($value)) { $value = $default; @@ -279,14 +279,13 @@ abstract class AbstractStyle * @param array $enum * @param mixed $default * - * @return mixed - * * @throws \InvalidArgumentException + * @return mixed */ protected function setEnumVal($value = null, $enum = array(), $default = null) { if ($value != null && trim($value) != '' && !empty($enum) && !in_array($value, $enum)) { - throw new \InvalidArgumentException("Invalid style value: {$value} Options:".join(',', $enum)); + throw new \InvalidArgumentException("Invalid style value: {$value} Options:" . implode(',', $enum)); } elseif ($value === null || trim($value) == '') { $value = $default; } diff --git a/src/PhpWord/Style/Border.php b/src/PhpWord/Style/Border.php index d3bc2e57..a4fc3312 100644 --- a/src/PhpWord/Style/Border.php +++ b/src/PhpWord/Style/Border.php @@ -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\Style; /** @@ -81,7 +80,7 @@ class Border extends AbstractStyle /** * Get border size * - * @return integer[] + * @return int[] */ public function getBorderSize() { diff --git a/src/PhpWord/Style/Cell.php b/src/PhpWord/Style/Cell.php index 7bab8b56..4bcf6104 100644 --- a/src/PhpWord/Style/Cell.php +++ b/src/PhpWord/Style/Cell.php @@ -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\Style; /** @@ -72,7 +71,7 @@ class Cell extends Border /** * colspan * - * @var integer + * @var int */ private $gridSpan; @@ -150,9 +149,9 @@ class Cell extends Border { if ($this->shading !== null) { return $this->shading->getFill(); - } else { - return null; } + + return null; } /** @@ -169,7 +168,7 @@ class Cell extends Border /** * Get grid span (colspan). * - * @return integer + * @return int */ public function getGridSpan() { diff --git a/src/PhpWord/Style/Chart.php b/src/PhpWord/Style/Chart.php index 8e1f4b61..8e4b79b4 100644 --- a/src/PhpWord/Style/Chart.php +++ b/src/PhpWord/Style/Chart.php @@ -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\Style; /** @@ -24,7 +23,6 @@ namespace PhpOffice\PhpWord\Style; */ class Chart extends AbstractStyle { - /** * Width (in EMU) * diff --git a/src/PhpWord/Style/Extrusion.php b/src/PhpWord/Style/Extrusion.php index d8c5e65f..6537b0da 100644 --- a/src/PhpWord/Style/Extrusion.php +++ b/src/PhpWord/Style/Extrusion.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Fill.php b/src/PhpWord/Style/Fill.php index cf6ffb41..432604d8 100644 --- a/src/PhpWord/Style/Fill.php +++ b/src/PhpWord/Style/Fill.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Font.php b/src/PhpWord/Style/Font.php index 9056844a..36020625 100644 --- a/src/PhpWord/Style/Font.php +++ b/src/PhpWord/Style/Font.php @@ -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\Style; /** @@ -223,8 +222,8 @@ class Font extends AbstractStyle private $shading; /** - * Right to left languages - * @var boolean + * Right to left languages + * @var bool */ private $rtl = false; diff --git a/src/PhpWord/Style/Frame.php b/src/PhpWord/Style/Frame.php index 0a99146b..deb9234b 100644 --- a/src/PhpWord/Style/Frame.php +++ b/src/PhpWord/Style/Frame.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Style/Image.php b/src/PhpWord/Style/Image.php index f2c88b5f..ed80fe21 100644 --- a/src/PhpWord/Style/Image.php +++ b/src/PhpWord/Style/Image.php @@ -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\Style; diff --git a/src/PhpWord/Style/Indentation.php b/src/PhpWord/Style/Indentation.php index 0408929b..c0ac025f 100644 --- a/src/PhpWord/Style/Indentation.php +++ b/src/PhpWord/Style/Indentation.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Line.php b/src/PhpWord/Style/Line.php index f8cc4026..aa211692 100644 --- a/src/PhpWord/Style/Line.php +++ b/src/PhpWord/Style/Line.php @@ -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\Style; @@ -55,7 +55,7 @@ class Line extends Image /** * flip Line * - * @var boolean + * @var bool */ private $flip = false; @@ -104,7 +104,7 @@ class Line extends Image /** * Get flip * - * @return boolean + * @return bool */ public function isFlip() { @@ -114,7 +114,7 @@ class Line extends Image /** * Set flip * - * @param boolean $value + * @param bool $value * @return self */ public function setFlip($value = false) @@ -143,7 +143,7 @@ class Line extends Image public function setConnectorType($value = null) { $enum = array( - self::CONNECTOR_TYPE_STRAIGHT + self::CONNECTOR_TYPE_STRAIGHT, ); $this->connectorType = $this->setEnumVal($value, $enum, $this->connectorType); @@ -216,7 +216,7 @@ class Line extends Image { $enum = array( self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND, - self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL + self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL, ); $this->beginArrow = $this->setEnumVal($value, $enum, $this->beginArrow); @@ -243,7 +243,7 @@ class Line extends Image { $enum = array( self::ARROW_STYLE_BLOCK, self::ARROW_STYLE_CLASSIC, self::ARROW_STYLE_DIAMOND, - self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL + self::ARROW_STYLE_OPEN, self::ARROW_STYLE_OVAL, ); $this->endArrow = $this->setEnumVal($value, $enum, $this->endArrow); @@ -271,7 +271,7 @@ class Line extends Image $enum = array( self::DASH_STYLE_DASH, self::DASH_STYLE_DASH_DOT, self::DASH_STYLE_LONG_DASH, self::DASH_STYLE_LONG_DASH_DOT, self::DASH_STYLE_LONG_DASH_DOT_DOT, self::DASH_STYLE_ROUND_DOT, - self::DASH_STYLE_SQUARE_DOT + self::DASH_STYLE_SQUARE_DOT, ); $this->dash = $this->setEnumVal($value, $enum, $this->dash); diff --git a/src/PhpWord/Style/LineNumbering.php b/src/PhpWord/Style/LineNumbering.php index e125f477..70a44d59 100644 --- a/src/PhpWord/Style/LineNumbering.php +++ b/src/PhpWord/Style/LineNumbering.php @@ -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\Style; /** @@ -26,8 +25,8 @@ namespace PhpOffice\PhpWord\Style; class LineNumbering extends AbstractStyle { /** @const string Line numbering restart setting http://www.schemacentral.com/sc/ooxml/a-w_restart-1.html */ - const LINE_NUMBERING_CONTINUOUS = 'continuous'; - const LINE_NUMBERING_NEW_PAGE = 'newPage'; + const LINE_NUMBERING_CONTINUOUS = 'continuous'; + const LINE_NUMBERING_NEW_PAGE = 'newPage'; const LINE_NUMBERING_NEW_SECTION = 'newSection'; /** diff --git a/src/PhpWord/Style/ListItem.php b/src/PhpWord/Style/ListItem.php index 18ea0bf2..cad78080 100644 --- a/src/PhpWord/Style/ListItem.php +++ b/src/PhpWord/Style/ListItem.php @@ -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\Style; use PhpOffice\PhpWord\Style; @@ -38,7 +37,7 @@ class ListItem extends AbstractStyle /** * Legacy list type * - * @var integer + * @var int */ private $listType; @@ -53,7 +52,7 @@ class ListItem extends AbstractStyle /** * Numbering definition instance ID * - * @var integer + * @var int * @since 0.10.0 */ private $numId; @@ -75,7 +74,7 @@ class ListItem extends AbstractStyle /** * Get List Type * - * @return integer + * @return int */ public function getListType() { @@ -85,7 +84,7 @@ class ListItem extends AbstractStyle /** * Set legacy list type for version < 0.10.0 * - * @param integer $value + * @param int $value * @return self */ public function setListType($value = self::TYPE_BULLET_FILLED) @@ -93,7 +92,7 @@ class ListItem extends AbstractStyle $enum = array( self::TYPE_SQUARE_FILLED, self::TYPE_BULLET_FILLED, self::TYPE_BULLET_EMPTY, self::TYPE_NUMBER, - self::TYPE_NUMBER_NESTED, self::TYPE_ALPHANUM + self::TYPE_NUMBER_NESTED, self::TYPE_ALPHANUM, ); $this->listType = $this->setEnumVal($value, $enum, $this->listType); $this->getListTypeStyle(); @@ -132,7 +131,7 @@ class ListItem extends AbstractStyle /** * Get numbering Id * - * @return integer + * @return int */ public function getNumId() { @@ -151,6 +150,7 @@ class ListItem extends AbstractStyle $numStyle = "PHPWordList{$this->listType}"; if (Style::getStyle($numStyle) !== null) { $this->setNumStyle($numStyle); + return; } @@ -160,7 +160,7 @@ class ListItem extends AbstractStyle // Legacy level information $listTypeStyles = array( self::TYPE_SQUARE_FILLED => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, , left, 720, 720, 360, Wingdings, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -174,7 +174,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_BULLET_FILLED => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, , left, 720, 720, 360, Symbol, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -188,7 +188,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_BULLET_EMPTY => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, bullet, o, left, 720, 720, 360, Courier New, default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -202,7 +202,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_NUMBER => array( - 'type' => 'hybridMultilevel', + 'type' => 'hybridMultilevel', 'levels' => array( 0 => '1, decimal, %1., left, 720, 720, 360, , default', 1 => '1, bullet, o, left, 1440, 1440, 360, Courier New, default', @@ -216,7 +216,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_NUMBER_NESTED => array( - 'type' => 'multilevel', + 'type' => 'multilevel', 'levels' => array( 0 => '1, decimal, %1., left, 360, 360, 360, , ', 1 => '1, decimal, %1.%2., left, 792, 792, 432, , ', @@ -230,7 +230,7 @@ class ListItem extends AbstractStyle ), ), self::TYPE_ALPHANUM => array( - 'type' => 'multilevel', + 'type' => 'multilevel', 'levels' => array( 0 => '1, decimal, %1., left, 720, 720, 360, , ', 1 => '1, lowerLetter, %2., left, 1440, 1440, 360, , ', diff --git a/src/PhpWord/Style/Numbering.php b/src/PhpWord/Style/Numbering.php index 0d4fd85d..2d0e01a2 100644 --- a/src/PhpWord/Style/Numbering.php +++ b/src/PhpWord/Style/Numbering.php @@ -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\Style; /** @@ -53,7 +52,7 @@ class Numbering extends AbstractStyle /** * Get Id * - * @return integer + * @return int */ public function getNumId() { @@ -63,7 +62,7 @@ class Numbering extends AbstractStyle /** * Set Id * - * @param integer $value + * @param int $value * @return self */ public function setNumId($value) diff --git a/src/PhpWord/Style/NumberingLevel.php b/src/PhpWord/Style/NumberingLevel.php index 38b9fbee..0e4cd10a 100644 --- a/src/PhpWord/Style/NumberingLevel.php +++ b/src/PhpWord/Style/NumberingLevel.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; @@ -31,14 +30,14 @@ class NumberingLevel extends AbstractStyle /** * Level number, 0 to 8 (total 9 levels) * - * @var integer + * @var int */ private $level = 0; /** * Starting value w:start * - * @var integer + * @var int * @link http://www.schemacentral.com/sc/ooxml/e-w_start-1.html */ private $start = 1; @@ -54,7 +53,7 @@ class NumberingLevel extends AbstractStyle /** * Restart numbering level symbol w:lvlRestart * - * @var integer + * @var int * @link http://www.schemacentral.com/sc/ooxml/e-w_lvlRestart-1.html */ private $restart; @@ -85,7 +84,7 @@ class NumberingLevel extends AbstractStyle /** * Justification, w:lvlJc - * + * * @var string, one of PhpOffice\PhpWord\SimpleType\Jc */ private $alignment = ''; @@ -93,21 +92,21 @@ class NumberingLevel extends AbstractStyle /** * Left * - * @var integer + * @var int */ private $left; /** * Hanging * - * @var integer + * @var int */ private $hanging; /** * Tab position * - * @var integer + * @var int */ private $tabPos; @@ -129,7 +128,7 @@ class NumberingLevel extends AbstractStyle /** * Get level * - * @return integer + * @return int */ public function getLevel() { @@ -139,19 +138,20 @@ class NumberingLevel extends AbstractStyle /** * Set level * - * @param integer $value + * @param int $value * @return self */ public function setLevel($value) { $this->level = $this->setIntVal($value, $this->level); + return $this; } /** * Get start * - * @return integer + * @return int */ public function getStart() { @@ -161,12 +161,13 @@ class NumberingLevel extends AbstractStyle /** * Set start * - * @param integer $value + * @param int $value * @return self */ public function setStart($value) { $this->start = $this->setIntVal($value, $this->start); + return $this; } @@ -189,13 +190,14 @@ class NumberingLevel extends AbstractStyle public function setFormat($value) { $this->format = $this->setEnumVal($value, NumberFormat::values(), $this->format); + return $this; } /** * Get restart * - * @return integer + * @return int */ public function getRestart() { @@ -205,12 +207,13 @@ class NumberingLevel extends AbstractStyle /** * Set restart * - * @param integer $value + * @param int $value * @return self */ public function setRestart($value) { $this->restart = $this->setIntVal($value, $this->restart); + return $this; } @@ -233,6 +236,7 @@ class NumberingLevel extends AbstractStyle public function setPStyle($value) { $this->pStyle = $value; + return $this; } @@ -256,6 +260,7 @@ class NumberingLevel extends AbstractStyle { $enum = array('tab', 'space', 'nothing'); $this->suffix = $this->setEnumVal($value, $enum, $this->suffix); + return $this; } @@ -278,6 +283,7 @@ class NumberingLevel extends AbstractStyle public function setText($value) { $this->text = $value; + return $this; } @@ -336,7 +342,7 @@ class NumberingLevel extends AbstractStyle /** * Get left * - * @return integer + * @return int */ public function getLeft() { @@ -346,19 +352,20 @@ class NumberingLevel extends AbstractStyle /** * Set left * - * @param integer $value + * @param int $value * @return self */ public function setLeft($value) { $this->left = $this->setIntVal($value, $this->left); + return $this; } /** * Get hanging * - * @return integer + * @return int */ public function getHanging() { @@ -368,19 +375,20 @@ class NumberingLevel extends AbstractStyle /** * Set hanging * - * @param integer $value + * @param int $value * @return self */ public function setHanging($value) { $this->hanging = $this->setIntVal($value, $this->hanging); + return $this; } /** * Get tab * - * @return integer + * @return int */ public function getTabPos() { @@ -390,12 +398,13 @@ class NumberingLevel extends AbstractStyle /** * Set tab * - * @param integer $value + * @param int $value * @return self */ public function setTabPos($value) { $this->tabPos = $this->setIntVal($value, $this->tabPos); + return $this; } @@ -418,6 +427,7 @@ class NumberingLevel extends AbstractStyle public function setFont($value) { $this->font = $value; + return $this; } diff --git a/src/PhpWord/Style/Outline.php b/src/PhpWord/Style/Outline.php index 8628c4c5..cc9c4e03 100644 --- a/src/PhpWord/Style/Outline.php +++ b/src/PhpWord/Style/Outline.php @@ -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\Style; /** @@ -226,7 +225,7 @@ class Outline extends AbstractStyle public function setLine($value = null) { $enum = array(self::LINE_SINGLE, self::LINE_THIN_THIN, self::LINE_THIN_THICK, - self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN); + self::LINE_THICK_THIN, self::LINE_THICK_BETWEEN_THIN, ); $this->line = $this->setEnumVal($value, $enum, null); return $this; @@ -275,7 +274,7 @@ class Outline extends AbstractStyle public function setStartArrow($value = null) { $enum = array(self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, - self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN); + self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ); $this->startArrow = $this->setEnumVal($value, $enum, null); return $this; @@ -300,7 +299,7 @@ class Outline extends AbstractStyle public function setEndArrow($value = null) { $enum = array(self::ARROW_NONE, self::ARROW_BLOCK, self::ARROW_CLASSIC, - self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN); + self::ARROW_OVAL, self::ARROW_DIAMOND, self::ARROW_OPEN, ); $this->endArrow = $this->setEnumVal($value, $enum, null); return $this; diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php index eb0bcd77..44a4efd5 100644 --- a/src/PhpWord/Style/Paper.php +++ b/src/PhpWord/Style/Paper.php @@ -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\Style; use PhpOffice\PhpWord\Shared\Converter; diff --git a/src/PhpWord/Style/Paragraph.php b/src/PhpWord/Style/Paragraph.php index bad9ace9..c7a22b39 100644 --- a/src/PhpWord/Style/Paragraph.php +++ b/src/PhpWord/Style/Paragraph.php @@ -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\Style; use PhpOffice\Common\Text; @@ -157,7 +156,7 @@ class Paragraph extends Border * @var \PhpOffice\PhpWord\Style\Shading */ private $shading; - + /** * Ignore Spacing Above and Below When Using Identical Styles * @@ -412,7 +411,7 @@ class Paragraph extends Border /** * Get space before paragraph * - * @return integer + * @return int */ public function getSpaceBefore() { @@ -433,7 +432,7 @@ class Paragraph extends Border /** * Get space after paragraph * - * @return integer + * @return int */ public function getSpaceAfter() { @@ -487,22 +486,22 @@ class Paragraph extends Border * * @param int|float|string $lineHeight * - * @return self - * * @throws \PhpOffice\PhpWord\Exception\InvalidStyleException + * @return self */ public function setLineHeight($lineHeight) { if (is_string($lineHeight)) { - $lineHeight = floatval(preg_replace('/[^0-9\.\,]/', '', $lineHeight)); + $lineHeight = (float) (preg_replace('/[^0-9\.\,]/', '', $lineHeight)); } - if ((!is_integer($lineHeight) && !is_float($lineHeight)) || !$lineHeight) { + if ((!is_int($lineHeight) && !is_float($lineHeight)) || !$lineHeight) { throw new InvalidStyleException('Line height must be a valid number'); } $this->lineHeight = $lineHeight; $this->setSpacing($lineHeight * self::LINE_HEIGHT); + return $this; } @@ -739,10 +738,10 @@ class Paragraph extends Border return $this; } - + /** * Get contextualSpacing - * + * * @return bool */ public function hasContextualSpacing() @@ -752,14 +751,14 @@ class Paragraph extends Border /** * Set contextualSpacing - * + * * @param bool $contextualSpacing * @return self */ public function setContextualSpacing($contextualSpacing) { $this->contextualSpacing = $contextualSpacing; - + return $this; } } diff --git a/src/PhpWord/Style/Row.php b/src/PhpWord/Style/Row.php index 5be03b69..8a5db99f 100644 --- a/src/PhpWord/Style/Row.php +++ b/src/PhpWord/Style/Row.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index be8a3aad..d0945c88 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -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\Style; /** @@ -504,6 +503,7 @@ class Section extends Border public function setPageNumberingStart($pageNumberingStart = null) { $this->pageNumberingStart = $pageNumberingStart; + return $this; } @@ -572,6 +572,7 @@ class Section extends Border public function setBreakType($value = null) { $this->breakType = $value; + return $this; } diff --git a/src/PhpWord/Style/Shading.php b/src/PhpWord/Style/Shading.php index ab4fce82..125ba89c 100644 --- a/src/PhpWord/Style/Shading.php +++ b/src/PhpWord/Style/Shading.php @@ -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\Style; /** @@ -91,7 +90,7 @@ class Shading extends AbstractStyle { $enum = array( self::PATTERN_CLEAR, self::PATTERN_SOLID, self::PATTERN_HSTRIPE, - self::PATTERN_VSTRIPE, self::PATTERN_DSTRIPE, self::PATTERN_HCROSS, self::PATTERN_DCROSS + self::PATTERN_VSTRIPE, self::PATTERN_DSTRIPE, self::PATTERN_HCROSS, self::PATTERN_DCROSS, ); $this->pattern = $this->setEnumVal($value, $enum, $this->pattern); diff --git a/src/PhpWord/Style/Shadow.php b/src/PhpWord/Style/Shadow.php index f8f693a9..add319e7 100644 --- a/src/PhpWord/Style/Shadow.php +++ b/src/PhpWord/Style/Shadow.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Shape.php b/src/PhpWord/Style/Shape.php index 01b61588..cdc2f033 100644 --- a/src/PhpWord/Style/Shape.php +++ b/src/PhpWord/Style/Shape.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Spacing.php b/src/PhpWord/Style/Spacing.php index 8d7cfeb2..cb52d54b 100644 --- a/src/PhpWord/Style/Spacing.php +++ b/src/PhpWord/Style/Spacing.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/TOC.php b/src/PhpWord/Style/TOC.php index eb4b2253..786d1e48 100644 --- a/src/PhpWord/Style/TOC.php +++ b/src/PhpWord/Style/TOC.php @@ -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\Style; /** diff --git a/src/PhpWord/Style/Tab.php b/src/PhpWord/Style/Tab.php index 33e518c8..053436ea 100644 --- a/src/PhpWord/Style/Tab.php +++ b/src/PhpWord/Style/Tab.php @@ -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\Style; /** @@ -27,25 +26,25 @@ class Tab extends AbstractStyle * * @const string */ - const TAB_STOP_CLEAR = 'clear'; - const TAB_STOP_LEFT = 'left'; - const TAB_STOP_CENTER = 'center'; - const TAB_STOP_RIGHT = 'right'; + const TAB_STOP_CLEAR = 'clear'; + const TAB_STOP_LEFT = 'left'; + const TAB_STOP_CENTER = 'center'; + const TAB_STOP_RIGHT = 'right'; const TAB_STOP_DECIMAL = 'decimal'; - const TAB_STOP_BAR = 'bar'; - const TAB_STOP_NUM = 'num'; + const TAB_STOP_BAR = 'bar'; + const TAB_STOP_NUM = 'num'; /** * Tab leader types * * @const string */ - const TAB_LEADER_NONE = 'none'; - const TAB_LEADER_DOT = 'dot'; - const TAB_LEADER_HYPHEN = 'hyphen'; + const TAB_LEADER_NONE = 'none'; + const TAB_LEADER_DOT = 'dot'; + const TAB_LEADER_HYPHEN = 'hyphen'; const TAB_LEADER_UNDERSCORE = 'underscore'; - const TAB_LEADER_HEAVY = 'heavy'; - const TAB_LEADER_MIDDLEDOT = 'middleDot'; + const TAB_LEADER_HEAVY = 'heavy'; + const TAB_LEADER_MIDDLEDOT = 'middleDot'; /** * Tab stop type @@ -73,19 +72,19 @@ class Tab extends AbstractStyle * must conform to the values put forth in the schema. If they do not * they will be changed to default values. * - * @param string $type Defaults to 'clear' if value is not possible. - * @param int $position Must be numeric; otherwise defaults to 0. - * @param string $leader Defaults to null if value is not possible. + * @param string $type Defaults to 'clear' if value is not possible + * @param int $position Must be numeric; otherwise defaults to 0 + * @param string $leader Defaults to null if value is not possible */ public function __construct($type = null, $position = 0, $leader = null) { $stopTypes = array( - self::TAB_STOP_CLEAR, self::TAB_STOP_LEFT,self::TAB_STOP_CENTER, - self::TAB_STOP_RIGHT, self::TAB_STOP_DECIMAL, self::TAB_STOP_BAR, self::TAB_STOP_NUM + self::TAB_STOP_CLEAR, self::TAB_STOP_LEFT, self::TAB_STOP_CENTER, + self::TAB_STOP_RIGHT, self::TAB_STOP_DECIMAL, self::TAB_STOP_BAR, self::TAB_STOP_NUM, ); $leaderTypes = array( self::TAB_LEADER_NONE, self::TAB_LEADER_DOT, self::TAB_LEADER_HYPHEN, - self::TAB_LEADER_UNDERSCORE, self::TAB_LEADER_HEAVY, self::TAB_LEADER_MIDDLEDOT + self::TAB_LEADER_UNDERSCORE, self::TAB_LEADER_HEAVY, self::TAB_LEADER_MIDDLEDOT, ); $this->type = $this->setEnumVal($type, $stopTypes, $this->type); diff --git a/src/PhpWord/Style/Table.php b/src/PhpWord/Style/Table.php index a542af7b..3523122f 100644 --- a/src/PhpWord/Style/Table.php +++ b/src/PhpWord/Style/Table.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; @@ -133,15 +132,7 @@ class Table extends Border if ($firstRowStyle !== null && is_array($firstRowStyle)) { $this->firstRowStyle = clone $this; $this->firstRowStyle->isFirstRow = true; - unset($this->firstRowStyle->firstRowStyle); - unset($this->firstRowStyle->borderInsideHSize); - unset($this->firstRowStyle->borderInsideHColor); - unset($this->firstRowStyle->borderInsideVSize); - unset($this->firstRowStyle->borderInsideVColor); - unset($this->firstRowStyle->cellMarginTop); - unset($this->firstRowStyle->cellMarginLeft); - unset($this->firstRowStyle->cellMarginRight); - unset($this->firstRowStyle->cellMarginBottom); + unset($this->firstRowStyle->firstRowStyle, $this->firstRowStyle->borderInsideHSize, $this->firstRowStyle->borderInsideHColor, $this->firstRowStyle->borderInsideVSize, $this->firstRowStyle->borderInsideVColor, $this->firstRowStyle->cellMarginTop, $this->firstRowStyle->cellMarginLeft, $this->firstRowStyle->cellMarginRight, $this->firstRowStyle->cellMarginBottom); $this->firstRowStyle->setStyleByArray($firstRowStyle); } @@ -190,7 +181,7 @@ class Table extends Border /** * Get TLRBHV Border Size * - * @return integer[] + * @return int[] */ public function getBorderSize() { @@ -428,7 +419,7 @@ class Table extends Border /** * Get cell margin * - * @return integer[] + * @return int[] */ public function getCellMargin() { @@ -436,7 +427,7 @@ class Table extends Border $this->cellMarginTop, $this->cellMarginLeft, $this->cellMarginRight, - $this->cellMarginBottom + $this->cellMarginBottom, ); } diff --git a/src/PhpWord/Style/TextBox.php b/src/PhpWord/Style/TextBox.php index 600fb8ea..744d3979 100644 --- a/src/PhpWord/Style/TextBox.php +++ b/src/PhpWord/Style/TextBox.php @@ -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\Style; /** @@ -167,7 +166,7 @@ class TextBox extends Image /** * Get cell margin * - * @return integer[] + * @return int[] */ public function getInnerMargin() { diff --git a/src/PhpWord/Template.php b/src/PhpWord/Template.php index 87ccd8ed..3825a3bd 100644 --- a/src/PhpWord/Template.php +++ b/src/PhpWord/Template.php @@ -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; /** diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index e7a8d039..2b294950 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -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\Escaper\RegExp; @@ -37,35 +36,35 @@ class TemplateProcessor protected $zipClass; /** - * @var string Temporary document filename (with path). + * @var string Temporary document filename (with path) */ protected $tempDocumentFilename; /** - * Content of main document part (in XML format) of the temporary document. + * Content of main document part (in XML format) of the temporary document * * @var string */ protected $tempDocumentMainPart; /** - * Content of headers (in XML format) of the temporary document. + * Content of headers (in XML format) of the temporary document * * @var string[] */ protected $tempDocumentHeaders = array(); /** - * Content of footers (in XML format) of the temporary document. + * Content of footers (in XML format) of the temporary document * * @var string[] */ protected $tempDocumentFooters = array(); /** - * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception. + * @since 0.12.0 Throws CreateTemporaryFileException and CopyFileException instead of Exception * - * @param string $documentTemplate The fully qualified template filename. + * @param string $documentTemplate The fully qualified template filename * * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException * @throws \PhpOffice\PhpWord\Exception\CopyFileException @@ -107,9 +106,9 @@ class TemplateProcessor * @param string $xml * @param \XSLTProcessor $xsltProcessor * - * @return string - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return string */ protected function transformSingleXml($xml, $xsltProcessor) { @@ -147,7 +146,7 @@ class TemplateProcessor /** * Applies XSL style sheet to template's parts. - * + * * Note: since the method doesn't make any guess on logic of the provided XSL style sheet, * make sure that output is correctly escaped. Otherwise you may get broken document. * @@ -155,8 +154,6 @@ class TemplateProcessor * @param array $xslOptions * @param string $xslOptionsUri * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function applyXslStyleSheet($xslDomDocument, $xslOptions = array(), $xslOptionsUri = '') @@ -204,9 +201,7 @@ class TemplateProcessor /** * @param mixed $search * @param mixed $replace - * @param integer $limit - * - * @return void + * @param int $limit */ public function setValue($search, $replace, $limit = self::MAXIMUM_REPLACEMENTS_DEFAULT) { @@ -260,9 +255,7 @@ class TemplateProcessor * Clone a table row in a template document. * * @param string $search - * @param integer $numberOfClones - * - * @return void + * @param int $numberOfClones * * @throws \PhpOffice\PhpWord\Exception\Exception */ @@ -274,7 +267,7 @@ class TemplateProcessor $tagPos = strpos($this->tempDocumentMainPart, $search); if (!$tagPos) { - throw new Exception("Can not clone row, template variable not found or variable contains markup."); + throw new Exception('Can not clone row, template variable not found or variable contains markup.'); } $rowStart = $this->findRowStart($tagPos); @@ -319,8 +312,8 @@ class TemplateProcessor * Clone a block. * * @param string $blockname - * @param integer $clones - * @param boolean $replace + * @param int $clones + * @param bool $replace * * @return string|null */ @@ -357,8 +350,6 @@ class TemplateProcessor * * @param string $blockname * @param string $replacement - * - * @return void */ public function replaceBlock($blockname, $replacement) { @@ -381,8 +372,6 @@ class TemplateProcessor * Delete a block of text. * * @param string $blockname - * - * @return void */ public function deleteBlock($blockname) { @@ -392,9 +381,9 @@ class TemplateProcessor /** * Saves the result document. * - * @return string - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return string */ public function save() { @@ -422,8 +411,6 @@ class TemplateProcessor * @since 0.8.0 * * @param string $fileName - * - * @return void */ public function saveAs($fileName) { @@ -447,7 +434,7 @@ class TemplateProcessor * Finds parts of broken macros and sticks them together. * Macros, while being edited, could be implicitly broken by some of the word processors. * - * @param string $documentPart The document part in XML representation. + * @param string $documentPart The document part in XML representation * * @return string */ @@ -472,7 +459,7 @@ class TemplateProcessor * @param mixed $search * @param mixed $replace * @param string $documentPartXML - * @param integer $limit + * @param int $limit * * @return string */ @@ -481,10 +468,10 @@ class TemplateProcessor // Note: we can't use the same function for both cases here, because of performance considerations. if (self::MAXIMUM_REPLACEMENTS_DEFAULT === $limit) { return str_replace($search, $replace, $documentPartXML); - } else { - $regExpEscaper = new RegExp(); - return preg_replace($regExpEscaper->escape($search), $replace, $documentPartXML, $limit); } + $regExpEscaper = new RegExp(); + + return preg_replace($regExpEscaper->escape($search), $replace, $documentPartXML, $limit); } /** @@ -504,7 +491,7 @@ class TemplateProcessor /** * Get the name of the header file for $index. * - * @param integer $index + * @param int $index * * @return string */ @@ -524,7 +511,7 @@ class TemplateProcessor /** * Get the name of the footer file for $index. * - * @param integer $index + * @param int $index * * @return string */ @@ -536,11 +523,11 @@ class TemplateProcessor /** * Find the start position of the nearest table row before $offset. * - * @param integer $offset - * - * @return integer + * @param int $offset * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return int */ protected function findRowStart($offset) { @@ -559,9 +546,9 @@ class TemplateProcessor /** * Find the end position of the nearest table row after $offset. * - * @param integer $offset + * @param int $offset * - * @return integer + * @return int */ protected function findRowEnd($offset) { @@ -571,8 +558,8 @@ class TemplateProcessor /** * Get a slice of a string. * - * @param integer $startPosition - * @param integer $endPosition + * @param int $startPosition + * @param int $endPosition * * @return string */ diff --git a/src/PhpWord/Writer/AbstractWriter.php b/src/PhpWord/Writer/AbstractWriter.php index 78ec5acd..fc560d4d 100644 --- a/src/PhpWord/Writer/AbstractWriter.php +++ b/src/PhpWord/Writer/AbstractWriter.php @@ -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\Writer; use PhpOffice\PhpWord\Exception\CopyFileException; @@ -96,17 +95,15 @@ abstract class AbstractWriter implements WriterInterface /** * Get PhpWord object * - * @return \PhpOffice\PhpWord\PhpWord - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\PhpWord */ public function getPhpWord() { if (!is_null($this->phpWord)) { return $this->phpWord; - } else { - throw new Exception("No PhpWord assigned."); } + throw new Exception('No PhpWord assigned.'); } /** @@ -118,6 +115,7 @@ abstract class AbstractWriter implements WriterInterface public function setPhpWord(PhpWord $phpWord = null) { $this->phpWord = $phpWord; + return $this; } @@ -131,9 +129,9 @@ abstract class AbstractWriter implements WriterInterface { if ($partName != '' && isset($this->writerParts[strtolower($partName)])) { return $this->writerParts[strtolower($partName)]; - } else { - return null; } + + return null; } /** @@ -152,9 +150,8 @@ abstract class AbstractWriter implements WriterInterface * @param bool $value * @param string $directory * - * @return self - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return self */ public function setUseDiskCaching($value = false, $directory = null) { @@ -236,8 +233,6 @@ abstract class AbstractWriter implements WriterInterface /** * Cleanup temporary file. * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\CopyFileException */ protected function cleanupTempFile() @@ -257,8 +252,6 @@ abstract class AbstractWriter implements WriterInterface /** * Clear temporary directory. - * - * @return void */ protected function clearTempDir() { @@ -272,9 +265,9 @@ abstract class AbstractWriter implements WriterInterface * * @param string $filename * - * @return \PhpOffice\PhpWord\Shared\ZipArchive - * * @throws \Exception + * + * @return \PhpOffice\PhpWord\Shared\ZipArchive */ protected function getZipArchive($filename) { @@ -305,9 +298,9 @@ abstract class AbstractWriter implements WriterInterface * * @param string $filename * - * @return resource - * * @throws \Exception + * + * @return resource */ protected function openFile($filename) { @@ -330,7 +323,6 @@ abstract class AbstractWriter implements WriterInterface * * @param resource $fileHandle * @param string $content - * @return void */ protected function writeFile($fileHandle, $content) { @@ -344,7 +336,6 @@ abstract class AbstractWriter implements WriterInterface * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param mixed $elements - * @return void */ protected function addFilesToPackage(ZipArchive $zip, $elements) { @@ -380,7 +371,6 @@ abstract class AbstractWriter implements WriterInterface * @param \PhpOffice\PhpWord\Shared\ZipArchive $zipPackage * @param string $source * @param string $target - * @return void */ protected function addFileToPackage($zipPackage, $source, $target) { @@ -390,7 +380,7 @@ abstract class AbstractWriter implements WriterInterface $source = substr($source, 6); list($zipFilename, $imageFilename) = explode('#', $source); - $zip = new ZipArchive; + $zip = new ZipArchive(); if ($zip->open($zipFilename) !== false) { if ($zip->locateName($imageFilename)) { $zip->extractTo($this->getTempDir(), $imageFilename); @@ -411,17 +401,16 @@ abstract class AbstractWriter implements WriterInterface * Delete directory. * * @param string $dir - * @return void */ private function deleteDir($dir) { foreach (scandir($dir) as $file) { if ($file === '.' || $file === '..') { continue; - } elseif (is_file($dir . "/" . $file)) { - unlink($dir . "/" . $file); - } elseif (is_dir($dir . "/" . $file)) { - $this->deleteDir($dir . "/" . $file); + } elseif (is_file($dir . '/' . $file)) { + unlink($dir . '/' . $file); + } elseif (is_dir($dir . '/' . $file)) { + $this->deleteDir($dir . '/' . $file); } } diff --git a/src/PhpWord/Writer/HTML.php b/src/PhpWord/Writer/HTML.php index 5668f184..f20f4824 100644 --- a/src/PhpWord/Writer/HTML.php +++ b/src/PhpWord/Writer/HTML.php @@ -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\Writer; use PhpOffice\PhpWord\PhpWord; @@ -30,7 +29,7 @@ class HTML extends AbstractWriter implements WriterInterface /** * Is the current writer creating PDF? * - * @var boolean + * @var bool */ protected $isPdf = false; @@ -65,8 +64,6 @@ class HTML extends AbstractWriter implements WriterInterface * * @param string $filename * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function save($filename = null) @@ -119,7 +116,6 @@ class HTML extends AbstractWriter implements WriterInterface * * @param int $noteId * @param string $noteMark - * @return void */ public function addNote($noteId, $noteMark) { diff --git a/src/PhpWord/Writer/HTML/Element/AbstractElement.php b/src/PhpWord/Writer/HTML/Element/AbstractElement.php index 294d6de7..283c87b9 100644 --- a/src/PhpWord/Writer/HTML/Element/AbstractElement.php +++ b/src/PhpWord/Writer/HTML/Element/AbstractElement.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Element\AbstractElement as Element; diff --git a/src/PhpWord/Writer/HTML/Element/Container.php b/src/PhpWord/Writer/HTML/Element/Container.php index 88384a12..acd5bcb3 100644 --- a/src/PhpWord/Writer/HTML/Element/Container.php +++ b/src/PhpWord/Writer/HTML/Element/Container.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement; diff --git a/src/PhpWord/Writer/HTML/Element/Endnote.php b/src/PhpWord/Writer/HTML/Element/Endnote.php index b049e437..0b7f0f23 100644 --- a/src/PhpWord/Writer/HTML/Element/Endnote.php +++ b/src/PhpWord/Writer/HTML/Element/Endnote.php @@ -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\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Footnote.php b/src/PhpWord/Writer/HTML/Element/Footnote.php index b5aa0a0a..2da0bec3 100644 --- a/src/PhpWord/Writer/HTML/Element/Footnote.php +++ b/src/PhpWord/Writer/HTML/Element/Footnote.php @@ -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\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Image.php b/src/PhpWord/Writer/HTML/Element/Image.php index 24e35957..a0dbc6c7 100644 --- a/src/PhpWord/Writer/HTML/Element/Image.php +++ b/src/PhpWord/Writer/HTML/Element/Image.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Element\Image as ImageElement; diff --git a/src/PhpWord/Writer/HTML/Element/Link.php b/src/PhpWord/Writer/HTML/Element/Link.php index bff57cfc..302f0a20 100644 --- a/src/PhpWord/Writer/HTML/Element/Link.php +++ b/src/PhpWord/Writer/HTML/Element/Link.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Element/ListItem.php b/src/PhpWord/Writer/HTML/Element/ListItem.php index d8b1e4ed..bf5ec9ae 100644 --- a/src/PhpWord/Writer/HTML/Element/ListItem.php +++ b/src/PhpWord/Writer/HTML/Element/ListItem.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Element/PageBreak.php b/src/PhpWord/Writer/HTML/Element/PageBreak.php index 8b332dcf..6e955f85 100644 --- a/src/PhpWord/Writer/HTML/Element/PageBreak.php +++ b/src/PhpWord/Writer/HTML/Element/PageBreak.php @@ -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\Writer\HTML\Element; /** @@ -39,6 +38,6 @@ class PageBreak extends TextBreak return ''; } - return ""; + return ''; } } diff --git a/src/PhpWord/Writer/HTML/Element/Table.php b/src/PhpWord/Writer/HTML/Element/Table.php index 9025f01a..33d6a18d 100644 --- a/src/PhpWord/Writer/HTML/Element/Table.php +++ b/src/PhpWord/Writer/HTML/Element/Table.php @@ -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\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Text.php b/src/PhpWord/Writer/HTML/Element/Text.php index 87451595..e318d883 100644 --- a/src/PhpWord/Writer/HTML/Element/Text.php +++ b/src/PhpWord/Writer/HTML/Element/Text.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; @@ -89,7 +88,6 @@ class Text extends AbstractElement * Set opening text. * * @param string $value - * @return void */ public function setOpeningText($value) { @@ -100,7 +98,6 @@ class Text extends AbstractElement * Set closing text. * * @param string $value - * @return void */ public function setClosingText($value) { @@ -141,7 +138,7 @@ class Text extends AbstractElement $content .= $this->closingText; } - $content .= "

" . PHP_EOL; + $content .= '

' . PHP_EOL; } return $content; @@ -177,8 +174,6 @@ class Text extends AbstractElement /** * Get font style. - * - * @return void */ private function getFontStyle() { @@ -194,7 +189,7 @@ class Text extends AbstractElement if ($style) { $attribute = $fStyleIsObject ? 'style' : 'class'; $this->openingTags = ""; - $this->closingTags = ""; + $this->closingTags = ''; } } } diff --git a/src/PhpWord/Writer/HTML/Element/TextBreak.php b/src/PhpWord/Writer/HTML/Element/TextBreak.php index 9b23d739..ce8a5e1b 100644 --- a/src/PhpWord/Writer/HTML/Element/TextBreak.php +++ b/src/PhpWord/Writer/HTML/Element/TextBreak.php @@ -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\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/TextRun.php b/src/PhpWord/Writer/HTML/Element/TextRun.php index 492f7597..63d73cfe 100644 --- a/src/PhpWord/Writer/HTML/Element/TextRun.php +++ b/src/PhpWord/Writer/HTML/Element/TextRun.php @@ -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\Writer\HTML\Element; /** diff --git a/src/PhpWord/Writer/HTML/Element/Title.php b/src/PhpWord/Writer/HTML/Element/Title.php index 23c29938..9d8f7842 100644 --- a/src/PhpWord/Writer/HTML/Element/Title.php +++ b/src/PhpWord/Writer/HTML/Element/Title.php @@ -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\Writer\HTML\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/HTML/Part/AbstractPart.php b/src/PhpWord/Writer/HTML/Part/AbstractPart.php index 638f846b..2c2ea35e 100644 --- a/src/PhpWord/Writer/HTML/Part/AbstractPart.php +++ b/src/PhpWord/Writer/HTML/Part/AbstractPart.php @@ -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\Writer\HTML\Part; use PhpOffice\PhpWord\Exception\Exception; @@ -35,12 +34,12 @@ abstract class AbstractPart * @var \Zend\Escaper\Escaper */ protected $escaper; - + public function __construct() { $this->escaper = new Escaper(); } - + /** * @return string */ @@ -48,8 +47,6 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -57,16 +54,15 @@ abstract class AbstractPart } /** - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if ($this->parentWriter !== null) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } } diff --git a/src/PhpWord/Writer/HTML/Part/Body.php b/src/PhpWord/Writer/HTML/Part/Body.php index 0d852a57..c7ba00a9 100644 --- a/src/PhpWord/Writer/HTML/Part/Body.php +++ b/src/PhpWord/Writer/HTML/Part/Body.php @@ -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\Writer\HTML\Part; use PhpOffice\PhpWord\Writer\HTML\Element\Container; @@ -66,7 +65,7 @@ class Body extends AbstractPart $content = ''; if (!empty($notes)) { - $content .= "
" . PHP_EOL; + $content .= '
' . PHP_EOL; foreach ($notes as $noteId => $noteMark) { list($noteType, $noteTypeId) = explode('-', $noteMark); $method = 'get' . ($noteType == 'endnote' ? 'Endnotes' : 'Footnotes'); diff --git a/src/PhpWord/Writer/HTML/Part/Head.php b/src/PhpWord/Writer/HTML/Part/Head.php index fa4c3833..3bcbd5a5 100644 --- a/src/PhpWord/Writer/HTML/Part/Head.php +++ b/src/PhpWord/Writer/HTML/Part/Head.php @@ -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\Writer\HTML\Part; use PhpOffice\PhpWord\Settings; @@ -48,7 +47,7 @@ class Head extends AbstractPart 'keywords' => '', 'category' => '', 'company' => '', - 'manager' => '' + 'manager' => '', ); $title = $docProps->getTitle(); $title = ($title != '') ? $title : 'PHPWord'; @@ -60,11 +59,11 @@ class Head extends AbstractPart $content .= '' . $title . '' . PHP_EOL; foreach ($propertiesMapping as $key => $value) { $value = ($value == '') ? $key : $value; - $method = "get" . $key; + $method = 'get' . $key; if ($docProps->$method() != '') { $content .= '' . PHP_EOL; + . ' />' . PHP_EOL; } } $content .= $this->writeStyles(); @@ -86,22 +85,22 @@ class Head extends AbstractPart $defaultStyles = array( '*' => array( 'font-family' => Settings::getDefaultFontName(), - 'font-size' => Settings::getDefaultFontSize() . 'pt', + 'font-size' => Settings::getDefaultFontSize() . 'pt', ), 'a.NoteRef' => array( 'text-decoration' => 'none', ), 'hr' => array( - 'height' => '1px', - 'padding' => '0', - 'margin' => '1em 0', - 'border' => '0', + 'height' => '1px', + 'padding' => '0', + 'margin' => '1em 0', + 'border' => '0', 'border-top' => '1px solid #CCC', ), 'table' => array( - 'border' => '1px solid black', + 'border' => '1px solid black', 'border-spacing' => '0px', - 'width' => '100%', + 'width ' => '100%', ), 'td' => array( 'border' => '1px solid black', @@ -123,11 +122,11 @@ class Head extends AbstractPart } else { $name = '.' . $name; } - $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; + $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; } elseif ($style instanceof Paragraph) { $styleWriter = new ParagraphStyleWriter($style); $name = '.' . $name; - $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; + $css .= "{$name} {" . $styleWriter->write() . '}' . PHP_EOL; } } } diff --git a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php index 10a0a9ad..5fdb7cb3 100644 --- a/src/PhpWord/Writer/HTML/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/HTML/Style/AbstractStyle.php @@ -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\Writer\HTML\Style; use PhpOffice\PhpWord\Style\AbstractStyle as Style; diff --git a/src/PhpWord/Writer/HTML/Style/Font.php b/src/PhpWord/Writer/HTML/Style/Font.php index c202af93..2cb374bc 100644 --- a/src/PhpWord/Writer/HTML/Style/Font.php +++ b/src/PhpWord/Writer/HTML/Style/Font.php @@ -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\Writer\HTML\Style; use PhpOffice\PhpWord\Style\Font as FontStyle; diff --git a/src/PhpWord/Writer/HTML/Style/Generic.php b/src/PhpWord/Writer/HTML/Style/Generic.php index e3d2b352..80a5da53 100644 --- a/src/PhpWord/Writer/HTML/Style/Generic.php +++ b/src/PhpWord/Writer/HTML/Style/Generic.php @@ -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\Writer\HTML\Style; /** diff --git a/src/PhpWord/Writer/HTML/Style/Image.php b/src/PhpWord/Writer/HTML/Style/Image.php index 36a9feca..73580a55 100644 --- a/src/PhpWord/Writer/HTML/Style/Image.php +++ b/src/PhpWord/Writer/HTML/Style/Image.php @@ -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\Writer\HTML\Style; /** diff --git a/src/PhpWord/Writer/HTML/Style/Paragraph.php b/src/PhpWord/Writer/HTML/Style/Paragraph.php index 593c6dca..f0bcf224 100644 --- a/src/PhpWord/Writer/HTML/Style/Paragraph.php +++ b/src/PhpWord/Writer/HTML/Style/Paragraph.php @@ -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\Writer\HTML\Style; use PhpOffice\PhpWord\SimpleType\Jc; @@ -49,11 +48,9 @@ class Paragraph extends AbstractStyle case Jc::LEFT: $textAlign = 'left'; break; - case Jc::CENTER: $textAlign = 'center'; break; - case Jc::END: case Jc::MEDIUM_KASHIDA: case Jc::HIGH_KASHIDA: @@ -61,14 +58,12 @@ class Paragraph extends AbstractStyle case Jc::RIGHT: $textAlign = 'right'; break; - case Jc::BOTH: case Jc::DISTRIBUTE: case Jc::THAI_DISTRIBUTE: case Jc::JUSTIFY: $textAlign = 'justify'; break; - default: $textAlign = 'left'; break; diff --git a/src/PhpWord/Writer/ODText.php b/src/PhpWord/Writer/ODText.php index 40bc6c2f..ff6e567a 100644 --- a/src/PhpWord/Writer/ODText.php +++ b/src/PhpWord/Writer/ODText.php @@ -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\Writer; use PhpOffice\PhpWord\Media; diff --git a/src/PhpWord/Writer/ODText/Element/AbstractElement.php b/src/PhpWord/Writer/ODText/Element/AbstractElement.php index 0ca43e4f..7ec2254b 100644 --- a/src/PhpWord/Writer/ODText/Element/AbstractElement.php +++ b/src/PhpWord/Writer/ODText/Element/AbstractElement.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Writer\Word2007\Element\AbstractElement as Word2007AbstractElement; diff --git a/src/PhpWord/Writer/ODText/Element/Container.php b/src/PhpWord/Writer/ODText/Element/Container.php index 212cd184..7f0ad990 100644 --- a/src/PhpWord/Writer/ODText/Element/Container.php +++ b/src/PhpWord/Writer/ODText/Element/Container.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Writer\Word2007\Element\Container as Word2007Container; diff --git a/src/PhpWord/Writer/ODText/Element/Image.php b/src/PhpWord/Writer/ODText/Element/Image.php index c6b16cfc..0dccdf0f 100644 --- a/src/PhpWord/Writer/ODText/Element/Image.php +++ b/src/PhpWord/Writer/ODText/Element/Image.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Shared\Converter; diff --git a/src/PhpWord/Writer/ODText/Element/Link.php b/src/PhpWord/Writer/ODText/Element/Link.php index cb0226a3..c1f3df35 100644 --- a/src/PhpWord/Writer/ODText/Element/Link.php +++ b/src/PhpWord/Writer/ODText/Element/Link.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/ODText/Element/Table.php b/src/PhpWord/Writer/ODText/Element/Table.php index f6a2f845..86e41582 100644 --- a/src/PhpWord/Writer/ODText/Element/Table.php +++ b/src/PhpWord/Writer/ODText/Element/Table.php @@ -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\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/Text.php b/src/PhpWord/Writer/ODText/Element/Text.php index cff68481..bbd27e69 100644 --- a/src/PhpWord/Writer/ODText/Element/Text.php +++ b/src/PhpWord/Writer/ODText/Element/Text.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Exception\Exception; @@ -47,42 +46,42 @@ class Text extends AbstractElement if ($fStyleIsObject) { // Don't never be the case, because I browse all sections for cleaning all styles not declared throw new Exception('PhpWord : $fStyleIsObject wouldn\'t be an object'); - } else { - if (!$this->withoutP) { - $xmlWriter->startElement('text:p'); // text:p + } + + if (!$this->withoutP) { + $xmlWriter->startElement('text:p'); // text:p + } + if (empty($fontStyle)) { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'P1'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); } - if (empty($fontStyle)) { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'P1'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } + if (Settings::isOutputEscapingEnabled()) { + $xmlWriter->text($element->getText()); } else { - if (empty($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', 'Standard'); - } elseif (is_string($paragraphStyle)) { - $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); - } - // text:span - $xmlWriter->startElement('text:span'); - if (is_string($fontStyle)) { - $xmlWriter->writeAttribute('text:style-name', $fontStyle); - } - if (Settings::isOutputEscapingEnabled()) { - $xmlWriter->text($element->getText()); - } else { - $xmlWriter->writeRaw($element->getText()); - } - $xmlWriter->endElement(); + $xmlWriter->writeRaw($element->getText()); } - if (!$this->withoutP) { - $xmlWriter->endElement(); // text:p + } else { + if (empty($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', 'Standard'); + } elseif (is_string($paragraphStyle)) { + $xmlWriter->writeAttribute('text:style-name', $paragraphStyle); } + // text:span + $xmlWriter->startElement('text:span'); + if (is_string($fontStyle)) { + $xmlWriter->writeAttribute('text:style-name', $fontStyle); + } + if (Settings::isOutputEscapingEnabled()) { + $xmlWriter->text($element->getText()); + } else { + $xmlWriter->writeRaw($element->getText()); + } + $xmlWriter->endElement(); + } + if (!$this->withoutP) { + $xmlWriter->endElement(); // text:p } } } diff --git a/src/PhpWord/Writer/ODText/Element/TextBreak.php b/src/PhpWord/Writer/ODText/Element/TextBreak.php index b0f5009e..fc002ed5 100644 --- a/src/PhpWord/Writer/ODText/Element/TextBreak.php +++ b/src/PhpWord/Writer/ODText/Element/TextBreak.php @@ -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\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/TextRun.php b/src/PhpWord/Writer/ODText/Element/TextRun.php index 03717016..c2ade20a 100644 --- a/src/PhpWord/Writer/ODText/Element/TextRun.php +++ b/src/PhpWord/Writer/ODText/Element/TextRun.php @@ -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\Writer\ODText\Element; /** diff --git a/src/PhpWord/Writer/ODText/Element/Title.php b/src/PhpWord/Writer/ODText/Element/Title.php index b20ba944..20f5009c 100644 --- a/src/PhpWord/Writer/ODText/Element/Title.php +++ b/src/PhpWord/Writer/ODText/Element/Title.php @@ -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\Writer\ODText\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/ODText/Part/AbstractPart.php b/src/PhpWord/Writer/ODText/Part/AbstractPart.php index dc377e0f..e6782d51 100644 --- a/src/PhpWord/Writer/ODText/Part/AbstractPart.php +++ b/src/PhpWord/Writer/ODText/Part/AbstractPart.php @@ -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\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/ODText/Part/Content.php b/src/PhpWord/Writer/ODText/Part/Content.php index 61f8e7e2..cde079bf 100644 --- a/src/PhpWord/Writer/ODText/Part/Content.php +++ b/src/PhpWord/Writer/ODText/Part/Content.php @@ -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\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; @@ -121,7 +120,6 @@ class Content extends AbstractPart foreach ($this->autoStyles as $element => $styles) { $writerClass = 'PhpOffice\\PhpWord\\Writer\\ODText\\Style\\' . $element; foreach ($styles as $style) { - /** @var \PhpOffice\PhpWord\Writer\ODText\Style\AbstractStyle $styleWriter Type hint */ $styleWriter = new $writerClass($xmlWriter, $style); $styleWriter->write(); @@ -234,15 +232,14 @@ class Content extends AbstractPart $paragraphStyle = $element->getParagraphStyle(); $phpWord = $this->getParentWriter()->getPhpWord(); - // Font if ($fontStyle instanceof Font) { + // Font $fontStyleCount++; $style = $phpWord->addFontStyle("T{$fontStyleCount}", $fontStyle); $style->setAuto(); $element->setFontStyle("T{$fontStyleCount}"); - - // Paragraph } elseif ($paragraphStyle instanceof Paragraph) { + // Paragraph $paragraphStyleCount++; $style = $phpWord->addParagraphStyle("P{$paragraphStyleCount}", array()); $style->setAuto(); diff --git a/src/PhpWord/Writer/ODText/Part/Manifest.php b/src/PhpWord/Writer/ODText/Part/Manifest.php index 237c1a11..b0bc280c 100644 --- a/src/PhpWord/Writer/ODText/Part/Manifest.php +++ b/src/PhpWord/Writer/ODText/Part/Manifest.php @@ -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\Writer\ODText\Part; use PhpOffice\PhpWord\Media; diff --git a/src/PhpWord/Writer/ODText/Part/Meta.php b/src/PhpWord/Writer/ODText/Part/Meta.php index f16db161..67e26bbb 100644 --- a/src/PhpWord/Writer/ODText/Part/Meta.php +++ b/src/PhpWord/Writer/ODText/Part/Meta.php @@ -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\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/ODText/Part/Mimetype.php b/src/PhpWord/Writer/ODText/Part/Mimetype.php index 7cf78b4b..c29ea9a0 100644 --- a/src/PhpWord/Writer/ODText/Part/Mimetype.php +++ b/src/PhpWord/Writer/ODText/Part/Mimetype.php @@ -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\Writer\ODText\Part; /** diff --git a/src/PhpWord/Writer/ODText/Part/Styles.php b/src/PhpWord/Writer/ODText/Part/Styles.php index b50be0e8..f656c148 100644 --- a/src/PhpWord/Writer/ODText/Part/Styles.php +++ b/src/PhpWord/Writer/ODText/Part/Styles.php @@ -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\Writer\ODText\Part; use PhpOffice\Common\XMLWriter; @@ -64,7 +63,6 @@ class Styles extends AbstractPart * Write default styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeDefault(XMLWriter $xmlWriter) { @@ -109,7 +107,6 @@ class Styles extends AbstractPart * Write named styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeNamed(XMLWriter $xmlWriter) { @@ -127,11 +124,11 @@ class Styles extends AbstractPart } } } + /** * Write page layout styles. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writePageLayout(XMLWriter $xmlWriter) { @@ -139,7 +136,7 @@ class Styles extends AbstractPart $xmlWriter->writeAttribute('style:name', 'Mpm1'); $xmlWriter->startElement('style:page-layout-properties'); - $xmlWriter->writeAttribute('fo:page-width', "21.001cm"); + $xmlWriter->writeAttribute('fo:page-width', '21.001cm'); $xmlWriter->writeAttribute('fo:page-height', '29.7cm'); $xmlWriter->writeAttribute('style:num-format', '1'); $xmlWriter->writeAttribute('style:print-orientation', 'portrait'); @@ -170,7 +167,6 @@ class Styles extends AbstractPart $xmlWriter->endElement(); // style:page-layout-properties - $xmlWriter->startElement('style:header-style'); $xmlWriter->endElement(); // style:header-style @@ -184,7 +180,6 @@ class Styles extends AbstractPart * Write master style. * * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeMaster(XMLWriter $xmlWriter) { diff --git a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php index 7bc49cb3..072e1d37 100644 --- a/src/PhpWord/Writer/ODText/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/ODText/Style/AbstractStyle.php @@ -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\Writer\ODText\Style; use PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle as Word2007AbstractStyle; diff --git a/src/PhpWord/Writer/ODText/Style/Font.php b/src/PhpWord/Writer/ODText/Style/Font.php index 5d8e5753..e5ac2419 100644 --- a/src/PhpWord/Writer/ODText/Style/Font.php +++ b/src/PhpWord/Writer/ODText/Style/Font.php @@ -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\Writer\ODText\Style; /** diff --git a/src/PhpWord/Writer/ODText/Style/Image.php b/src/PhpWord/Writer/ODText/Style/Image.php index 447f449c..983bf06c 100644 --- a/src/PhpWord/Writer/ODText/Style/Image.php +++ b/src/PhpWord/Writer/ODText/Style/Image.php @@ -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\Writer\ODText\Style; /** diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 1d821810..9a452477 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -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\Writer\ODText\Style; /** diff --git a/src/PhpWord/Writer/ODText/Style/Section.php b/src/PhpWord/Writer/ODText/Style/Section.php index 79d57adb..ec5fcfb1 100644 --- a/src/PhpWord/Writer/ODText/Style/Section.php +++ b/src/PhpWord/Writer/ODText/Style/Section.php @@ -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\Writer\ODText\Style; /** @@ -26,8 +25,6 @@ class Section extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -40,7 +37,7 @@ class Section extends AbstractStyle $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName()); - $xmlWriter->writeAttribute('style:family', "section"); + $xmlWriter->writeAttribute('style:family', 'section'); $xmlWriter->startElement('style:section-properties'); $xmlWriter->startElement('style:columns'); diff --git a/src/PhpWord/Writer/ODText/Style/Table.php b/src/PhpWord/Writer/ODText/Style/Table.php index ff3cc423..2b387dc3 100644 --- a/src/PhpWord/Writer/ODText/Style/Table.php +++ b/src/PhpWord/Writer/ODText/Style/Table.php @@ -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\Writer\ODText\Style; /** diff --git a/src/PhpWord/Writer/PDF.php b/src/PhpWord/Writer/PDF.php index 5e5d9d71..ac3d4795 100644 --- a/src/PhpWord/Writer/PDF.php +++ b/src/PhpWord/Writer/PDF.php @@ -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\Writer; use PhpOffice\PhpWord\Exception\Exception; @@ -47,7 +46,7 @@ class PDF $pdfLibraryName = Settings::getPdfRendererName(); $pdfLibraryPath = Settings::getPdfRendererPath(); if (is_null($pdfLibraryName) || is_null($pdfLibraryPath)) { - throw new Exception("PDF rendering library or library path has not been defined."); + throw new Exception('PDF rendering library or library path has not been defined.'); } $includePath = str_replace('\\', '/', get_include_path()); diff --git a/src/PhpWord/Writer/PDF/AbstractRenderer.php b/src/PhpWord/Writer/PDF/AbstractRenderer.php index 1c6a8f0d..a486276c 100644 --- a/src/PhpWord/Writer/PDF/AbstractRenderer.php +++ b/src/PhpWord/Writer/PDF/AbstractRenderer.php @@ -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\Writer\PDF; use PhpOffice\PhpWord\Exception\Exception; @@ -143,6 +142,7 @@ abstract class AbstractRenderer extends HTML public function setPaperSize($value = 9) { $this->paperSize = $value; + return $this; } @@ -165,6 +165,7 @@ abstract class AbstractRenderer extends HTML public function setOrientation($value = 'default') { $this->orientation = $value; + return $this; } @@ -173,9 +174,8 @@ abstract class AbstractRenderer extends HTML * * @param string $filename Name of the file to save as * - * @return resource - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return resource */ protected function prepareForSave($filename = null) { @@ -196,8 +196,6 @@ abstract class AbstractRenderer extends HTML * * @param resource $fileHandle * - * @return void - * * @throws Exception */ protected function restoreStateAfterSave($fileHandle) diff --git a/src/PhpWord/Writer/PDF/DomPDF.php b/src/PhpWord/Writer/PDF/DomPDF.php index 4dc89612..4875d052 100644 --- a/src/PhpWord/Writer/PDF/DomPDF.php +++ b/src/PhpWord/Writer/PDF/DomPDF.php @@ -11,14 +11,13 @@ * 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\Writer\PDF; -use PhpOffice\PhpWord\Writer\WriterInterface; use Dompdf\Dompdf as DompdfLib; +use PhpOffice\PhpWord\Writer\WriterInterface; /** * DomPDF writer diff --git a/src/PhpWord/Writer/PDF/MPDF.php b/src/PhpWord/Writer/PDF/MPDF.php index 028ffac7..84ad47dc 100644 --- a/src/PhpWord/Writer/PDF/MPDF.php +++ b/src/PhpWord/Writer/PDF/MPDF.php @@ -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\Writer\PDF; use PhpOffice\PhpWord\Writer\WriterInterface; diff --git a/src/PhpWord/Writer/PDF/TCPDF.php b/src/PhpWord/Writer/PDF/TCPDF.php index e1e19006..01bb9898 100644 --- a/src/PhpWord/Writer/PDF/TCPDF.php +++ b/src/PhpWord/Writer/PDF/TCPDF.php @@ -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\Writer\PDF; use PhpOffice\PhpWord\Writer\WriterInterface; diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index 887b1c67..c95881f7 100644 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -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\Writer; use PhpOffice\PhpWord\PhpWord; @@ -58,9 +57,6 @@ class RTF extends AbstractWriter implements WriterInterface * Save content to file. * * @param string $filename - * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ public function save($filename = null) @@ -121,7 +117,6 @@ class RTF extends AbstractWriter implements WriterInterface * Set last paragraph style. * * @param mixed $value - * @return void */ public function setLastParagraphStyle($value = '') { diff --git a/src/PhpWord/Writer/RTF/Element/AbstractElement.php b/src/PhpWord/Writer/RTF/Element/AbstractElement.php index 289733dc..97585bdb 100644 --- a/src/PhpWord/Writer/RTF/Element/AbstractElement.php +++ b/src/PhpWord/Writer/RTF/Element/AbstractElement.php @@ -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\Writer\RTF\Element; use PhpOffice\Common\Text as CommonText; @@ -59,8 +58,6 @@ abstract class AbstractElement extends HTMLAbstractElement /** * Get font and paragraph styles. - * - * @return void */ protected function getStyles() { @@ -112,6 +109,7 @@ abstract class AbstractElement extends HTMLAbstractElement $styleWriter = new ParagraphStyleWriter($this->paragraphStyle); $styleWriter->setNestedLevel($this->element->getNestedLevel()); + return $styleWriter->write(); } @@ -125,9 +123,9 @@ abstract class AbstractElement extends HTMLAbstractElement { if (Settings::isOutputEscapingEnabled()) { return $this->escaper->escape($text); - } else { - return CommonText::toUnicode($text); // todo: replace with `return $text;` later. } + + return CommonText::toUnicode($text); // todo: replace with `return $text;` later. } /** diff --git a/src/PhpWord/Writer/RTF/Element/Container.php b/src/PhpWord/Writer/RTF/Element/Container.php index 7a1b0b07..a07c62fd 100644 --- a/src/PhpWord/Writer/RTF/Element/Container.php +++ b/src/PhpWord/Writer/RTF/Element/Container.php @@ -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\Writer\RTF\Element; use PhpOffice\PhpWord\Writer\HTML\Element\Container as HTMLContainer; diff --git a/src/PhpWord/Writer/RTF/Element/Image.php b/src/PhpWord/Writer/RTF/Element/Image.php index e950d30b..8251e9e6 100644 --- a/src/PhpWord/Writer/RTF/Element/Image.php +++ b/src/PhpWord/Writer/RTF/Element/Image.php @@ -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\Writer\RTF\Element; use PhpOffice\PhpWord\Element\Image as ImageElement; diff --git a/src/PhpWord/Writer/RTF/Element/Link.php b/src/PhpWord/Writer/RTF/Element/Link.php index f106d57d..120cf230 100644 --- a/src/PhpWord/Writer/RTF/Element/Link.php +++ b/src/PhpWord/Writer/RTF/Element/Link.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/ListItem.php b/src/PhpWord/Writer/RTF/Element/ListItem.php index b2ba612d..379d4660 100644 --- a/src/PhpWord/Writer/RTF/Element/ListItem.php +++ b/src/PhpWord/Writer/RTF/Element/ListItem.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/PageBreak.php b/src/PhpWord/Writer/RTF/Element/PageBreak.php index ac2bb8ec..903cb015 100644 --- a/src/PhpWord/Writer/RTF/Element/PageBreak.php +++ b/src/PhpWord/Writer/RTF/Element/PageBreak.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/Table.php b/src/PhpWord/Writer/RTF/Element/Table.php index c65d7248..7c552d41 100644 --- a/src/PhpWord/Writer/RTF/Element/Table.php +++ b/src/PhpWord/Writer/RTF/Element/Table.php @@ -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\Writer\RTF\Element; use PhpOffice\PhpWord\Element\Cell as CellElement; diff --git a/src/PhpWord/Writer/RTF/Element/Text.php b/src/PhpWord/Writer/RTF/Element/Text.php index b5a28adf..e6e5071d 100644 --- a/src/PhpWord/Writer/RTF/Element/Text.php +++ b/src/PhpWord/Writer/RTF/Element/Text.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/TextBreak.php b/src/PhpWord/Writer/RTF/Element/TextBreak.php index 0f76aea2..ae6836cb 100644 --- a/src/PhpWord/Writer/RTF/Element/TextBreak.php +++ b/src/PhpWord/Writer/RTF/Element/TextBreak.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/TextRun.php b/src/PhpWord/Writer/RTF/Element/TextRun.php index f63f338d..f7af2792 100644 --- a/src/PhpWord/Writer/RTF/Element/TextRun.php +++ b/src/PhpWord/Writer/RTF/Element/TextRun.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Element/Title.php b/src/PhpWord/Writer/RTF/Element/Title.php index 894f52cc..28b0ccbf 100644 --- a/src/PhpWord/Writer/RTF/Element/Title.php +++ b/src/PhpWord/Writer/RTF/Element/Title.php @@ -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\Writer\RTF\Element; /** diff --git a/src/PhpWord/Writer/RTF/Part/AbstractPart.php b/src/PhpWord/Writer/RTF/Part/AbstractPart.php index 152493db..688c9bf4 100644 --- a/src/PhpWord/Writer/RTF/Part/AbstractPart.php +++ b/src/PhpWord/Writer/RTF/Part/AbstractPart.php @@ -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\Writer\RTF\Part; use PhpOffice\PhpWord\Escaper\Rtf; @@ -48,8 +47,6 @@ abstract class AbstractPart /** * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -57,16 +54,14 @@ abstract class AbstractPart } /** - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if ($this->parentWriter !== null) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } } diff --git a/src/PhpWord/Writer/RTF/Part/Document.php b/src/PhpWord/Writer/RTF/Part/Document.php index 24ee7b0a..ac24bcd6 100644 --- a/src/PhpWord/Writer/RTF/Part/Document.php +++ b/src/PhpWord/Writer/RTF/Part/Document.php @@ -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\Writer\RTF\Part; use PhpOffice\PhpWord\Settings; @@ -54,9 +53,13 @@ class Document extends AbstractPart { $docProps = $this->getParentWriter()->getPhpWord()->getDocInfo(); $properties = array('title', 'subject', 'category', 'keywords', 'comment', - 'author', 'operator', 'creatim', 'revtim', 'company', 'manager'); - $mapping = array('comment' => 'description', 'author' => 'creator', 'operator' => 'lastModifiedBy', - 'creatim' => 'created', 'revtim' => 'modified'); + 'author', 'operator', 'creatim', 'revtim', 'company', 'manager', ); + $mapping = array( + 'comment' => 'description', + 'author' => 'creator', + 'operator' => 'lastModifiedBy', + 'creatim' => 'created', + 'revtim' => 'modified', ); $dateFields = array('creatim', 'revtim'); $content = ''; diff --git a/src/PhpWord/Writer/RTF/Part/Header.php b/src/PhpWord/Writer/RTF/Part/Header.php index 56a50349..18e674f1 100644 --- a/src/PhpWord/Writer/RTF/Part/Header.php +++ b/src/PhpWord/Writer/RTF/Part/Header.php @@ -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\Writer\RTF\Part; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php index 417be9cf..1eaf370a 100644 --- a/src/PhpWord/Writer/RTF/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/RTF/Style/AbstractStyle.php @@ -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\Writer\RTF\Style; use PhpOffice\PhpWord\Writer\HTML\Style\AbstractStyle as HTMLAbstractStyle; diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index 9f7ee2c0..f0a8fa5e 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -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\Writer\RTF\Style; /** @@ -103,8 +102,7 @@ class Border extends AbstractStyle /** * Set sizes. * - * @param integer[] $value - * @return void + * @param int[] $value */ public function setSizes($value) { @@ -115,7 +113,6 @@ class Border extends AbstractStyle * Set colors. * * @param string[] $value - * @return void */ public function setColors($value) { diff --git a/src/PhpWord/Writer/RTF/Style/Font.php b/src/PhpWord/Writer/RTF/Style/Font.php index 6567ec33..50a41747 100644 --- a/src/PhpWord/Writer/RTF/Style/Font.php +++ b/src/PhpWord/Writer/RTF/Style/Font.php @@ -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\Writer\RTF\Style; use PhpOffice\PhpWord\Style\Font as FontStyle; @@ -62,7 +61,7 @@ class Font extends AbstractStyle $content .= $this->getValueIf($style->isSuperScript(), '\super'); $content .= $this->getValueIf($style->isSubScript(), '\sub'); - return $content . ' '; + return $content . ' '; } /** @@ -70,7 +69,6 @@ class Font extends AbstractStyle * * * @param int $value - * @return void */ public function setNameIndex($value = 0) { @@ -81,7 +79,6 @@ class Font extends AbstractStyle * Set font color index. * * @param int $value - * @return void */ public function setColorIndex($value = 0) { diff --git a/src/PhpWord/Writer/RTF/Style/Paragraph.php b/src/PhpWord/Writer/RTF/Style/Paragraph.php index 046adc8c..73dbe962 100644 --- a/src/PhpWord/Writer/RTF/Style/Paragraph.php +++ b/src/PhpWord/Writer/RTF/Style/Paragraph.php @@ -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\Writer\RTF\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/src/PhpWord/Writer/RTF/Style/Section.php b/src/PhpWord/Writer/RTF/Style/Section.php index dcdc0aaf..ce3faa68 100644 --- a/src/PhpWord/Writer/RTF/Style/Section.php +++ b/src/PhpWord/Writer/RTF/Style/Section.php @@ -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\Writer\RTF\Style; use PhpOffice\PhpWord\Style\Section as SectionStyle; diff --git a/src/PhpWord/Writer/Word2007.php b/src/PhpWord/Writer/Word2007.php index bb7b521f..577ac76a 100644 --- a/src/PhpWord/Writer/Word2007.php +++ b/src/PhpWord/Writer/Word2007.php @@ -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\Writer; use PhpOffice\PhpWord\Element\Section; @@ -92,7 +91,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * Save document by name. * * @param string $filename - * @return void */ public function save($filename = null) { @@ -170,7 +168,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param string $docPart - * @return void */ private function addHeaderFooterMedia(ZipArchive $zip, $docPart) { @@ -197,16 +194,15 @@ class Word2007 extends AbstractWriter implements WriterInterface * @param \PhpOffice\PhpWord\Element\Section &$section * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip * @param string $elmType header|footer - * @param integer &$rId - * @return void + * @param int &$rId */ private function addHeaderFooterContent(Section &$section, ZipArchive $zip, $elmType, &$rId) { $getFunction = $elmType == 'header' ? 'getHeaders' : 'getFooters'; $elmCount = ($section->getSectionId() - 1) * 3; $elements = $section->$getFunction(); + /** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */ foreach ($elements as &$element) { - /** @var \PhpOffice\PhpWord\Element\AbstractElement $element Type hint */ $elmCount++; $element->setRelationId(++$rId); $elmFile = "{$elmType}{$elmCount}.xml"; // e.g. footer1.xml @@ -223,9 +219,8 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add footnotes/endnotes * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId + * @param int &$rId * @param string $noteType - * @return void */ private function addNotes(ZipArchive $zip, &$rId, $noteType = 'footnote') { @@ -261,14 +256,13 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add comments * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId - * @return void + * @param int &$rId */ private function addComments(ZipArchive $zip, &$rId) { $phpWord = $this->getPhpWord(); $collection = $phpWord->getComments(); - $partName = "comments"; + $partName = 'comments'; // Add comment relations and contents /** @var \PhpOffice\PhpWord\Collection\AbstractCollection $collection Type hint */ @@ -285,8 +279,7 @@ class Word2007 extends AbstractWriter implements WriterInterface * Add chart. * * @param \PhpOffice\PhpWord\Shared\ZipArchive $zip - * @param integer &$rId - * @return void + * @param int &$rId */ private function addChart(ZipArchive $zip, &$rId) { @@ -295,6 +288,7 @@ class Word2007 extends AbstractWriter implements WriterInterface $collection = $phpWord->getCharts(); $index = 0; if ($collection->countItems() > 0) { + /** @var \PhpOffice\PhpWord\Element\Chart $chart */ foreach ($collection->getItems() as $chart) { $index++; $rId++; @@ -307,7 +301,6 @@ class Word2007 extends AbstractWriter implements WriterInterface $this->relationships[] = array('target' => $filename, 'type' => 'chart', 'rID' => $rId); // word/charts/chartN.xml - /** @var \PhpOffice\PhpWord\Element\Chart $chart */ $chart->setRelationId($rId); $writerPart = $this->getWriterPart('Chart'); $writerPart->setElement($chart); @@ -320,7 +313,6 @@ class Word2007 extends AbstractWriter implements WriterInterface * Register content types for each media. * * @param array $media - * @return void */ private function registerContentTypes($media) { diff --git a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php index 79877b10..7cebd160 100644 --- a/src/PhpWord/Writer/Word2007/Element/AbstractElement.php +++ b/src/PhpWord/Writer/Word2007/Element/AbstractElement.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\Text as CommonText; @@ -92,7 +91,6 @@ abstract class AbstractElement * Start w:p DOM element. * * @uses \PhpOffice\PhpWord\Writer\Word2007\Element\PageBreak::write() - * @return void */ protected function startElementP() { @@ -108,8 +106,6 @@ abstract class AbstractElement /** * End w:p DOM element. - * - * @return void */ protected function endElementP() { @@ -121,8 +117,6 @@ abstract class AbstractElement /** * Writes the w:commentRangeStart DOM element - * - * @return void */ protected function writeCommentRangeStart() { @@ -134,14 +128,11 @@ abstract class AbstractElement } $this->xmlWriter->writeElementBlock('w:commentRangeStart', array('w:id' => $comment->getElementId())); - } } /** * Writes the w:commentRangeEnd DOM element - * - * @return void */ protected function writeCommentRangeEnd() { @@ -172,8 +163,6 @@ abstract class AbstractElement /** * Write ending. - * - * @return void */ protected function writeParagraphStyle() { @@ -182,20 +171,16 @@ abstract class AbstractElement /** * Write ending. - * - * @return void */ protected function writeFontStyle() { $this->writeTextStyle('Font'); } - /** * Write text style. * * @param string $styleType Font|Paragraph - * @return void */ private function writeTextStyle($styleType) { @@ -203,12 +188,12 @@ abstract class AbstractElement $class = "PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\{$styleType}"; $styleObject = $this->element->$method(); + /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $styleWriter Type Hint */ $styleWriter = new $class($this->xmlWriter, $styleObject); if (method_exists($styleWriter, 'setIsInline')) { $styleWriter->setIsInline(true); } - /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $styleWriter */ $styleWriter->write(); } diff --git a/src/PhpWord/Writer/Word2007/Element/Bookmark.php b/src/PhpWord/Writer/Word2007/Element/Bookmark.php index 424fb0ab..6deb1a24 100644 --- a/src/PhpWord/Writer/Word2007/Element/Bookmark.php +++ b/src/PhpWord/Writer/Word2007/Element/Bookmark.php @@ -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\Writer\Word2007\Element; /** @@ -41,7 +40,7 @@ class Bookmark extends AbstractElement $xmlWriter->writeAttribute('w:id', $rId); $xmlWriter->writeAttribute('w:name', $element->getName()); $xmlWriter->endElement(); - + $xmlWriter->startElement('w:bookmarkEnd'); $xmlWriter->writeAttribute('w:id', $rId); $xmlWriter->endElement(); diff --git a/src/PhpWord/Writer/Word2007/Element/Chart.php b/src/PhpWord/Writer/Word2007/Element/Chart.php index ecdde362..32bf576e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Chart.php +++ b/src/PhpWord/Writer/Word2007/Element/Chart.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Element\Chart as ChartElement; diff --git a/src/PhpWord/Writer/Word2007/Element/CheckBox.php b/src/PhpWord/Writer/Word2007/Element/CheckBox.php index 7424985c..aa0e6b41 100644 --- a/src/PhpWord/Writer/Word2007/Element/CheckBox.php +++ b/src/PhpWord/Writer/Word2007/Element/CheckBox.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; @@ -28,8 +27,6 @@ class CheckBox extends Text { /** * Write element. - * - * @return void */ public function write() { @@ -66,17 +63,17 @@ class CheckBox extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); $xmlWriter->text(' FORMCHECKBOX '); - $xmlWriter->endElement();// w:instrText + $xmlWriter->endElement(); // w:instrText $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'separate'); - $xmlWriter->endElement();// w:fldChar + $xmlWriter->endElement(); // w:fldChar $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); $xmlWriter->startElement('w:fldChar'); $xmlWriter->writeAttribute('w:fldCharType', 'end'); - $xmlWriter->endElement();// w:fldChar + $xmlWriter->endElement(); // w:fldChar $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); diff --git a/src/PhpWord/Writer/Word2007/Element/Container.php b/src/PhpWord/Writer/Word2007/Element/Container.php index 0efd0ebc..22701d02 100644 --- a/src/PhpWord/Writer/Word2007/Element/Container.php +++ b/src/PhpWord/Writer/Word2007/Element/Container.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Endnote.php b/src/PhpWord/Writer/Word2007/Element/Endnote.php index 9363489e..bdd53501 100644 --- a/src/PhpWord/Writer/Word2007/Element/Endnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Endnote.php @@ -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\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Field.php b/src/PhpWord/Writer/Word2007/Element/Field.php index 9fc45b21..34f62d54 100644 --- a/src/PhpWord/Writer/Word2007/Element/Field.php +++ b/src/PhpWord/Writer/Word2007/Element/Field.php @@ -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\Writer\Word2007\Element; /** @@ -26,13 +25,11 @@ class Field extends Text { /** * Write field element. - * - * @return void */ public function write() { $xmlWriter = $this->getXmlWriter(); - $element = $this->getElement(); + $element = $this->getElement(); if (!$element instanceof \PhpOffice\PhpWord\Element\Field) { return; } @@ -65,7 +62,6 @@ class Field extends Text if ($element->getText() != null) { if ($element->getText() instanceof \PhpOffice\PhpWord\Element\TextRun) { - $containerWriter = new Container($xmlWriter, $element->getText(), true); $containerWriter->write(); @@ -110,17 +106,17 @@ class Field extends Text private function buildPropertiesAndOptions(\PhpOffice\PhpWord\Element\Field $element) { $propertiesAndOptions = ''; - $properties = $element->getProperties(); + $properties = $element->getProperties(); foreach ($properties as $propkey => $propval) { switch ($propkey) { case 'format': - $propertiesAndOptions.= '\* ' . $propval . ' '; + $propertiesAndOptions .= '\* ' . $propval . ' '; break; case 'numformat': - $propertiesAndOptions.= '\# ' . $propval . ' '; + $propertiesAndOptions .= '\# ' . $propval . ' '; break; case 'dateformat': - $propertiesAndOptions.= '\@ "' . $propval . '" '; + $propertiesAndOptions .= '\@ "' . $propval . '" '; break; } } @@ -129,27 +125,28 @@ class Field extends Text foreach ($options as $option) { switch ($option) { case 'PreserveFormat': - $propertiesAndOptions.= '\* MERGEFORMAT '; + $propertiesAndOptions .= '\* MERGEFORMAT '; break; case 'LunarCalendar': - $propertiesAndOptions.= '\h '; + $propertiesAndOptions .= '\h '; break; case 'SakaEraCalendar': - $propertiesAndOptions.= '\s '; + $propertiesAndOptions .= '\s '; break; case 'LastUsedFormat': - $propertiesAndOptions.= '\l '; + $propertiesAndOptions .= '\l '; break; case 'Bold': - $propertiesAndOptions.= '\b '; + $propertiesAndOptions .= '\b '; break; case 'Italic': - $propertiesAndOptions.= '\i '; + $propertiesAndOptions .= '\i '; break; default: - $propertiesAndOptions.= $option .' '; + $propertiesAndOptions .= $option . ' '; } } + return $propertiesAndOptions; } } diff --git a/src/PhpWord/Writer/Word2007/Element/Footnote.php b/src/PhpWord/Writer/Word2007/Element/Footnote.php index 53fcd6a0..2564c46a 100644 --- a/src/PhpWord/Writer/Word2007/Element/Footnote.php +++ b/src/PhpWord/Writer/Word2007/Element/Footnote.php @@ -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\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/FormField.php b/src/PhpWord/Writer/Word2007/Element/FormField.php index 27df756f..bdc9ac7f 100644 --- a/src/PhpWord/Writer/Word2007/Element/FormField.php +++ b/src/PhpWord/Writer/Word2007/Element/FormField.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -37,8 +36,6 @@ class FormField extends Text /** * Write element. - * - * @return void */ public function write() { @@ -80,7 +77,7 @@ class FormField extends Text $xmlWriter->startElement('w:instrText'); $xmlWriter->writeAttribute('xml:space', 'preserve'); $xmlWriter->text("{$instruction}"); - $xmlWriter->endElement();// w:instrText + $xmlWriter->endElement(); // w:instrText $xmlWriter->endElement(); // w:r $xmlWriter->startElement('w:r'); @@ -114,7 +111,6 @@ class FormField extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeTextInput(XMLWriter $xmlWriter, FormFieldElement $element) { @@ -131,7 +127,6 @@ class FormField extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeCheckBox(XMLWriter $xmlWriter, FormFieldElement $element) { @@ -155,7 +150,6 @@ class FormField extends Text * @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\FormField $element - * @return void */ private function writeDropDown(XMLWriter $xmlWriter, FormFieldElement $element) { diff --git a/src/PhpWord/Writer/Word2007/Element/Image.php b/src/PhpWord/Writer/Word2007/Element/Image.php index edf32739..59e7125e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Image.php +++ b/src/PhpWord/Writer/Word2007/Element/Image.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Line.php b/src/PhpWord/Writer/Word2007/Element/Line.php index ebc5d395..384f53f7 100644 --- a/src/PhpWord/Writer/Word2007/Element/Line.php +++ b/src/PhpWord/Writer/Word2007/Element/Line.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Element\Line as LineElement; @@ -22,19 +21,16 @@ use PhpOffice\PhpWord\Writer\Word2007\Style\Line as LineStyleWriter; /** * Line element writer - * */ class Line extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { $xmlWriter = $this->getXmlWriter(); - $element = $this->getElement(); + $element = $this->getElement(); if (!$element instanceof LineElement) { return; } diff --git a/src/PhpWord/Writer/Word2007/Element/Link.php b/src/PhpWord/Writer/Word2007/Element/Link.php index 5f7ad278..d06e7643 100644 --- a/src/PhpWord/Writer/Word2007/Element/Link.php +++ b/src/PhpWord/Writer/Word2007/Element/Link.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/Word2007/Element/ListItem.php b/src/PhpWord/Writer/Word2007/Element/ListItem.php index 53644ffa..01ca2397 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItem.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItem.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php index 1ac17a98..986c3e9f 100644 --- a/src/PhpWord/Writer/Word2007/Element/ListItemRun.php +++ b/src/PhpWord/Writer/Word2007/Element/ListItemRun.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Object.php b/src/PhpWord/Writer/Word2007/Element/Object.php index fc0532cd..41fc70e3 100644 --- a/src/PhpWord/Writer/Word2007/Element/Object.php +++ b/src/PhpWord/Writer/Word2007/Element/Object.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\Image as ImageStyleWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/PageBreak.php b/src/PhpWord/Writer/Word2007/Element/PageBreak.php index 363a8c2c..96592441 100644 --- a/src/PhpWord/Writer/Word2007/Element/PageBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/PageBreak.php @@ -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\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php index 2c775d14..6aba9de6 100644 --- a/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/ParagraphAlignment.php @@ -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\Writer\Word2007\Element; /** @@ -29,7 +28,7 @@ class ParagraphAlignment /** * @since 0.13.0 * - * @param string $value Any value provided by Jc simple type. + * @param string $value Any value provided by Jc simple type * * @see \PhpOffice\PhpWord\SimpleType\Jc For the allowed values of $value parameter. */ diff --git a/src/PhpWord/Writer/Word2007/Element/PreserveText.php b/src/PhpWord/Writer/Word2007/Element/PreserveText.php index 82c6f87b..2afabbdb 100644 --- a/src/PhpWord/Writer/Word2007/Element/PreserveText.php +++ b/src/PhpWord/Writer/Word2007/Element/PreserveText.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/Word2007/Element/SDT.php b/src/PhpWord/Writer/Word2007/Element/SDT.php index 313bf7e0..ea2a1328 100644 --- a/src/PhpWord/Writer/Word2007/Element/SDT.php +++ b/src/PhpWord/Writer/Word2007/Element/SDT.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Shape.php b/src/PhpWord/Writer/Word2007/Element/Shape.php index a589af6c..0307a2e3 100644 --- a/src/PhpWord/Writer/Word2007/Element/Shape.php +++ b/src/PhpWord/Writer/Word2007/Element/Shape.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/TOC.php b/src/PhpWord/Writer/Word2007/Element/TOC.php index 996edb64..93ba8a6c 100644 --- a/src/PhpWord/Writer/Word2007/Element/TOC.php +++ b/src/PhpWord/Writer/Word2007/Element/TOC.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/Table.php b/src/PhpWord/Writer/Word2007/Element/Table.php index 093666ee..5ebca13b 100644 --- a/src/PhpWord/Writer/Word2007/Element/Table.php +++ b/src/PhpWord/Writer/Word2007/Element/Table.php @@ -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\Writer\Word2007\Element; use PhpOffice\Common\XMLWriter; @@ -36,8 +35,6 @@ class Table extends AbstractElement { /** * Write element. - * - * @return void */ public function write() { @@ -75,7 +72,6 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Table $element - * @return void */ private function writeColumns(XMLWriter $xmlWriter, TableElement $element) { @@ -112,7 +108,6 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Row $row - * @return void */ private function writeRow(XMLWriter $xmlWriter, RowElement $row) { @@ -139,11 +134,9 @@ class Table extends AbstractElement * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Element\Cell $cell - * @return void */ private function writeCell(XMLWriter $xmlWriter, CellElement $cell) { - $xmlWriter->startElement('w:tc'); // Write style diff --git a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php index 45459a38..fccc3f53 100644 --- a/src/PhpWord/Writer/Word2007/Element/TableAlignment.php +++ b/src/PhpWord/Writer/Word2007/Element/TableAlignment.php @@ -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\Writer\Word2007\Element; /** @@ -29,7 +28,7 @@ class TableAlignment /** * @since 0.13.0 * - * @param string $value Any value provided by JcTable simple type. + * @param string $value Any value provided by JcTable simple type * * @see \PhpOffice\PhpWord\SimpleType\JcTable For the allowed values of $value parameter. */ diff --git a/src/PhpWord/Writer/Word2007/Element/Text.php b/src/PhpWord/Writer/Word2007/Element/Text.php index 2df4892b..a24dc2e0 100644 --- a/src/PhpWord/Writer/Word2007/Element/Text.php +++ b/src/PhpWord/Writer/Word2007/Element/Text.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/Word2007/Element/TextBox.php b/src/PhpWord/Writer/Word2007/Element/TextBox.php index e83fe0c9..4e2a79e8 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBox.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Writer\Word2007\Style\TextBox as TextBoxStyleWriter; diff --git a/src/PhpWord/Writer/Word2007/Element/TextBreak.php b/src/PhpWord/Writer/Word2007/Element/TextBreak.php index a9e6f613..221e1b95 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextBreak.php +++ b/src/PhpWord/Writer/Word2007/Element/TextBreak.php @@ -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\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/TextRun.php b/src/PhpWord/Writer/Word2007/Element/TextRun.php index 1e95ab5c..1a684089 100644 --- a/src/PhpWord/Writer/Word2007/Element/TextRun.php +++ b/src/PhpWord/Writer/Word2007/Element/TextRun.php @@ -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\Writer\Word2007\Element; /** diff --git a/src/PhpWord/Writer/Word2007/Element/Title.php b/src/PhpWord/Writer/Word2007/Element/Title.php index 925d4c43..7c6e496e 100644 --- a/src/PhpWord/Writer/Word2007/Element/Title.php +++ b/src/PhpWord/Writer/Word2007/Element/Title.php @@ -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\Writer\Word2007\Element; use PhpOffice\PhpWord\Settings; diff --git a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php index 26734aa0..4a617b42 100644 --- a/src/PhpWord/Writer/Word2007/Part/AbstractPart.php +++ b/src/PhpWord/Writer/Word2007/Part/AbstractPart.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -50,7 +49,6 @@ abstract class AbstractPart * Set parent writer. * * @param \PhpOffice\PhpWord\Writer\AbstractWriter $writer - * @return void */ public function setParentWriter(AbstractWriter $writer = null) { @@ -60,17 +58,15 @@ abstract class AbstractPart /** * Get parent writer * - * @return \PhpOffice\PhpWord\Writer\AbstractWriter - * * @throws \PhpOffice\PhpWord\Exception\Exception + * @return \PhpOffice\PhpWord\Writer\AbstractWriter */ public function getParentWriter() { if (!is_null($this->parentWriter)) { return $this->parentWriter; - } else { - throw new Exception('No parent WriterInterface assigned.'); } + throw new Exception('No parent WriterInterface assigned.'); } /** @@ -88,8 +84,8 @@ abstract class AbstractPart } if ($useDiskCaching) { return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory(), Settings::hasCompatibility()); - } else { - return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility()); } + + return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility()); } } diff --git a/src/PhpWord/Writer/Word2007/Part/Chart.php b/src/PhpWord/Writer/Word2007/Part/Chart.php index 3dd3968b..417d7001 100644 --- a/src/PhpWord/Writer/Word2007/Part/Chart.php +++ b/src/PhpWord/Writer/Word2007/Part/Chart.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -31,7 +30,7 @@ class Chart extends AbstractPart /** * Chart element * - * @var \PhpOffice\PhpWord\Element\Chart $element + * @var \PhpOffice\PhpWord\Element\Chart */ private $element; @@ -62,7 +61,6 @@ class Chart extends AbstractPart * Set chart element. * * @param \PhpOffice\PhpWord\Element\Chart $element - * @return void */ public function setElement(ChartElement $element) { @@ -97,7 +95,6 @@ class Chart extends AbstractPart * * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writeChart(XMLWriter $xmlWriter) { @@ -122,7 +119,6 @@ class Chart extends AbstractPart * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html * @param \PhpOffice\Common\XMLWriter $xmlWriter - * @return void */ private function writePlotArea(XMLWriter $xmlWriter) { @@ -135,7 +131,7 @@ class Chart extends AbstractPart // Chart $chartType = $this->options['type']; - $chartType .= $style->is3d() && !isset($this->options['no3d'])? '3D' : ''; + $chartType .= $style->is3d() && !isset($this->options['no3d']) ? '3D' : ''; $chartType .= 'Chart'; $xmlWriter->startElement("c:{$chartType}"); @@ -182,7 +178,6 @@ class Chart extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param bool $scatter - * @return void */ private function writeSeries(XMLWriter $xmlWriter, $scatter = false) { @@ -213,7 +208,6 @@ class Chart extends AbstractPart $xmlWriter->endElement(); // c:ser $index++; } - } /** @@ -222,13 +216,12 @@ class Chart extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $type * @param array $values - * @return void */ private function writeSeriesItem(XMLWriter $xmlWriter, $type, $values) { $types = array( - 'cat' => array('c:cat', 'c:strLit'), - 'val' => array('c:val', 'c:numLit'), + 'cat' => array('c:cat', 'c:strLit'), + 'val' => array('c:val', 'c:numLit'), 'xVal' => array('c:xVal', 'c:strLit'), 'yVal' => array('c:yVal', 'c:numLit'), ); @@ -262,7 +255,6 @@ class Chart extends AbstractPart * @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $type - * @return void */ private function writeAxis(XMLWriter $xmlWriter, $type) { @@ -305,7 +297,6 @@ class Chart extends AbstractPart * @link http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param bool $line - * @return void */ private function writeShape(XMLWriter $xmlWriter, $line = false) { diff --git a/src/PhpWord/Writer/Word2007/Part/Comments.php b/src/PhpWord/Writer/Word2007/Part/Comments.php index 73314785..58b874af 100644 --- a/src/PhpWord/Writer/Word2007/Part/Comments.php +++ b/src/PhpWord/Writer/Word2007/Part/Comments.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php index 7a03243e..174a793d 100644 --- a/src/PhpWord/Writer/Word2007/Part/ContentTypes.php +++ b/src/PhpWord/Writer/Word2007/Part/ContentTypes.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -36,20 +35,20 @@ class ContentTypes extends AbstractPart $contentTypes = $parentWriter->getContentTypes(); $openXMLPrefix = 'application/vnd.openxmlformats-'; - $wordMLPrefix = $openXMLPrefix . 'officedocument.wordprocessingml.'; - $drawingMLPrefix = $openXMLPrefix . 'officedocument.drawingml.'; + $wordMLPrefix = $openXMLPrefix . 'officedocument.wordprocessingml.'; + $drawingMLPrefix = $openXMLPrefix . 'officedocument.drawingml.'; $overrides = array( '/docProps/core.xml' => $openXMLPrefix . 'package.core-properties+xml', '/docProps/app.xml' => $openXMLPrefix . 'officedocument.extended-properties+xml', '/docProps/custom.xml' => $openXMLPrefix . 'officedocument.custom-properties+xml', - '/word/document.xml' => $wordMLPrefix . 'document.main+xml', - '/word/styles.xml' => $wordMLPrefix . 'styles+xml', - '/word/numbering.xml' => $wordMLPrefix . 'numbering+xml', - '/word/settings.xml' => $wordMLPrefix . 'settings+xml', + '/word/document.xml' => $wordMLPrefix . 'document.main+xml', + '/word/styles.xml' => $wordMLPrefix . 'styles+xml', + '/word/numbering.xml' => $wordMLPrefix . 'numbering+xml', + '/word/settings.xml' => $wordMLPrefix . 'settings+xml', '/word/theme/theme1.xml' => $openXMLPrefix . 'officedocument.theme+xml', - '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', - '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', - '/word/comments.xml' => $wordMLPrefix . 'comments+xml', + '/word/webSettings.xml' => $wordMLPrefix . 'webSettings+xml', + '/word/fontTable.xml' => $wordMLPrefix . 'fontTable+xml', + '/word/comments.xml' => $wordMLPrefix . 'comments+xml', ); $defaults = $contentTypes['default']; @@ -82,8 +81,7 @@ class ContentTypes extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter XML Writer * @param array $parts - * @param boolean $isDefault - * @return void + * @param bool $isDefault */ private function writeContentType(XMLWriter $xmlWriter, $parts, $isDefault) { diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php index adfe752f..29c8d961 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsApp.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php index afb6f286..1c5440b2 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCore.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php index 63ed8ede..e1f331da 100644 --- a/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php +++ b/src/PhpWord/Writer/Word2007/Part/DocPropsCustom.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Document.php b/src/PhpWord/Writer/Word2007/Part/Document.php index 11e3f510..29268faa 100644 --- a/src/PhpWord/Writer/Word2007/Part/Document.php +++ b/src/PhpWord/Writer/Word2007/Part/Document.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -56,7 +55,6 @@ class Document extends AbstractPart $xmlWriter->startElement('w:body'); - if ($sectionCount > 0) { foreach ($sections as $section) { $currentSection++; diff --git a/src/PhpWord/Writer/Word2007/Part/Endnotes.php b/src/PhpWord/Writer/Word2007/Part/Endnotes.php index bc15cf1e..898d8c31 100644 --- a/src/PhpWord/Writer/Word2007/Part/Endnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Endnotes.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/FontTable.php b/src/PhpWord/Writer/Word2007/Part/FontTable.php index 08f0ad0e..fde8db8e 100644 --- a/src/PhpWord/Writer/Word2007/Part/FontTable.php +++ b/src/PhpWord/Writer/Word2007/Part/FontTable.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Footer.php b/src/PhpWord/Writer/Word2007/Part/Footer.php index 3e4e4fee..c405f653 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footer.php +++ b/src/PhpWord/Writer/Word2007/Part/Footer.php @@ -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\Writer\Word2007\Part; use PhpOffice\PhpWord\Writer\Word2007\Element\Container; diff --git a/src/PhpWord/Writer/Word2007/Part/Footnotes.php b/src/PhpWord/Writer/Word2007/Part/Footnotes.php index fd692149..c854e7f3 100644 --- a/src/PhpWord/Writer/Word2007/Part/Footnotes.php +++ b/src/PhpWord/Writer/Word2007/Part/Footnotes.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/Header.php b/src/PhpWord/Writer/Word2007/Part/Header.php index 438e503e..01e7c60b 100644 --- a/src/PhpWord/Writer/Word2007/Part/Header.php +++ b/src/PhpWord/Writer/Word2007/Part/Header.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Numbering.php b/src/PhpWord/Writer/Word2007/Part/Numbering.php index c5c9b4c7..f6553d30 100644 --- a/src/PhpWord/Writer/Word2007/Part/Numbering.php +++ b/src/PhpWord/Writer/Word2007/Part/Numbering.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Part/Rels.php b/src/PhpWord/Writer/Word2007/Part/Rels.php index 4a3b5b67..b12933db 100644 --- a/src/PhpWord/Writer/Word2007/Part/Rels.php +++ b/src/PhpWord/Writer/Word2007/Part/Rels.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -53,7 +52,6 @@ class Rels extends AbstractPart * @param array $xmlRels * @param array $mediaRels * @param int $relId - * @return void */ protected function writeRels(XMLWriter $xmlWriter, $xmlRels = array(), $mediaRels = array(), $relId = 1) { @@ -80,7 +78,6 @@ class Rels extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param int $relId * @param array $mediaRel - * @return void */ private function writeMediaRel(XMLWriter $xmlWriter, $relId, $mediaRel) { @@ -109,8 +106,6 @@ class Rels extends AbstractPart * @param string $target Relationship target * @param string $targetMode Relationship target mode * - * @return void - * * @throws \PhpOffice\PhpWord\Exception\Exception */ private function writeRel(XMLWriter $xmlWriter, $relId, $type, $target, $targetMode = '') @@ -128,7 +123,7 @@ class Rels extends AbstractPart } $xmlWriter->endElement(); } else { - throw new Exception("Invalid parameters passed."); + throw new Exception('Invalid parameters passed.'); } } } diff --git a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php index c60dba28..3f750168 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsDocument.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsDocument.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/RelsPart.php b/src/PhpWord/Writer/Word2007/Part/RelsPart.php index e8939c7f..ecf1805a 100644 --- a/src/PhpWord/Writer/Word2007/Part/RelsPart.php +++ b/src/PhpWord/Writer/Word2007/Part/RelsPart.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Part/Settings.php b/src/PhpWord/Writer/Word2007/Part/Settings.php index 529d47af..3160de11 100644 --- a/src/PhpWord/Writer/Word2007/Part/Settings.php +++ b/src/PhpWord/Writer/Word2007/Part/Settings.php @@ -11,13 +11,11 @@ * 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\Writer\Word2007\Part; -use PhpOffice\PhpWord\Settings as DocumentSettings; use PhpOffice\PhpWord\ComplexType\ProofState; use PhpOffice\PhpWord\ComplexType\TrackChangesView; @@ -71,7 +69,6 @@ class Settings extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $settingKey * @param array|string $settingValue - * @return void */ protected function writeSetting($xmlWriter, $settingKey, $settingValue) { @@ -96,50 +93,47 @@ class Settings extends AbstractPart /** * Get settings. - * - * @return void */ private function getSettings() { - /** @var \PhpOffice\PhpWord\Metadata\Settings $documentSettings */ $documentSettings = $this->getParentWriter()->getPhpWord()->getSettings(); // Default settings $this->settings = array( - 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), - 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), + 'w:defaultTabStop' => array('@attributes' => array('w:val' => '708')), + 'w:hyphenationZone' => array('@attributes' => array('w:val' => '425')), 'w:characterSpacingControl' => array('@attributes' => array('w:val' => 'doNotCompress')), - 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), - 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), - 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), - 'w:compat' => array(), - 'm:mathPr' => array( - 'm:mathFont' => array('@attributes' => array('m:val' => 'Cambria Math')), - 'm:brkBin' => array('@attributes' => array('m:val' => 'before')), - 'm:brkBinSub' => array('@attributes' => array('m:val' => '--')), - 'm:smallFrac' => array('@attributes' => array('m:val' => 'off')), - 'm:dispDef' => '', - 'm:lMargin' => array('@attributes' => array('m:val' => '0')), - 'm:rMargin' => array('@attributes' => array('m:val' => '0')), - 'm:defJc' => array('@attributes' => array('m:val' => 'centerGroup')), + 'w:themeFontLang' => array('@attributes' => array('w:val' => 'en-US')), + 'w:decimalSymbol' => array('@attributes' => array('w:val' => $documentSettings->getDecimalSymbol())), + 'w:listSeparator' => array('@attributes' => array('w:val' => ';')), + 'w:compat' => array(), + 'm:mathPr' => array( + 'm:mathFont' => array('@attributes' => array('m:val' => 'Cambria Math')), + 'm:brkBin' => array('@attributes' => array('m:val' => 'before')), + 'm:brkBinSub' => array('@attributes' => array('m:val' => '--')), + 'm:smallFrac' => array('@attributes' => array('m:val' => 'off')), + 'm:dispDef' => '', + 'm:lMargin' => array('@attributes' => array('m:val' => '0')), + 'm:rMargin' => array('@attributes' => array('m:val' => '0')), + 'm:defJc' => array('@attributes' => array('m:val' => 'centerGroup')), 'm:wrapIndent' => array('@attributes' => array('m:val' => '1440')), - 'm:intLim' => array('@attributes' => array('m:val' => 'subSup')), - 'm:naryLim' => array('@attributes' => array('m:val' => 'undOvr')), + 'm:intLim' => array('@attributes' => array('m:val' => 'subSup')), + 'm:naryLim' => array('@attributes' => array('m:val' => 'undOvr')), ), 'w:clrSchemeMapping' => array( '@attributes' => array( - 'w:bg1' => 'light1', - 'w:t1' => 'dark1', - 'w:bg2' => 'light2', - 'w:t2' => 'dark2', - 'w:accent1' => 'accent1', - 'w:accent2' => 'accent2', - 'w:accent3' => 'accent3', - 'w:accent4' => 'accent4', - 'w:accent5' => 'accent5', - 'w:accent6' => 'accent6', - 'w:hyperlink' => 'hyperlink', + 'w:bg1' => 'light1', + 'w:t1' => 'dark1', + 'w:bg2' => 'light2', + 'w:t2' => 'dark2', + 'w:accent1' => 'accent1', + 'w:accent2' => 'accent2', + 'w:accent3' => 'accent3', + 'w:accent4' => 'accent4', + 'w:accent5' => 'accent5', + 'w:accent6' => 'accent6', + 'w:hyperlink' => 'hyperlink', 'w:followedHyperlink' => 'followedHyperlink', ), ), @@ -161,9 +155,9 @@ class Settings extends AbstractPart /** * Adds a boolean attribute to the settings array - * + * * @param string $settingName - * @param boolean $booleanValue + * @param bool $booleanValue */ private function setOnOffValue($settingName, $booleanValue) { @@ -180,7 +174,6 @@ class Settings extends AbstractPart * Get protection settings. * * @param \PhpOffice\PhpWord\Metadata\Settings $documentProtection - * @return void */ private function setDocumentProtection($documentProtection) { @@ -188,8 +181,8 @@ class Settings extends AbstractPart $this->settings['w:documentProtection'] = array( '@attributes' => array( 'w:enforcement' => 1, - 'w:edit' => $documentProtection->getEditing(), - ) + 'w:edit' => $documentProtection->getEditing(), + ), ); } } @@ -205,8 +198,8 @@ class Settings extends AbstractPart $this->settings['w:proofState'] = array( '@attributes' => array( 'w:spelling' => $proofState->getSpelling(), - 'w:grammar' => $proofState->getGrammar() - ) + 'w:grammar' => $proofState->getGrammar(), + ), ); } } @@ -219,12 +212,11 @@ class Settings extends AbstractPart private function setRevisionView(TrackChangesView $trackChangesView = null) { if ($trackChangesView != null) { - - $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true': 'false'; - $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true': 'false'; - $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true': 'false'; - $revisionView['w:formatting'] = $trackChangesView->hasFormatting() ? 'true': 'false'; - $revisionView['w:inkAnnotations'] = $trackChangesView->hasInkAnnotations() ? 'true': 'false'; + $revisionView['w:markup'] = $trackChangesView->hasMarkup() ? 'true' : 'false'; + $revisionView['w:comments'] = $trackChangesView->hasComments() ? 'true' : 'false'; + $revisionView['w:insDel'] = $trackChangesView->hasInsDel() ? 'true' : 'false'; + $revisionView['w:formatting'] = $trackChangesView->hasFormatting() ? 'true' : 'false'; + $revisionView['w:inkAnnotations'] = $trackChangesView->hasInkAnnotations() ? 'true' : 'false'; $this->settings['w:revisionView'] = array('@attributes' => $revisionView); } @@ -232,7 +224,7 @@ class Settings extends AbstractPart /** * Set the magnification - * + * * @param mixed $zoom */ private function setZoom($zoom = null) @@ -245,8 +237,6 @@ class Settings extends AbstractPart /** * Get compatibility setting. - * - * @return void */ private function getCompatibility() { diff --git a/src/PhpWord/Writer/Word2007/Part/Styles.php b/src/PhpWord/Writer/Word2007/Part/Styles.php index 01b84c08..cc06ef02 100644 --- a/src/PhpWord/Writer/Word2007/Part/Styles.php +++ b/src/PhpWord/Writer/Word2007/Part/Styles.php @@ -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\Writer\Word2007\Part; use PhpOffice\Common\XMLWriter; @@ -79,7 +78,6 @@ class Styles extends AbstractPart * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\AbstractStyle[] $styles - * @return void */ private function writeDefaultStyles(XMLWriter $xmlWriter, $styles) { @@ -145,7 +143,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Font $style - * @return void */ private function writeFontStyle(XMLWriter $xmlWriter, $styleName, FontStyle $style) { @@ -170,7 +167,7 @@ class Styles extends AbstractPart $xmlWriter->startElement('w:link'); $xmlWriter->writeAttribute('w:val', $styleLink); $xmlWriter->endElement(); - } else if (!is_null($paragraphStyle)) { + } elseif (!is_null($paragraphStyle)) { // if type is 'paragraph' it should have a styleId $xmlWriter->writeAttribute('w:styleId', $styleName); } @@ -208,7 +205,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Paragraph $style - * @return void */ private function writeParagraphStyle(XMLWriter $xmlWriter, $styleName, ParagraphStyle $style) { @@ -241,7 +237,6 @@ class Styles extends AbstractPart * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param string $styleName * @param \PhpOffice\PhpWord\Style\Table $style - * @return void */ private function writeTableStyle(XMLWriter $xmlWriter, $styleName, TableStyle $style) { diff --git a/src/PhpWord/Writer/Word2007/Part/Theme.php b/src/PhpWord/Writer/Word2007/Part/Theme.php index e9b16bfc..d616ff39 100644 --- a/src/PhpWord/Writer/Word2007/Part/Theme.php +++ b/src/PhpWord/Writer/Word2007/Part/Theme.php @@ -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\Writer\Word2007\Part; /** @@ -48,7 +47,6 @@ class Theme extends AbstractPart return $str; } - /** * Write color scheme * diff --git a/src/PhpWord/Writer/Word2007/Part/WebSettings.php b/src/PhpWord/Writer/Word2007/Part/WebSettings.php index ce42063d..834347e7 100644 --- a/src/PhpWord/Writer/Word2007/Part/WebSettings.php +++ b/src/PhpWord/Writer/Word2007/Part/WebSettings.php @@ -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\Writer\Word2007\Part; /** diff --git a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php index d0ee5a0d..55dc8065 100644 --- a/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php +++ b/src/PhpWord/Writer/Word2007/Style/AbstractStyle.php @@ -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\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -88,11 +87,11 @@ abstract class AbstractStyle protected function convertTwip($value, $default = 0) { $factors = array( - Settings::UNIT_CM => 567, - Settings::UNIT_MM => 56.7, - Settings::UNIT_INCH => 1440, + Settings::UNIT_CM => 567, + Settings::UNIT_MM => 56.7, + Settings::UNIT_INCH => 1440, Settings::UNIT_POINT => 20, - Settings::UNIT_PICA => 240, + Settings::UNIT_PICA => 240, ); $unit = Settings::getMeasurementUnit(); $factor = 1; @@ -114,7 +113,7 @@ abstract class AbstractStyle protected function writeChildStyle(XMLWriter $xmlWriter, $name, $value) { if ($value !== null) { - $class = "PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\" . $name; + $class = 'PhpOffice\\PhpWord\\Writer\\Word2007\\Style\\' . $name; /** @var \PhpOffice\PhpWord\Writer\Word2007\Style\AbstractStyle $writer */ $writer = new $class($xmlWriter, $value); diff --git a/src/PhpWord/Writer/Word2007/Style/Cell.php b/src/PhpWord/Writer/Word2007/Style/Cell.php index c9156de1..790c42fb 100644 --- a/src/PhpWord/Writer/Word2007/Style/Cell.php +++ b/src/PhpWord/Writer/Word2007/Style/Cell.php @@ -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\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Cell as CellStyle; diff --git a/src/PhpWord/Writer/Word2007/Style/Extrusion.php b/src/PhpWord/Writer/Word2007/Style/Extrusion.php index 3ecd76e4..1d616445 100644 --- a/src/PhpWord/Writer/Word2007/Style/Extrusion.php +++ b/src/PhpWord/Writer/Word2007/Style/Extrusion.php @@ -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\Writer\Word2007\Style; /** @@ -26,8 +25,6 @@ class Extrusion extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +34,7 @@ class Extrusion extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("o:extrusion"); + $xmlWriter->startElement('o:extrusion'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getType() !== null, 'type', $style->getType()); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); diff --git a/src/PhpWord/Writer/Word2007/Style/Fill.php b/src/PhpWord/Writer/Word2007/Style/Fill.php index 7ce68106..bf48325c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Fill.php +++ b/src/PhpWord/Writer/Word2007/Style/Fill.php @@ -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\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Font.php b/src/PhpWord/Writer/Word2007/Style/Font.php index 97cf3088..cfb42fa5 100644 --- a/src/PhpWord/Writer/Word2007/Style/Font.php +++ b/src/PhpWord/Writer/Word2007/Style/Font.php @@ -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\Writer\Word2007\Style; /** @@ -33,8 +32,6 @@ class Font extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -54,8 +51,6 @@ class Font extends AbstractStyle /** * Write full style. - * - * @return void */ private function writeStyle() { @@ -129,7 +124,7 @@ class Font extends AbstractStyle $styleWriter = new Shading($xmlWriter, $shading); $styleWriter->write(); } - + // RTL if ($this->isInline === true) { $styleName = $style->getStyleName(); @@ -143,7 +138,6 @@ class Font extends AbstractStyle * Set is inline. * * @param bool $value - * @return void */ public function setIsInline($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Frame.php b/src/PhpWord/Writer/Word2007/Style/Frame.php index 9c6ddaef..33d0d375 100644 --- a/src/PhpWord/Writer/Word2007/Style/Frame.php +++ b/src/PhpWord/Writer/Word2007/Style/Frame.php @@ -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\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -30,8 +29,6 @@ class Frame extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -62,7 +59,7 @@ class Frame extends AbstractStyle $styles = array_merge($sizeStyles, $posStyles); - // zIndex for infront & behind wrap + // zIndex for infront & behind wrap $wrap = $style->getWrap(); if ($wrap !== null && isset($zIndices[$wrap])) { $styles['z-index'] = $zIndices[$wrap]; @@ -77,8 +74,6 @@ class Frame extends AbstractStyle /** * Write alignment. - * - * @return void */ public function writeAlignment() { @@ -108,7 +103,6 @@ class Frame extends AbstractStyle * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Frame $style * @param string $wrap - * @return void */ private function writeWrap(XMLWriter $xmlWriter, FrameStyle $style, $wrap) { @@ -129,8 +123,8 @@ class Frame extends AbstractStyle $vPos = $style->getVPosRelTo(); if ($pos == FrameStyle::POS_ABSOLUTE) { - $xmlWriter->writeAttribute('anchorx', "page"); - $xmlWriter->writeAttribute('anchory', "page"); + $xmlWriter->writeAttribute('anchorx', 'page'); + $xmlWriter->writeAttribute('anchory', 'page'); } elseif ($pos == FrameStyle::POS_RELATIVE) { if (isset($relativePositions[$hPos])) { $xmlWriter->writeAttribute('anchorx', $relativePositions[$hPos]); diff --git a/src/PhpWord/Writer/Word2007/Style/Image.php b/src/PhpWord/Writer/Word2007/Style/Image.php index 3bbe751e..315b4ac4 100644 --- a/src/PhpWord/Writer/Word2007/Style/Image.php +++ b/src/PhpWord/Writer/Word2007/Style/Image.php @@ -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\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Indentation.php b/src/PhpWord/Writer/Word2007/Style/Indentation.php index a7edaee1..194c7d4f 100644 --- a/src/PhpWord/Writer/Word2007/Style/Indentation.php +++ b/src/PhpWord/Writer/Word2007/Style/Indentation.php @@ -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\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Line.php b/src/PhpWord/Writer/Word2007/Style/Line.php index 3407c252..8fff76b3 100644 --- a/src/PhpWord/Writer/Word2007/Style/Line.php +++ b/src/PhpWord/Writer/Word2007/Style/Line.php @@ -11,24 +11,20 @@ * 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\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Line as LineStyle; /** * Line style writer - * */ class Line extends Frame { /** * Write Line stroke. - * - * @return void * @todo Merge with `Stroke` style */ public function writeStroke() diff --git a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php index 592fb7bb..2003d066 100644 --- a/src/PhpWord/Writer/Word2007/Style/LineNumbering.php +++ b/src/PhpWord/Writer/Word2007/Style/LineNumbering.php @@ -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\Writer\Word2007\Style; /** @@ -26,9 +25,6 @@ class LineNumbering extends AbstractStyle { /** * Write style. - * - * @return void - * * The w:start seems to be zero based so we have to decrement by one */ public function write() diff --git a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php index 68ba70d2..aadac78e 100644 --- a/src/PhpWord/Writer/Word2007/Style/MarginBorder.php +++ b/src/PhpWord/Writer/Word2007/Style/MarginBorder.php @@ -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\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -29,7 +28,7 @@ class MarginBorder extends AbstractStyle /** * Sizes * - * @var integer[] + * @var int[] */ private $sizes = array(); @@ -49,8 +48,6 @@ class MarginBorder extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -76,7 +73,6 @@ class MarginBorder extends AbstractStyle * @param string $side * @param int $width * @param string $color - * @return void */ private function writeSide(XMLWriter $xmlWriter, $side, $width, $color = null) { @@ -105,8 +101,7 @@ class MarginBorder extends AbstractStyle /** * Set sizes. * - * @param integer[] $value - * @return void + * @param int[] $value */ public function setSizes($value) { @@ -117,7 +112,6 @@ class MarginBorder extends AbstractStyle * Set colors. * * @param string[] $value - * @return void */ public function setColors($value) { @@ -128,7 +122,6 @@ class MarginBorder extends AbstractStyle * Set attributes. * * @param array $value - * @return void */ public function setAttributes($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Outline.php b/src/PhpWord/Writer/Word2007/Style/Outline.php index 620720b3..2a20da75 100644 --- a/src/PhpWord/Writer/Word2007/Style/Outline.php +++ b/src/PhpWord/Writer/Word2007/Style/Outline.php @@ -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\Writer\Word2007\Style; /** @@ -26,8 +25,6 @@ class Outline extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +34,7 @@ class Outline extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("v:stroke"); + $xmlWriter->startElement('v:stroke'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); $xmlWriter->writeAttributeIf($style->getWeight() !== null, 'weight', $style->getWeight() . $style->getUnit()); diff --git a/src/PhpWord/Writer/Word2007/Style/Paragraph.php b/src/PhpWord/Writer/Word2007/Style/Paragraph.php index 787f2a5f..dca4ddda 100644 --- a/src/PhpWord/Writer/Word2007/Style/Paragraph.php +++ b/src/PhpWord/Writer/Word2007/Style/Paragraph.php @@ -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\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; @@ -45,8 +44,6 @@ class Paragraph extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -70,8 +67,6 @@ class Paragraph extends AbstractStyle /** * Write full style. - * - * @return void */ private function writeStyle() { @@ -106,7 +101,7 @@ class Paragraph extends AbstractStyle } $xmlWriter->endElement(); } - + //Paragraph contextualSpacing $xmlWriter->writeElementIf($styles['contextualSpacing'] === true, 'w:contextualSpacing'); @@ -143,12 +138,11 @@ class Paragraph extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param \PhpOffice\PhpWord\Style\Tab[] $tabs - * @return void */ private function writeTabs(XMLWriter $xmlWriter, $tabs) { if (!empty($tabs)) { - $xmlWriter->startElement("w:tabs"); + $xmlWriter->startElement('w:tabs'); foreach ($tabs as $tab) { $styleWriter = new Tab($xmlWriter, $tab); $styleWriter->write(); @@ -162,7 +156,6 @@ class Paragraph extends AbstractStyle * * @param \PhpOffice\Common\XMLWriter $xmlWriter * @param array $numbering - * @return void */ private function writeNumbering(XMLWriter $xmlWriter, $numbering) { @@ -191,7 +184,6 @@ class Paragraph extends AbstractStyle * Set without w:pPr. * * @param bool $value - * @return void */ public function setWithoutPPR($value) { @@ -202,7 +194,6 @@ class Paragraph extends AbstractStyle * Set is inline. * * @param bool $value - * @return void */ public function setIsInline($value) { diff --git a/src/PhpWord/Writer/Word2007/Style/Row.php b/src/PhpWord/Writer/Word2007/Style/Row.php index e8b7e1a5..a89e6b11 100644 --- a/src/PhpWord/Writer/Word2007/Style/Row.php +++ b/src/PhpWord/Writer/Word2007/Style/Row.php @@ -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\Writer\Word2007\Style; /** @@ -31,8 +30,6 @@ class Row extends AbstractStyle /** * Write style. - * - * @return void */ public function write() { @@ -60,7 +57,6 @@ class Row extends AbstractStyle * Set height. * * @param int $value - * @return void */ public function setHeight($value = null) { diff --git a/src/PhpWord/Writer/Word2007/Style/Section.php b/src/PhpWord/Writer/Word2007/Style/Section.php index 60b5d869..55aed399 100644 --- a/src/PhpWord/Writer/Word2007/Style/Section.php +++ b/src/PhpWord/Writer/Word2007/Style/Section.php @@ -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\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\Section as SectionStyle; @@ -28,8 +27,6 @@ class Section extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Shading.php b/src/PhpWord/Writer/Word2007/Style/Shading.php index c3594b24..0c9dc3ac 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shading.php +++ b/src/PhpWord/Writer/Word2007/Style/Shading.php @@ -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\Writer\Word2007\Style; /** @@ -26,8 +25,6 @@ class Shading extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { diff --git a/src/PhpWord/Writer/Word2007/Style/Shadow.php b/src/PhpWord/Writer/Word2007/Style/Shadow.php index 239c161d..4b38ba34 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shadow.php +++ b/src/PhpWord/Writer/Word2007/Style/Shadow.php @@ -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\Writer\Word2007\Style; /** @@ -26,8 +25,6 @@ class Shadow extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,7 +34,7 @@ class Shadow extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("v:shadow"); + $xmlWriter->startElement('v:shadow'); $xmlWriter->writeAttribute('on', 't'); $xmlWriter->writeAttributeIf($style->getColor() !== null, 'color', $style->getColor()); $xmlWriter->writeAttributeIf($style->getOffset() !== null, 'offset', $style->getOffset()); diff --git a/src/PhpWord/Writer/Word2007/Style/Shape.php b/src/PhpWord/Writer/Word2007/Style/Shape.php index 4ed1469d..15adda3d 100644 --- a/src/PhpWord/Writer/Word2007/Style/Shape.php +++ b/src/PhpWord/Writer/Word2007/Style/Shape.php @@ -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\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Spacing.php b/src/PhpWord/Writer/Word2007/Style/Spacing.php index bd2d06aa..60b7f178 100644 --- a/src/PhpWord/Writer/Word2007/Style/Spacing.php +++ b/src/PhpWord/Writer/Word2007/Style/Spacing.php @@ -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\Writer\Word2007\Style; /** diff --git a/src/PhpWord/Writer/Word2007/Style/Tab.php b/src/PhpWord/Writer/Word2007/Style/Tab.php index 9867023f..ec502e1c 100644 --- a/src/PhpWord/Writer/Word2007/Style/Tab.php +++ b/src/PhpWord/Writer/Word2007/Style/Tab.php @@ -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\Writer\Word2007\Style; /** @@ -26,8 +25,6 @@ class Tab extends AbstractStyle { /** * Write style. - * - * @return void */ public function write() { @@ -37,9 +34,9 @@ class Tab extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $xmlWriter->startElement("w:tab"); - $xmlWriter->writeAttribute("w:val", $style->getType()); - $xmlWriter->writeAttribute("w:leader", $style->getLeader()); + $xmlWriter->startElement('w:tab'); + $xmlWriter->writeAttribute('w:val', $style->getType()); + $xmlWriter->writeAttribute('w:leader', $style->getLeader()); $xmlWriter->writeAttribute('w:pos', $this->convertTwip($style->getPosition())); $xmlWriter->endElement(); } diff --git a/src/PhpWord/Writer/Word2007/Style/Table.php b/src/PhpWord/Writer/Word2007/Style/Table.php index 570e85bb..9ab18162 100644 --- a/src/PhpWord/Writer/Word2007/Style/Table.php +++ b/src/PhpWord/Writer/Word2007/Style/Table.php @@ -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\Writer\Word2007\Style; use PhpOffice\Common\XMLWriter; diff --git a/src/PhpWord/Writer/Word2007/Style/TextBox.php b/src/PhpWord/Writer/Word2007/Style/TextBox.php index f8f94da3..975fd926 100644 --- a/src/PhpWord/Writer/Word2007/Style/TextBox.php +++ b/src/PhpWord/Writer/Word2007/Style/TextBox.php @@ -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\Writer\Word2007\Style; use PhpOffice\PhpWord\Style\TextBox as TextBoxStyle; @@ -28,8 +27,6 @@ class TextBox extends Frame { /** * Writer inner margin. - * - * @return void */ public function writeInnerMargin() { @@ -46,8 +43,6 @@ class TextBox extends Frame /** * Writer border. - * - * @return void */ public function writeBorder() { diff --git a/src/PhpWord/Writer/WriterInterface.php b/src/PhpWord/Writer/WriterInterface.php index 1ccdf321..bc1c21e0 100644 --- a/src/PhpWord/Writer/WriterInterface.php +++ b/src/PhpWord/Writer/WriterInterface.php @@ -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\Writer; /** diff --git a/tests/PhpWord/Collection/CollectionTest.php b/tests/PhpWord/Collection/CollectionTest.php index 4b2fa0ca..59dd162c 100644 --- a/tests/PhpWord/Collection/CollectionTest.php +++ b/tests/PhpWord/Collection/CollectionTest.php @@ -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; use PhpOffice\PhpWord\Element\Footnote; diff --git a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php index 025e8c91..8d0eac5d 100644 --- a/tests/PhpWord/ComplexType/FootnotePropertiesTest.php +++ b/tests/PhpWord/ComplexType/FootnotePropertiesTest.php @@ -11,13 +11,11 @@ * 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; -use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\SimpleType\NumberFormat; /** @@ -47,34 +45,34 @@ class FootnotePropertiesTest extends \PHPUnit_Framework_TestCase /** * Test throws exception if wrong position given - * + * * @expectedException \InvalidArgumentException */ public function testWrongPos() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setPos(NumberFormat::LOWER_ROMAN); } /** * Test throws exception if wrong number format given - * + * * @expectedException \InvalidArgumentException */ public function testWrongNumFmt() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setNumFmt(FootnoteProperties::POSITION_DOC_END); } /** * Test throws exception if wrong number restart given - * + * * @expectedException \InvalidArgumentException */ public function testWrongNumRestart() { - $footnoteProp= new FootnoteProperties(); + $footnoteProp = new FootnoteProperties(); $footnoteProp->setNumRestart(NumberFormat::LOWER_ROMAN); } } diff --git a/tests/PhpWord/Element/AbstractElementTest.php b/tests/PhpWord/Element/AbstractElementTest.php index 83f209e4..be0aff7c 100644 --- a/tests/PhpWord/Element/AbstractElementTest.php +++ b/tests/PhpWord/Element/AbstractElementTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/CellTest.php b/tests/PhpWord/Element/CellTest.php index f1d6a280..ca58d8c8 100644 --- a/tests/PhpWord/Element/CellTest.php +++ b/tests/PhpWord/Element/CellTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/CheckBoxTest.php b/tests/PhpWord/Element/CheckBoxTest.php index 183d22db..6431d145 100644 --- a/tests/PhpWord/Element/CheckBoxTest.php +++ b/tests/PhpWord/Element/CheckBoxTest.php @@ -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\SimpleType\Jc; diff --git a/tests/PhpWord/Element/CommentTest.php b/tests/PhpWord/Element/CommentTest.php index db9ec902..13d0c330 100644 --- a/tests/PhpWord/Element/CommentTest.php +++ b/tests/PhpWord/Element/CommentTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/FieldTest.php b/tests/PhpWord/Element/FieldTest.php index 6f5ebbbf..a4e95dc6 100644 --- a/tests/PhpWord/Element/FieldTest.php +++ b/tests/PhpWord/Element/FieldTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/FooterTest.php b/tests/PhpWord/Element/FooterTest.php index 33a211d3..69ee3b5b 100644 --- a/tests/PhpWord/Element/FooterTest.php +++ b/tests/PhpWord/Element/FooterTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/FootnoteTest.php b/tests/PhpWord/Element/FootnoteTest.php index a3f3b4d8..aad9d99f 100644 --- a/tests/PhpWord/Element/FootnoteTest.php +++ b/tests/PhpWord/Element/FootnoteTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/HeaderTest.php b/tests/PhpWord/Element/HeaderTest.php index f75910aa..fdc77607 100644 --- a/tests/PhpWord/Element/HeaderTest.php +++ b/tests/PhpWord/Element/HeaderTest.php @@ -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; /** @@ -228,7 +227,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase /** * Add footnote exception * - * @expectedException BadMethodCallException + * @expectedException \BadMethodCallException */ public function testAddFootnoteException() { diff --git a/tests/PhpWord/Element/ImageTest.php b/tests/PhpWord/Element/ImageTest.php index 974e868c..0be6bd6b 100644 --- a/tests/PhpWord/Element/ImageTest.php +++ b/tests/PhpWord/Element/ImageTest.php @@ -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\SimpleType\Jc; @@ -133,9 +132,9 @@ class ImageTest extends \PHPUnit_Framework_TestCase { //disable ssl verification, never do this in real application, you should pass the certiciate instead!!! $arrContextOptions = array( - "ssl" => array( - "verify_peer" => false, - "verify_peer_name" => false, + 'ssl' => array( + 'verify_peer' => false, + 'verify_peer_name' => false, ), ); stream_context_set_default($arrContextOptions); diff --git a/tests/PhpWord/Element/LineTest.php b/tests/PhpWord/Element/LineTest.php index a7b15b08..f0fdb9b7 100644 --- a/tests/PhpWord/Element/LineTest.php +++ b/tests/PhpWord/Element/LineTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/LinkTest.php b/tests/PhpWord/Element/LinkTest.php index 40f07a1f..d3f97d5e 100644 --- a/tests/PhpWord/Element/LinkTest.php +++ b/tests/PhpWord/Element/LinkTest.php @@ -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; @@ -49,7 +48,7 @@ class LinkTest extends \PHPUnit_Framework_TestCase $oLink = new Link( 'https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', - array('color' => '0000FF', 'underline' => Font::UNDERLINE_SINGLE), + array('color' => '0000FF', 'underline' => Font::UNDERLINE_SINGLE), array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600) ); diff --git a/tests/PhpWord/Element/ListItemRunTest.php b/tests/PhpWord/Element/ListItemRunTest.php index 91609357..8ba5308d 100644 --- a/tests/PhpWord/Element/ListItemRunTest.php +++ b/tests/PhpWord/Element/ListItemRunTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/ListItemTest.php b/tests/PhpWord/Element/ListItemTest.php index 2dc4f65c..9c92ec61 100644 --- a/tests/PhpWord/Element/ListItemTest.php +++ b/tests/PhpWord/Element/ListItemTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/ObjectTest.php b/tests/PhpWord/Element/ObjectTest.php index 44516b61..ba081bff 100644 --- a/tests/PhpWord/Element/ObjectTest.php +++ b/tests/PhpWord/Element/ObjectTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/PageBreakTest.php b/tests/PhpWord/Element/PageBreakTest.php index 3d8b1db6..d86e8841 100644 --- a/tests/PhpWord/Element/PageBreakTest.php +++ b/tests/PhpWord/Element/PageBreakTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/PreserveTextTest.php b/tests/PhpWord/Element/PreserveTextTest.php index 33e2272a..9252c733 100644 --- a/tests/PhpWord/Element/PreserveTextTest.php +++ b/tests/PhpWord/Element/PreserveTextTest.php @@ -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\SimpleType\Jc; diff --git a/tests/PhpWord/Element/RowTest.php b/tests/PhpWord/Element/RowTest.php index 58a166f4..03863f5d 100644 --- a/tests/PhpWord/Element/RowTest.php +++ b/tests/PhpWord/Element/RowTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/SDTTest.php b/tests/PhpWord/Element/SDTTest.php index 52705bc1..e1032b8d 100644 --- a/tests/PhpWord/Element/SDTTest.php +++ b/tests/PhpWord/Element/SDTTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/SectionTest.php b/tests/PhpWord/Element/SectionTest.php index 78010bc9..39b37683 100644 --- a/tests/PhpWord/Element/SectionTest.php +++ b/tests/PhpWord/Element/SectionTest.php @@ -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; diff --git a/tests/PhpWord/Element/TOCTest.php b/tests/PhpWord/Element/TOCTest.php index 6b5867bc..1ac57b7b 100644 --- a/tests/PhpWord/Element/TOCTest.php +++ b/tests/PhpWord/Element/TOCTest.php @@ -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; diff --git a/tests/PhpWord/Element/TableTest.php b/tests/PhpWord/Element/TableTest.php index 785ec40a..0b428ea4 100644 --- a/tests/PhpWord/Element/TableTest.php +++ b/tests/PhpWord/Element/TableTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/TextBoxTest.php b/tests/PhpWord/Element/TextBoxTest.php index cb3fdb99..be28e7b3 100644 --- a/tests/PhpWord/Element/TextBoxTest.php +++ b/tests/PhpWord/Element/TextBoxTest.php @@ -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; /** diff --git a/tests/PhpWord/Element/TextBreakTest.php b/tests/PhpWord/Element/TextBreakTest.php index 40ed6965..3e84add6 100644 --- a/tests/PhpWord/Element/TextBreakTest.php +++ b/tests/PhpWord/Element/TextBreakTest.php @@ -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; diff --git a/tests/PhpWord/Element/TextRunTest.php b/tests/PhpWord/Element/TextRunTest.php index efd8d6f3..c4364423 100644 --- a/tests/PhpWord/Element/TextRunTest.php +++ b/tests/PhpWord/Element/TextRunTest.php @@ -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; diff --git a/tests/PhpWord/Element/TextTest.php b/tests/PhpWord/Element/TextTest.php index d2fe0472..a2ab6df4 100644 --- a/tests/PhpWord/Element/TextTest.php +++ b/tests/PhpWord/Element/TextTest.php @@ -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\SimpleType\Jc; diff --git a/tests/PhpWord/Element/TitleTest.php b/tests/PhpWord/Element/TitleTest.php index 2b886e5e..426fa6d8 100644 --- a/tests/PhpWord/Element/TitleTest.php +++ b/tests/PhpWord/Element/TitleTest.php @@ -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; /** diff --git a/tests/PhpWord/Exception/CopyFileExceptionTest.php b/tests/PhpWord/Exception/CopyFileExceptionTest.php index 0bc2e322..490dfe1a 100644 --- a/tests/PhpWord/Exception/CopyFileExceptionTest.php +++ b/tests/PhpWord/Exception/CopyFileExceptionTest.php @@ -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; /** diff --git a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php index d68bf573..68941506 100644 --- a/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php +++ b/tests/PhpWord/Exception/CreateTemporaryFileExceptionTest.php @@ -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; /** diff --git a/tests/PhpWord/Exception/ExceptionTest.php b/tests/PhpWord/Exception/ExceptionTest.php index 4c14abb9..c0e96e21 100644 --- a/tests/PhpWord/Exception/ExceptionTest.php +++ b/tests/PhpWord/Exception/ExceptionTest.php @@ -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; /** @@ -33,6 +32,6 @@ class ExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new Exception; + throw new Exception(); } } diff --git a/tests/PhpWord/Exception/InvalidImageExceptionTest.php b/tests/PhpWord/Exception/InvalidImageExceptionTest.php index d83aa878..42f9206d 100644 --- a/tests/PhpWord/Exception/InvalidImageExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidImageExceptionTest.php @@ -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; /** @@ -33,6 +32,6 @@ class InvalidImageExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new InvalidImageException; + throw new InvalidImageException(); } } diff --git a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php index 5038ed2f..6c1f8482 100644 --- a/tests/PhpWord/Exception/InvalidStyleExceptionTest.php +++ b/tests/PhpWord/Exception/InvalidStyleExceptionTest.php @@ -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; /** @@ -33,6 +32,6 @@ class InvalidStyleExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new InvalidStyleException; + throw new InvalidStyleException(); } } diff --git a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php index 251ed957..553a2e89 100644 --- a/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php +++ b/tests/PhpWord/Exception/UnsupportedImageTypeExceptionTest.php @@ -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; /** @@ -33,6 +32,6 @@ class UnsupportedImageTypeExceptionTest extends \PHPUnit_Framework_TestCase */ public function testThrowException() { - throw new UnsupportedImageTypeException; + throw new UnsupportedImageTypeException(); } } diff --git a/tests/PhpWord/IOFactoryTest.php b/tests/PhpWord/IOFactoryTest.php index 9c2d1e67..666854cc 100644 --- a/tests/PhpWord/IOFactoryTest.php +++ b/tests/PhpWord/IOFactoryTest.php @@ -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; /** diff --git a/tests/PhpWord/MediaTest.php b/tests/PhpWord/MediaTest.php index 25480313..8755f31b 100644 --- a/tests/PhpWord/MediaTest.php +++ b/tests/PhpWord/MediaTest.php @@ -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; @@ -106,7 +105,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase /** * Add image element exception * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage Image object not assigned. */ public function testAddElementImageException() diff --git a/tests/PhpWord/Metadata/DocInfoTest.php b/tests/PhpWord/Metadata/DocInfoTest.php index 23572710..da1a9f1b 100644 --- a/tests/PhpWord/Metadata/DocInfoTest.php +++ b/tests/PhpWord/Metadata/DocInfoTest.php @@ -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; /** diff --git a/tests/PhpWord/Metadata/SettingsTest.php b/tests/PhpWord/Metadata/SettingsTest.php index fff51652..37e2cc12 100644 --- a/tests/PhpWord/Metadata/SettingsTest.php +++ b/tests/PhpWord/Metadata/SettingsTest.php @@ -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; use PhpOffice\PhpWord\ComplexType\ProofState; @@ -34,7 +33,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setEvenAndOddHeaders(true); - $this->assertEquals(true, $oSettings->hasEvenAndOddHeaders()); + $this->assertTrue($oSettings->hasEvenAndOddHeaders()); } /** @@ -44,7 +43,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setHideGrammaticalErrors(true); - $this->assertEquals(true, $oSettings->hasHideGrammaticalErrors()); + $this->assertTrue($oSettings->hasHideGrammaticalErrors()); } /** @@ -54,7 +53,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setHideSpellingErrors(true); - $this->assertEquals(true, $oSettings->hasHideSpellingErrors()); + $this->assertTrue($oSettings->hasHideSpellingErrors()); } /** @@ -77,7 +76,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setTrackRevisions(true); - $this->assertEquals(true, $oSettings->hasTrackRevisions()); + $this->assertTrue($oSettings->hasTrackRevisions()); } /** @@ -87,7 +86,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setDoNotTrackFormatting(true); - $this->assertEquals(true, $oSettings->hasDoNotTrackFormatting()); + $this->assertTrue($oSettings->hasDoNotTrackFormatting()); } /** @@ -97,7 +96,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $oSettings = new Settings(); $oSettings->setDoNotTrackMoves(true); - $this->assertEquals(true, $oSettings->hasDoNotTrackMoves()); + $this->assertTrue($oSettings->hasDoNotTrackMoves()); } /** diff --git a/tests/PhpWord/PhpWordTest.php b/tests/PhpWord/PhpWordTest.php index ef0385b9..23a29f89 100644 --- a/tests/PhpWord/PhpWordTest.php +++ b/tests/PhpWord/PhpWordTest.php @@ -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\Metadata\DocInfo; @@ -99,7 +98,6 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase $phpWord->$method($styleId, array()); $this->assertInstanceOf("PhpOffice\\PhpWord\\Style\\{$value}", Style::getStyle($styleId)); } - } /** @@ -139,7 +137,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase */ public function testLoadTemplateException() { - $templateFqfn = join( + $templateFqfn = implode( DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx') ); diff --git a/tests/PhpWord/Reader/HTMLTest.php b/tests/PhpWord/Reader/HTMLTest.php index 6e3039cf..67342dc2 100644 --- a/tests/PhpWord/Reader/HTMLTest.php +++ b/tests/PhpWord/Reader/HTMLTest.php @@ -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\IOFactory; diff --git a/tests/PhpWord/Reader/MsDocTest.php b/tests/PhpWord/Reader/MsDocTest.php index b4173d17..86e42c87 100644 --- a/tests/PhpWord/Reader/MsDocTest.php +++ b/tests/PhpWord/Reader/MsDocTest.php @@ -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\IOFactory; diff --git a/tests/PhpWord/Reader/ODTextTest.php b/tests/PhpWord/Reader/ODTextTest.php index 1bdce2e6..09b1adda 100644 --- a/tests/PhpWord/Reader/ODTextTest.php +++ b/tests/PhpWord/Reader/ODTextTest.php @@ -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\IOFactory; diff --git a/tests/PhpWord/Reader/RTFTest.php b/tests/PhpWord/Reader/RTFTest.php index 79cf13a7..027e7c73 100644 --- a/tests/PhpWord/Reader/RTFTest.php +++ b/tests/PhpWord/Reader/RTFTest.php @@ -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\IOFactory; diff --git a/tests/PhpWord/Reader/Word2007Test.php b/tests/PhpWord/Reader/Word2007Test.php index 9be78a5b..8766730a 100644 --- a/tests/PhpWord/Reader/Word2007Test.php +++ b/tests/PhpWord/Reader/Word2007Test.php @@ -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\IOFactory; diff --git a/tests/PhpWord/SettingsTest.php b/tests/PhpWord/SettingsTest.php index f5ac3ed6..7699a843 100644 --- a/tests/PhpWord/SettingsTest.php +++ b/tests/PhpWord/SettingsTest.php @@ -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; /** @@ -78,7 +77,6 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $this->assertEquals(sys_get_temp_dir(), Settings::getTempDir()); } - /** * @covers ::setTempDir * @covers ::getTempDir diff --git a/tests/PhpWord/Shared/ConverterTest.php b/tests/PhpWord/Shared/ConverterTest.php index e307f09b..9f256e07 100644 --- a/tests/PhpWord/Shared/ConverterTest.php +++ b/tests/PhpWord/Shared/ConverterTest.php @@ -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; /** @@ -89,7 +88,7 @@ class ConverterTest extends \PHPUnit_Framework_TestCase $this->assertEquals(round($value / 9525), $result); $result = Converter::degreeToAngle($value); - $this->assertEquals((int)round($value * 60000), $result); + $this->assertEquals((int) round($value * 60000), $result); $result = Converter::angleToDegree($value); $this->assertEquals(round($value / 60000), $result); diff --git a/tests/PhpWord/Shared/HtmlTest.php b/tests/PhpWord/Shared/HtmlTest.php index c651fd4a..eb39d3b7 100644 --- a/tests/PhpWord/Shared/HtmlTest.php +++ b/tests/PhpWord/Shared/HtmlTest.php @@ -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\Section; diff --git a/tests/PhpWord/Shared/ZipArchiveTest.php b/tests/PhpWord/Shared/ZipArchiveTest.php index 1adcfbfc..94dc33b2 100644 --- a/tests/PhpWord/Shared/ZipArchiveTest.php +++ b/tests/PhpWord/Shared/ZipArchiveTest.php @@ -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\Settings; @@ -27,7 +26,6 @@ use PhpOffice\PhpWord\Settings; */ class ZipArchiveTest extends \PHPUnit_Framework_TestCase { - /** * Test close method exception: Working in local, not working in Travis * diff --git a/tests/PhpWord/Style/AbstractStyleTest.php b/tests/PhpWord/Style/AbstractStyleTest.php index f7c6f6c5..86efdb68 100644 --- a/tests/PhpWord/Style/AbstractStyleTest.php +++ b/tests/PhpWord/Style/AbstractStyleTest.php @@ -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\Style; /** @@ -87,6 +86,7 @@ class AbstractStyleTest extends \PHPUnit_Framework_TestCase $class = new \ReflectionClass(get_class($object)); $method = $class->getMethod($method); $method->setAccessible(true); + return $method->invokeArgs($object, $args); } } diff --git a/tests/PhpWord/Style/CellTest.php b/tests/PhpWord/Style/CellTest.php index 51f4e895..198386fe 100644 --- a/tests/PhpWord/Style/CellTest.php +++ b/tests/PhpWord/Style/CellTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/FontTest.php b/tests/PhpWord/Style/FontTest.php index 61648d4e..e2f1fd02 100644 --- a/tests/PhpWord/Style/FontTest.php +++ b/tests/PhpWord/Style/FontTest.php @@ -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\Style; use PhpOffice\PhpWord\PhpWord; @@ -45,7 +44,7 @@ class FontTest extends \PHPUnit_Framework_TestCase $this->assertEquals('text', $object->getStyleType()); $this->assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $object->getParagraphStyle()); - $this->assertTrue(is_array($object->getStyleValues())); + $this->assertInternalType('array', $object->getStyleValues()); } /** diff --git a/tests/PhpWord/Style/ImageTest.php b/tests/PhpWord/Style/ImageTest.php index c5bb5c7d..cf4a35b0 100644 --- a/tests/PhpWord/Style/ImageTest.php +++ b/tests/PhpWord/Style/ImageTest.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Style/IndentationTest.php b/tests/PhpWord/Style/IndentationTest.php index 477e1314..419780ca 100644 --- a/tests/PhpWord/Style/IndentationTest.php +++ b/tests/PhpWord/Style/IndentationTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/LineNumberingTest.php b/tests/PhpWord/Style/LineNumberingTest.php index e8ef1367..06b1a70a 100644 --- a/tests/PhpWord/Style/LineNumberingTest.php +++ b/tests/PhpWord/Style/LineNumberingTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/LineTest.php b/tests/PhpWord/Style/LineTest.php index 98e20b3d..a07c5ac3 100644 --- a/tests/PhpWord/Style/LineTest.php +++ b/tests/PhpWord/Style/LineTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/ListItemTest.php b/tests/PhpWord/Style/ListItemTest.php index 2e8692e9..2ac453b4 100644 --- a/tests/PhpWord/Style/ListItemTest.php +++ b/tests/PhpWord/Style/ListItemTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/NumberingLevelTest.php b/tests/PhpWord/Style/NumberingLevelTest.php index c6cee11c..1af7a77c 100644 --- a/tests/PhpWord/Style/NumberingLevelTest.php +++ b/tests/PhpWord/Style/NumberingLevelTest.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; diff --git a/tests/PhpWord/Style/NumberingTest.php b/tests/PhpWord/Style/NumberingTest.php index ee9c032c..1158e0e8 100644 --- a/tests/PhpWord/Style/NumberingTest.php +++ b/tests/PhpWord/Style/NumberingTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/PaperTest.php b/tests/PhpWord/Style/PaperTest.php index 8e1dd960..437fdde8 100644 --- a/tests/PhpWord/Style/PaperTest.php +++ b/tests/PhpWord/Style/PaperTest.php @@ -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\Style; use PhpOffice\PhpWord\PhpWord; diff --git a/tests/PhpWord/Style/ParagraphTest.php b/tests/PhpWord/Style/ParagraphTest.php index 86d6e896..28530d6e 100644 --- a/tests/PhpWord/Style/ParagraphTest.php +++ b/tests/PhpWord/Style/ParagraphTest.php @@ -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\Style; use PhpOffice\PhpWord\PhpWord; @@ -98,10 +97,11 @@ class ParagraphTest extends \PHPUnit_Framework_TestCase if (is_bool($value)) { if (method_exists($object, "is{$key}")) { return "is{$key}"; - } else if (method_exists($object, "has{$key}")) { + } elseif (method_exists($object, "has{$key}")) { return "has{$key}"; } } + return "get{$key}"; } diff --git a/tests/PhpWord/Style/RowTest.php b/tests/PhpWord/Style/RowTest.php index a89f73d2..d5a31c49 100644 --- a/tests/PhpWord/Style/RowTest.php +++ b/tests/PhpWord/Style/RowTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/SectionTest.php b/tests/PhpWord/Style/SectionTest.php index d15dc490..2ec08d4d 100644 --- a/tests/PhpWord/Style/SectionTest.php +++ b/tests/PhpWord/Style/SectionTest.php @@ -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\Style; /** @@ -23,7 +22,7 @@ namespace PhpOffice\PhpWord\Style; * @coversDefaultClass \PhpOffice\PhpWord\Element\Section * @runTestsInSeparateProcesses */ -class SettingsTest extends \PHPUnit_Framework_TestCase +class SectionTest extends \PHPUnit_Framework_TestCase { /** * Executed before each method of the class diff --git a/tests/PhpWord/Style/ShadingTest.php b/tests/PhpWord/Style/ShadingTest.php index d6378f8d..0dd82fa3 100644 --- a/tests/PhpWord/Style/ShadingTest.php +++ b/tests/PhpWord/Style/ShadingTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/SpacingTest.php b/tests/PhpWord/Style/SpacingTest.php index 79c9e458..4c846ce1 100644 --- a/tests/PhpWord/Style/SpacingTest.php +++ b/tests/PhpWord/Style/SpacingTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/TOCTest.php b/tests/PhpWord/Style/TOCTest.php index 03620c17..15fbd546 100644 --- a/tests/PhpWord/Style/TOCTest.php +++ b/tests/PhpWord/Style/TOCTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/TabTest.php b/tests/PhpWord/Style/TabTest.php index 7724aa41..7ef53c60 100644 --- a/tests/PhpWord/Style/TabTest.php +++ b/tests/PhpWord/Style/TabTest.php @@ -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\Style; /** diff --git a/tests/PhpWord/Style/TableTest.php b/tests/PhpWord/Style/TableTest.php index 5e878692..863e05eb 100644 --- a/tests/PhpWord/Style/TableTest.php +++ b/tests/PhpWord/Style/TableTest.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\JcTable; diff --git a/tests/PhpWord/Style/TextBoxTest.php b/tests/PhpWord/Style/TextBoxTest.php index ea7bc71f..d59fd426 100644 --- a/tests/PhpWord/Style/TextBoxTest.php +++ b/tests/PhpWord/Style/TextBoxTest.php @@ -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\Style; use PhpOffice\PhpWord\SimpleType\Jc; @@ -238,7 +237,6 @@ class TextBoxTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $object->getPosVerticalRel()); } - /** * Test set/get innerMarginRight */ diff --git a/tests/PhpWord/StyleTest.php b/tests/PhpWord/StyleTest.php index 57ec98f4..242af07e 100644 --- a/tests/PhpWord/StyleTest.php +++ b/tests/PhpWord/StyleTest.php @@ -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\SimpleType\Jc; diff --git a/tests/PhpWord/TemplateProcessorTest.php b/tests/PhpWord/TemplateProcessorTest.php index 11b43cf4..7da6a2c4 100644 --- a/tests/PhpWord/TemplateProcessorTest.php +++ b/tests/PhpWord/TemplateProcessorTest.php @@ -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; /** @@ -36,7 +35,7 @@ final class TemplateProcessorTest extends \PHPUnit_Framework_TestCase $templateProcessor = new TemplateProcessor($templateFqfn); $xslDomDocument = new \DOMDocument(); - $xslDomDocument->load(__DIR__ . "/_files/xsl/remove_tables_by_needle.xsl"); + $xslDomDocument->load(__DIR__ . '/_files/xsl/remove_tables_by_needle.xsl'); foreach (array('${employee.', '${scoreboard.', '${reference.') as $needle) { $templateProcessor->applyXslStyleSheet($xslDomDocument, array('needle' => $needle)); } diff --git a/tests/PhpWord/Writer/HTML/ElementTest.php b/tests/PhpWord/Writer/HTML/ElementTest.php index 2a1e03dc..b39de48b 100644 --- a/tests/PhpWord/Writer/HTML/ElementTest.php +++ b/tests/PhpWord/Writer/HTML/ElementTest.php @@ -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\Writer\HTML; diff --git a/tests/PhpWord/Writer/HTML/PartTest.php b/tests/PhpWord/Writer/HTML/PartTest.php index 137a092e..26894a5e 100644 --- a/tests/PhpWord/Writer/HTML/PartTest.php +++ b/tests/PhpWord/Writer/HTML/PartTest.php @@ -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\Writer\HTML; diff --git a/tests/PhpWord/Writer/HTML/StyleTest.php b/tests/PhpWord/Writer/HTML/StyleTest.php index 629efd7a..54f3779e 100644 --- a/tests/PhpWord/Writer/HTML/StyleTest.php +++ b/tests/PhpWord/Writer/HTML/StyleTest.php @@ -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\Writer\HTML; diff --git a/tests/PhpWord/Writer/HTMLTest.php b/tests/PhpWord/Writer/HTMLTest.php index b2b10165..36f346d9 100644 --- a/tests/PhpWord/Writer/HTMLTest.php +++ b/tests/PhpWord/Writer/HTMLTest.php @@ -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\Writer; @@ -31,7 +31,7 @@ class HTMLTest extends \PHPUnit_Framework_TestCase */ public function testConstruct() { - $object = new HTML(new PhpWord); + $object = new HTML(new PhpWord()); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object->getPhpWord()); } @@ -121,7 +121,7 @@ class HTMLTest extends \PHPUnit_Framework_TestCase $writer = new HTML($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/ODText/ElementTest.php b/tests/PhpWord/Writer/ODText/ElementTest.php index fb14aae5..0c2425e7 100644 --- a/tests/PhpWord/Writer/ODText/ElementTest.php +++ b/tests/PhpWord/Writer/ODText/ElementTest.php @@ -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\Writer\ODText; diff --git a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php index 90874b47..724a4b5f 100644 --- a/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/ODText/Part/AbstractPartTest.php @@ -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\Writer\ODText\Part; @@ -40,7 +40,7 @@ class AbstractPartTest extends \PHPUnit_Framework_TestCase /** * covers ::getParentWriter * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage No parent WriterInterface assigned. */ public function testSetGetParentWriterNull() diff --git a/tests/PhpWord/Writer/ODText/Part/ContentTest.php b/tests/PhpWord/Writer/ODText/Part/ContentTest.php index 5814fa60..e9fd994b 100644 --- a/tests/PhpWord/Writer/ODText/Part/ContentTest.php +++ b/tests/PhpWord/Writer/ODText/Part/ContentTest.php @@ -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\Writer\ODText\Part; diff --git a/tests/PhpWord/Writer/ODText/StyleTest.php b/tests/PhpWord/Writer/ODText/StyleTest.php index 6b979385..6369a09b 100644 --- a/tests/PhpWord/Writer/ODText/StyleTest.php +++ b/tests/PhpWord/Writer/ODText/StyleTest.php @@ -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\Writer\ODText; diff --git a/tests/PhpWord/Writer/ODTextTest.php b/tests/PhpWord/Writer/ODTextTest.php index e3027424..9877b700 100644 --- a/tests/PhpWord/Writer/ODTextTest.php +++ b/tests/PhpWord/Writer/ODTextTest.php @@ -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\Writer; @@ -90,7 +90,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase $writer = new ODText($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -138,7 +138,7 @@ class ODTextTest extends \PHPUnit_Framework_TestCase */ public function testSetUseDiskCachingException() { - $dir = join(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); + $dir = implode(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); $object = new ODText(); $object->setUseDiskCaching(true, $dir); diff --git a/tests/PhpWord/Writer/PDF/DomPDFTest.php b/tests/PhpWord/Writer/PDF/DomPDFTest.php index 67026a84..93189e49 100644 --- a/tests/PhpWord/Writer/PDF/DomPDFTest.php +++ b/tests/PhpWord/Writer/PDF/DomPDFTest.php @@ -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\Writer\PDF; @@ -45,7 +45,7 @@ class DomPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDF/MPDFTest.php b/tests/PhpWord/Writer/PDF/MPDFTest.php index b6c85a40..c77e785f 100644 --- a/tests/PhpWord/Writer/PDF/MPDFTest.php +++ b/tests/PhpWord/Writer/PDF/MPDFTest.php @@ -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\Writer\PDF; @@ -44,7 +44,7 @@ class MPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDF/TCPDFTest.php b/tests/PhpWord/Writer/PDF/TCPDFTest.php index aaec55eb..a92fea19 100644 --- a/tests/PhpWord/Writer/PDF/TCPDFTest.php +++ b/tests/PhpWord/Writer/PDF/TCPDFTest.php @@ -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\Writer\PDF; @@ -44,7 +44,7 @@ class TCPDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/PDFTest.php b/tests/PhpWord/Writer/PDFTest.php index 75db6c03..3a3ecdff 100644 --- a/tests/PhpWord/Writer/PDFTest.php +++ b/tests/PhpWord/Writer/PDFTest.php @@ -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\Writer; @@ -40,7 +40,7 @@ class PDFTest extends \PHPUnit_Framework_TestCase $writer = new PDF(new PhpWord()); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } diff --git a/tests/PhpWord/Writer/RTF/ElementTest.php b/tests/PhpWord/Writer/RTF/ElementTest.php index 47d01d00..ba0b34b4 100644 --- a/tests/PhpWord/Writer/RTF/ElementTest.php +++ b/tests/PhpWord/Writer/RTF/ElementTest.php @@ -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\Writer\RTF; diff --git a/tests/PhpWord/Writer/RTF/StyleTest.php b/tests/PhpWord/Writer/RTF/StyleTest.php index 095d30d5..1c94604e 100644 --- a/tests/PhpWord/Writer/RTF/StyleTest.php +++ b/tests/PhpWord/Writer/RTF/StyleTest.php @@ -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\Writer\RTF; diff --git a/tests/PhpWord/Writer/RTFTest.php b/tests/PhpWord/Writer/RTFTest.php index ff27229a..d2bd60e3 100644 --- a/tests/PhpWord/Writer/RTFTest.php +++ b/tests/PhpWord/Writer/RTFTest.php @@ -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\Writer; @@ -31,7 +31,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase */ public function testConstruct() { - $object = new RTF(new PhpWord); + $object = new RTF(new PhpWord()); $this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $object->getPhpWord()); } @@ -91,7 +91,7 @@ class RTFTest extends \PHPUnit_Framework_TestCase $writer = new RTF($phpWord); $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); @unlink($file); } diff --git a/tests/PhpWord/Writer/Word2007/ElementTest.php b/tests/PhpWord/Writer/Word2007/ElementTest.php index b3c7b197..a85cd628 100644 --- a/tests/PhpWord/Writer/Word2007/ElementTest.php +++ b/tests/PhpWord/Writer/Word2007/ElementTest.php @@ -11,15 +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\Writer\Word2007; use PhpOffice\Common\XMLWriter; +use PhpOffice\PhpWord\Element\TextRun; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Element\TextRun; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Element subnamespace @@ -186,7 +186,7 @@ class ElementTest extends \PHPUnit_Framework_TestCase $index = 0; foreach ($chartTypes as $chartType) { - $index++; + ++$index; $file = "word/charts/chart{$index}.xml"; $path = "/c:chartSpace/c:chart/c:plotArea/c:{$chartType}Chart"; $this->assertTrue($doc->elementExists($path, $file)); diff --git a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php index 8f72cdfe..85d8b139 100644 --- a/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/AbstractPartTest.php @@ -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\Writer\Word2007\Part; @@ -24,7 +24,7 @@ use PhpOffice\PhpWord\Writer\Word2007; * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Part\AbstractWriterPart * @runTestsInSeparateProcesses */ -class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase +class AbstractPartTest extends \PHPUnit_Framework_TestCase { /** * covers ::setParentWriter @@ -40,7 +40,7 @@ class AbstractWriterPartTest extends \PHPUnit_Framework_TestCase /** * covers ::getParentWriter * - * @expectedException Exception + * @expectedException \Exception * @expectedExceptionMessage No parent WriterInterface assigned. */ public function testSetGetParentWriterNull() diff --git a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php index aac4b15b..34213a01 100644 --- a/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/CommentsTest.php @@ -11,14 +11,13 @@ * 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\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Comment @@ -40,7 +39,6 @@ class CommentsTest extends \PHPUnit_Framework_TestCase */ public function testWriteComments() { - $comment = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); $comment->addText('Test'); @@ -55,7 +53,7 @@ class CommentsTest extends \PHPUnit_Framework_TestCase $element = $doc->getElement($path, $file); $this->assertNotNull($element->getAttribute('w:id')); - $this->assertEquals("Authors name", $element->getAttribute('w:author')); - $this->assertEquals("my_initials", $element->getAttribute('w:initials')); + $this->assertEquals('Authors name', $element->getAttribute('w:author')); + $this->assertEquals('my_initials', $element->getAttribute('w:initials')); } } diff --git a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php index d45cde6b..3dbc465d 100644 --- a/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/DocumentTest.php @@ -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\Writer\Word2007\Part; @@ -19,9 +19,9 @@ namespace PhpOffice\PhpWord\Writer\Word2007\Part; use PhpOffice\PhpWord\ComplexType\FootnoteProperties; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; +use PhpOffice\PhpWord\SimpleType\NumberFormat; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\SimpleType\NumberFormat; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Document @@ -458,7 +458,7 @@ class DocumentTest extends \PHPUnit_Framework_TestCase // Test the attributes $attributeCount = 0; foreach ($attributes as $key => $value) { - $attributeCount++; + ++$attributeCount; $nodeName = ($key == 'alignment') ? 'jc' : $key; $path = "/w:document/w:body/w:p[{$attributeCount}]/w:pPr/w:{$nodeName}"; if ('alignment' != $key) { diff --git a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php index 9a7d809a..6833b29e 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FooterTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FooterTest.php @@ -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\Writer\Word2007\Part; diff --git a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php index 2d48fe36..ae104a1c 100644 --- a/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/FootnotesTest.php @@ -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\Writer\Word2007\Part; diff --git a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php index 6c285af6..342e0d70 100644 --- a/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/HeaderTest.php @@ -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\Writer\Word2007\Part; diff --git a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php index bca4b562..54abcd96 100644 --- a/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/NumberingTest.php @@ -11,15 +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\Writer\Word2007\Part; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; -use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\SimpleType\NumberFormat; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Numbering @@ -64,7 +64,7 @@ class NumberingTest extends \PHPUnit_Framework_TestCase 'font' => 'Arial', 'hint' => 'default', ), - ) + ), ) ); diff --git a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php index 828e1283..9ff5c638 100644 --- a/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/SettingsTest.php @@ -11,16 +11,16 @@ * 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\Writer\Word2007\Part; +use PhpOffice\PhpWord\ComplexType\TrackChangesView; use PhpOffice\PhpWord\PhpWord; -use PhpOffice\PhpWord\TestHelperDOCX; use PhpOffice\PhpWord\Settings; use PhpOffice\PhpWord\SimpleType\Zoom; -use PhpOffice\PhpWord\ComplexType\TrackChangesView; +use PhpOffice\PhpWord\TestHelperDOCX; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Settings @@ -76,15 +76,15 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testLanguage() { $phpWord = new PhpWord(); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:themeFontLang'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - + $this->assertEquals('en-US', $element->getAttribute('w:val')); } @@ -95,15 +95,15 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $phpWord = new PhpWord(); $phpWord->getSettings()->setHideSpellingErrors(true); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:hideSpellingErrors'; $this->assertTrue($doc->elementExists($path, $file)); $element = $doc->getElement($path, $file); - + $this->assertNotEquals('false', $element->getAttribute('w:val')); } @@ -114,14 +114,14 @@ class SettingsTest extends \PHPUnit_Framework_TestCase { $phpWord = new PhpWord(); $phpWord->getSettings()->setEvenAndOddHeaders(true); - + $doc = TestHelperDOCX::getDocument($phpWord); - + $file = 'word/settings.xml'; - + $path = '/w:settings/w:evenAndOddHeaders'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertNotEquals('false', $element->getAttribute('w:val')); } @@ -140,7 +140,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $path = '/w:settings/w:zoom'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertEquals('75', $element->getAttribute('w:percent')); } @@ -159,7 +159,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $path = '/w:settings/w:zoom'; $this->assertTrue($doc->elementExists($path, $file)); - + $element = $doc->getElement($path, $file); $this->assertEquals('fullPage', $element->getAttribute('w:val')); } diff --git a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php index 0c0f7aef..827f633b 100644 --- a/tests/PhpWord/Writer/Word2007/Part/StylesTest.php +++ b/tests/PhpWord/Writer/Word2007/Part/StylesTest.php @@ -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\Writer\Word2007\Part; @@ -21,7 +21,6 @@ use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\TestHelperDOCX; -use PhpOffice\PhpWord\Writer\Word2007; /** * Test class for PhpOffice\PhpWord\Writer\Word2007\Part\Styles @@ -85,12 +84,12 @@ class StylesTest extends \PHPUnit_Framework_TestCase $baseParagraphStyle = new Paragraph(); $baseParagraphStyle->setAlignment(Jc::CENTER); $baseParagraphStyle = $phpWord->addParagraphStyle('BaseStyle', $baseParagraphStyle); - + $childFont = new Font(); $childFont->setParagraph($baseParagraphStyle); $childFont->setSize(16); $childFont = $phpWord->addFontStyle('ChildFontStyle', $childFont); - + $otherFont = new Font(); $otherFont->setSize(20); $otherFont = $phpWord->addFontStyle('OtherFontStyle', $otherFont); @@ -134,7 +133,7 @@ class StylesTest extends \PHPUnit_Framework_TestCase $styleGenerationEteinte->setParagraph($styleGenerationEteinteP); $styleGenerationEteinte->setSize(8.5); $phpWord->addFontStyle('GeneratEteinte', $styleGenerationEteinte); - + $doc = TestHelperDOCX::getDocument($phpWord); $file = 'word/styles.xml'; diff --git a/tests/PhpWord/Writer/Word2007/PartTest.php b/tests/PhpWord/Writer/Word2007/PartTest.php index 7af8ce3a..da836396 100644 --- a/tests/PhpWord/Writer/Word2007/PartTest.php +++ b/tests/PhpWord/Writer/Word2007/PartTest.php @@ -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\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007/Style/FontTest.php b/tests/PhpWord/Writer/Word2007/Style/FontTest.php index 50a7ecf7..764388dc 100644 --- a/tests/PhpWord/Writer/Word2007/Style/FontTest.php +++ b/tests/PhpWord/Writer/Word2007/Style/FontTest.php @@ -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\Writer\Word2007\Style; diff --git a/tests/PhpWord/Writer/Word2007/StyleTest.php b/tests/PhpWord/Writer/Word2007/StyleTest.php index dfabec03..7273dc33 100644 --- a/tests/PhpWord/Writer/Word2007/StyleTest.php +++ b/tests/PhpWord/Writer/Word2007/StyleTest.php @@ -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\Writer\Word2007; diff --git a/tests/PhpWord/Writer/Word2007Test.php b/tests/PhpWord/Writer/Word2007Test.php index 97f16c43..c17cb81d 100644 --- a/tests/PhpWord/Writer/Word2007Test.php +++ b/tests/PhpWord/Writer/Word2007Test.php @@ -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\Writer; @@ -96,7 +96,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase $file = __DIR__ . '/../_files/temp.docx'; $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -117,7 +117,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase $file = __DIR__ . '/../_files/temp.docx'; $writer->save($file); - $this->assertTrue(file_exists($file)); + $this->assertFileExists($file); unlink($file); } @@ -185,7 +185,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase */ public function testSetUseDiskCachingException() { - $dir = join(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); + $dir = implode(DIRECTORY_SEPARATOR, array(PHPWORD_TESTS_BASE_DIR, 'foo')); $object = new Word2007(); $object->setUseDiskCaching(true, $dir); diff --git a/tests/PhpWord/_includes/TestHelperDOCX.php b/tests/PhpWord/_includes/TestHelperDOCX.php index 03079974..1acf3561 100644 --- a/tests/PhpWord/_includes/TestHelperDOCX.php +++ b/tests/PhpWord/_includes/TestHelperDOCX.php @@ -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\CreateTemporaryFileException; @@ -29,7 +28,7 @@ class TestHelperDOCX * * @var string */ - static protected $file; + protected static $file; /** * Get document content @@ -39,9 +38,8 @@ class TestHelperDOCX * @param \PhpOffice\PhpWord\PhpWord $phpWord * @param string $writerName * - * @return \PhpOffice\PhpWord\XmlDocument - * * @throws \PhpOffice\PhpWord\Exception\CreateTemporaryFileException + * @return \PhpOffice\PhpWord\XmlDocument */ public static function getDocument(PhpWord $phpWord, $writerName = 'Word2007') { @@ -57,7 +55,7 @@ class TestHelperDOCX $xmlWriter = IOFactory::createWriter($phpWord, $writerName); $xmlWriter->save(self::$file); - $zip = new \ZipArchive; + $zip = new \ZipArchive(); $res = $zip->open(self::$file); if (true === $res) { $zip->extractTo(Settings::getTempDir() . '/PhpWord_Unit_Test/'); diff --git a/tests/PhpWord/_includes/XmlDocument.php b/tests/PhpWord/_includes/XmlDocument.php index 72b18c29..2c2f5c5f 100644 --- a/tests/PhpWord/_includes/XmlDocument.php +++ b/tests/PhpWord/_includes/XmlDocument.php @@ -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; /** @@ -25,7 +24,7 @@ class XmlDocument /** * Path * - * @var string $path + * @var string */ private $path; @@ -78,6 +77,7 @@ class XmlDocument $file = $this->path . '/' . $file; $this->dom = new \DOMDocument(); $this->dom->load($file); + return $this->dom; } @@ -96,7 +96,6 @@ class XmlDocument if (null === $this->xpath) { $this->xpath = new \DOMXpath($this->dom); - } return $this->xpath->query($path); @@ -159,6 +158,7 @@ class XmlDocument public function elementExists($path, $file = 'word/document.xml') { $nodeList = $this->getNodeList($path, $file); + return !($nodeList->length == 0); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 60ca5ae7..e75a1c34 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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 */ @@ -29,7 +29,7 @@ spl_autoload_register(function ($class) { $prefix = 'PhpOffice\\PhpWord'; if (strpos($class, $prefix) === 0) { $class = str_replace('\\', DIRECTORY_SEPARATOR, $class); - $class = join(DIRECTORY_SEPARATOR, array('PhpWord', '_includes')) . + $class = implode(DIRECTORY_SEPARATOR, array('PhpWord', '_includes')) . substr($class, strlen($prefix)); $file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php'; if (file_exists($file)) {