From 2bc75771ccdce9accdccf207c754cbcadab52746 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Fri, 16 Sep 2022 11:45:45 +0200 Subject: [PATCH] Use same code style as PhpSpreadsheet --- .php-cs-fixer.dist.php | 228 ++++++++ .php_cs.dist | 146 ----- samples/Sample_01_SimpleText.php | 39 +- samples/Sample_02_TabStops.php | 13 +- samples/Sample_03_Sections.php | 19 +- samples/Sample_04_Textrun.php | 17 +- samples/Sample_05_Multicolumn.php | 17 +- samples/Sample_06_Footnote.php | 11 +- samples/Sample_07_TemplateCloneRow.php | 37 +- samples/Sample_08_ParagraphPagination.php | 21 +- samples/Sample_09_Tables.php | 49 +- samples/Sample_10_EastAsianFontStyle.php | 5 +- samples/Sample_11_ReadWord2007.php | 1 + samples/Sample_11_ReadWord97.php | 1 + samples/Sample_12_HeaderFooter.php | 7 +- samples/Sample_13_Images.php | 61 ++- samples/Sample_14_ListItem.php | 47 +- samples/Sample_15_Link.php | 5 +- samples/Sample_16_Object.php | 1 + samples/Sample_17_TitleTOC.php | 15 +- samples/Sample_18_Watermark.php | 3 +- samples/Sample_19_TextBreak.php | 9 +- samples/Sample_20_BGColor.php | 7 +- samples/Sample_21_TableRowRules.php | 23 +- samples/Sample_22_CheckBox.php | 1 + samples/Sample_23_TemplateBlock.php | 3 +- samples/Sample_24_ReadODText.php | 1 + samples/Sample_25_TextBox.php | 21 +- samples/Sample_26_Html.php | 3 +- samples/Sample_27_Field.php | 31 +- samples/Sample_28_ReadRTF.php | 1 + samples/Sample_29_Line.php | 53 +- samples/Sample_30_ReadHTML.php | 1 + samples/Sample_31_Shape.php | 81 +-- samples/Sample_32_Chart.php | 43 +- samples/Sample_33_FormField.php | 3 +- samples/Sample_34_SDT.php | 5 +- samples/Sample_35_InternalLink.php | 1 + samples/Sample_36_RTL.php | 15 +- samples/Sample_37_Comments.php | 11 +- samples/Sample_38_Protection.php | 1 + samples/Sample_39_TrackChanges.php | 3 +- samples/Sample_40_TemplateSetComplexValue.php | 13 +- samples/Sample_41_TemplateSetChart.php | 19 +- samples/Sample_Header.php | 11 +- samples/index.php | 22 +- src/PhpWord/Collection/AbstractCollection.php | 20 +- src/PhpWord/Collection/Bookmarks.php | 4 +- src/PhpWord/Collection/Charts.php | 4 +- src/PhpWord/Collection/Comments.php | 4 +- src/PhpWord/Collection/Endnotes.php | 4 +- src/PhpWord/Collection/Footnotes.php | 4 +- src/PhpWord/Collection/Titles.php | 4 +- .../ComplexType/FootnoteProperties.php | 47 +- src/PhpWord/ComplexType/ProofState.php | 30 +- src/PhpWord/ComplexType/TblWidth.php | 2 +- src/PhpWord/ComplexType/TrackChangesView.php | 46 +- src/PhpWord/Element/AbstractContainer.php | 128 ++--- src/PhpWord/Element/AbstractElement.php | 142 +++-- src/PhpWord/Element/Bookmark.php | 12 +- src/PhpWord/Element/Cell.php | 16 +- src/PhpWord/Element/Chart.php | 38 +- src/PhpWord/Element/CheckBox.php | 13 +- src/PhpWord/Element/Comment.php | 33 +- src/PhpWord/Element/Endnote.php | 8 +- src/PhpWord/Element/Field.php | 158 +++--- src/PhpWord/Element/Footer.php | 24 +- src/PhpWord/Element/Footnote.php | 24 +- src/PhpWord/Element/FormField.php | 61 ++- src/PhpWord/Element/Header.php | 7 +- src/PhpWord/Element/Image.php | 117 ++-- src/PhpWord/Element/Line.php | 10 +- src/PhpWord/Element/Link.php | 44 +- src/PhpWord/Element/ListItem.php | 25 +- src/PhpWord/Element/ListItemRun.php | 38 +- src/PhpWord/Element/OLEObject.php | 36 +- src/PhpWord/Element/PageBreak.php | 6 +- src/PhpWord/Element/PreserveText.php | 30 +- src/PhpWord/Element/Row.php | 25 +- src/PhpWord/Element/SDT.php | 51 +- src/PhpWord/Element/Section.php | 64 +-- src/PhpWord/Element/Shape.php | 19 +- src/PhpWord/Element/TOC.php | 34 +- src/PhpWord/Element/Table.php | 40 +- src/PhpWord/Element/Text.php | 45 +- src/PhpWord/Element/TextBox.php | 10 +- src/PhpWord/Element/TextBreak.php | 46 +- src/PhpWord/Element/TextRun.php | 23 +- src/PhpWord/Element/Title.php | 23 +- src/PhpWord/Element/TrackChange.php | 29 +- src/PhpWord/Escaper/AbstractEscaper.php | 2 +- src/PhpWord/Escaper/EscaperInterface.php | 2 +- src/PhpWord/Escaper/RegExp.php | 2 +- src/PhpWord/Escaper/Rtf.php | 7 +- src/PhpWord/Escaper/Xml.php | 4 +- src/PhpWord/Exception/CopyFileException.php | 4 +- .../CreateTemporaryFileException.php | 4 +- src/PhpWord/Exception/Exception.php | 4 +- .../Exception/InvalidImageException.php | 4 +- .../Exception/InvalidObjectException.php | 4 +- .../Exception/InvalidStyleException.php | 4 +- .../UnsupportedImageTypeException.php | 4 +- src/PhpWord/IOFactory.php | 29 +- src/PhpWord/Media.php | 85 +-- src/PhpWord/Metadata/Compatibility.php | 12 +- src/PhpWord/Metadata/DocInfo.php | 159 +++--- src/PhpWord/Metadata/Protection.php | 44 +- src/PhpWord/Metadata/Settings.php | 112 ++-- src/PhpWord/PhpWord.php | 115 ++-- src/PhpWord/Reader/AbstractReader.php | 16 +- src/PhpWord/Reader/HTML.php | 11 +- src/PhpWord/Reader/MsDoc.php | 384 ++++++++----- src/PhpWord/Reader/ODText.php | 23 +- src/PhpWord/Reader/ODText/AbstractPart.php | 5 +- src/PhpWord/Reader/ODText/Content.php | 22 +- src/PhpWord/Reader/ODText/Meta.php | 23 +- src/PhpWord/Reader/RTF.php | 11 +- src/PhpWord/Reader/RTF/Document.php | 130 ++--- src/PhpWord/Reader/ReaderInterface.php | 7 +- src/PhpWord/Reader/Word2007.php | 53 +- src/PhpWord/Reader/Word2007/AbstractPart.php | 319 ++++++----- src/PhpWord/Reader/Word2007/DocPropsApp.php | 12 +- src/PhpWord/Reader/Word2007/DocPropsCore.php | 34 +- .../Reader/Word2007/DocPropsCustom.php | 8 +- src/PhpWord/Reader/Word2007/Document.php | 78 ++- src/PhpWord/Reader/Word2007/Endnotes.php | 8 +- src/PhpWord/Reader/Word2007/Footnotes.php | 20 +- src/PhpWord/Reader/Word2007/Numbering.php | 28 +- src/PhpWord/Reader/Word2007/Settings.php | 67 +-- src/PhpWord/Reader/Word2007/Styles.php | 15 +- src/PhpWord/Settings.php | 103 ++-- src/PhpWord/Shared/AbstractEnum.php | 28 +- src/PhpWord/Shared/Converter.php | 99 ++-- src/PhpWord/Shared/Drawing.php | 55 +- src/PhpWord/Shared/Html.php | 386 +++++++------ .../Shared/Microsoft/PasswordEncoder.php | 104 ++-- src/PhpWord/Shared/Text.php | 58 +- src/PhpWord/Shared/XMLReader.php | 107 ++-- src/PhpWord/Shared/XMLWriter.php | 34 +- src/PhpWord/Shared/ZipArchive.php | 83 +-- src/PhpWord/SimpleType/Border.php | 3 +- src/PhpWord/SimpleType/DocProtect.php | 15 +- src/PhpWord/SimpleType/Jc.php | 3 +- src/PhpWord/SimpleType/JcTable.php | 2 +- src/PhpWord/SimpleType/LineSpacingRule.php | 11 +- src/PhpWord/SimpleType/NumberFormat.php | 3 +- src/PhpWord/SimpleType/TblWidth.php | 5 +- src/PhpWord/SimpleType/TextAlignment.php | 5 +- src/PhpWord/SimpleType/VerticalJc.php | 2 +- src/PhpWord/SimpleType/Zoom.php | 5 +- src/PhpWord/Style.php | 49 +- src/PhpWord/Style/AbstractStyle.php | 99 ++-- src/PhpWord/Style/Border.php | 143 ++--- src/PhpWord/Style/Cell.php | 78 +-- src/PhpWord/Style/Chart.php | 140 ++--- src/PhpWord/Style/Extrusion.php | 26 +- src/PhpWord/Style/Fill.php | 15 +- src/PhpWord/Style/Font.php | 306 ++++++----- src/PhpWord/Style/Frame.php | 178 +++--- src/PhpWord/Style/Image.php | 64 +-- src/PhpWord/Style/Indentation.php | 60 +- src/PhpWord/Style/Language.php | 55 +- src/PhpWord/Style/Line.php | 75 +-- src/PhpWord/Style/LineNumbering.php | 45 +- src/PhpWord/Style/ListItem.php | 108 ++-- src/PhpWord/Style/Numbering.php | 31 +- src/PhpWord/Style/NumberingLevel.php | 101 ++-- src/PhpWord/Style/Outline.php | 91 ++-- src/PhpWord/Style/Paper.php | 43 +- src/PhpWord/Style/Paragraph.php | 240 ++++---- src/PhpWord/Style/Row.php | 33 +- src/PhpWord/Style/Section.php | 199 ++++--- src/PhpWord/Style/Shading.php | 37 +- src/PhpWord/Style/Shadow.php | 22 +- src/PhpWord/Style/Shape.php | 64 ++- src/PhpWord/Style/Spacing.php | 63 ++- src/PhpWord/Style/TOC.php | 35 +- src/PhpWord/Style/Tab.php | 51 +- src/PhpWord/Style/Table.php | 175 +++--- src/PhpWord/Style/TablePosition.php | 122 +++-- src/PhpWord/Style/TextBox.php | 58 +- src/PhpWord/Template.php | 2 +- src/PhpWord/TemplateProcessor.php | 238 ++++---- src/PhpWord/Writer/AbstractWriter.php | 92 ++-- src/PhpWord/Writer/HTML.php | 30 +- .../Writer/HTML/Element/AbstractElement.php | 18 +- src/PhpWord/Writer/HTML/Element/Bookmark.php | 6 +- src/PhpWord/Writer/HTML/Element/Container.php | 10 +- src/PhpWord/Writer/HTML/Element/Endnote.php | 6 +- src/PhpWord/Writer/HTML/Element/Footnote.php | 8 +- src/PhpWord/Writer/HTML/Element/Image.php | 6 +- src/PhpWord/Writer/HTML/Element/Link.php | 6 +- src/PhpWord/Writer/HTML/Element/ListItem.php | 6 +- .../Writer/HTML/Element/ListItemRun.php | 6 +- src/PhpWord/Writer/HTML/Element/PageBreak.php | 6 +- src/PhpWord/Writer/HTML/Element/Table.php | 27 +- src/PhpWord/Writer/HTML/Element/Text.php | 32 +- src/PhpWord/Writer/HTML/Element/TextBreak.php | 6 +- src/PhpWord/Writer/HTML/Element/TextRun.php | 6 +- src/PhpWord/Writer/HTML/Element/Title.php | 6 +- src/PhpWord/Writer/HTML/Part/AbstractPart.php | 7 +- src/PhpWord/Writer/HTML/Part/Body.php | 10 +- src/PhpWord/Writer/HTML/Part/Head.php | 64 +-- .../Writer/HTML/Style/AbstractStyle.php | 26 +- src/PhpWord/Writer/HTML/Style/Font.php | 10 +- src/PhpWord/Writer/HTML/Style/Generic.php | 8 +- src/PhpWord/Writer/HTML/Style/Image.php | 8 +- src/PhpWord/Writer/HTML/Style/Paragraph.php | 18 +- src/PhpWord/Writer/ODText.php | 30 +- .../Writer/ODText/Element/AbstractElement.php | 4 +- .../Writer/ODText/Element/Container.php | 6 +- src/PhpWord/Writer/ODText/Element/Field.php | 12 +- src/PhpWord/Writer/ODText/Element/Image.php | 8 +- src/PhpWord/Writer/ODText/Element/Link.php | 8 +- .../Writer/ODText/Element/PageBreak.php | 8 +- src/PhpWord/Writer/ODText/Element/Table.php | 22 +- src/PhpWord/Writer/ODText/Element/Text.php | 13 +- .../Writer/ODText/Element/TextBreak.php | 8 +- src/PhpWord/Writer/ODText/Element/TextRun.php | 8 +- src/PhpWord/Writer/ODText/Element/Title.php | 11 +- .../Writer/ODText/Part/AbstractPart.php | 16 +- src/PhpWord/Writer/ODText/Part/Content.php | 69 ++- src/PhpWord/Writer/ODText/Part/Manifest.php | 8 +- src/PhpWord/Writer/ODText/Part/Meta.php | 13 +- src/PhpWord/Writer/ODText/Part/Mimetype.php | 6 +- src/PhpWord/Writer/ODText/Part/Styles.php | 43 +- .../Writer/ODText/Style/AbstractStyle.php | 4 +- src/PhpWord/Writer/ODText/Style/Font.php | 6 +- src/PhpWord/Writer/ODText/Style/Image.php | 6 +- src/PhpWord/Writer/ODText/Style/Paragraph.php | 6 +- src/PhpWord/Writer/ODText/Style/Section.php | 6 +- src/PhpWord/Writer/ODText/Style/Table.php | 8 +- src/PhpWord/Writer/PDF.php | 21 +- src/PhpWord/Writer/PDF/AbstractRenderer.php | 50 +- src/PhpWord/Writer/PDF/DomPDF.php | 10 +- src/PhpWord/Writer/PDF/MPDF.php | 12 +- src/PhpWord/Writer/PDF/TCPDF.php | 9 +- src/PhpWord/Writer/RTF.php | 22 +- .../Writer/RTF/Element/AbstractElement.php | 19 +- src/PhpWord/Writer/RTF/Element/Container.php | 6 +- src/PhpWord/Writer/RTF/Element/Field.php | 4 +- src/PhpWord/Writer/RTF/Element/Image.php | 6 +- src/PhpWord/Writer/RTF/Element/Link.php | 6 +- src/PhpWord/Writer/RTF/Element/ListItem.php | 4 +- src/PhpWord/Writer/RTF/Element/PageBreak.php | 6 +- src/PhpWord/Writer/RTF/Element/Table.php | 23 +- src/PhpWord/Writer/RTF/Element/Text.php | 8 +- src/PhpWord/Writer/RTF/Element/TextBreak.php | 6 +- src/PhpWord/Writer/RTF/Element/TextRun.php | 6 +- src/PhpWord/Writer/RTF/Element/Title.php | 10 +- src/PhpWord/Writer/RTF/Part/AbstractPart.php | 6 +- src/PhpWord/Writer/RTF/Part/Document.php | 40 +- src/PhpWord/Writer/RTF/Part/Header.php | 34 +- .../Writer/RTF/Style/AbstractStyle.php | 4 +- src/PhpWord/Writer/RTF/Style/Border.php | 25 +- src/PhpWord/Writer/RTF/Style/Font.php | 11 +- src/PhpWord/Writer/RTF/Style/Indentation.php | 6 +- src/PhpWord/Writer/RTF/Style/Paragraph.php | 30 +- src/PhpWord/Writer/RTF/Style/Section.php | 6 +- src/PhpWord/Writer/RTF/Style/Tab.php | 12 +- src/PhpWord/Writer/Word2007.php | 110 ++-- .../Word2007/Element/AbstractElement.php | 54 +- .../Writer/Word2007/Element/Bookmark.php | 8 +- src/PhpWord/Writer/Word2007/Element/Chart.php | 10 +- .../Writer/Word2007/Element/CheckBox.php | 6 +- .../Writer/Word2007/Element/Container.php | 15 +- .../Writer/Word2007/Element/Endnote.php | 6 +- src/PhpWord/Writer/Word2007/Element/Field.php | 24 +- .../Writer/Word2007/Element/Footnote.php | 8 +- .../Writer/Word2007/Element/FormField.php | 21 +- src/PhpWord/Writer/Word2007/Element/Image.php | 10 +- src/PhpWord/Writer/Word2007/Element/Line.php | 6 +- src/PhpWord/Writer/Word2007/Element/Link.php | 6 +- .../Writer/Word2007/Element/ListItem.php | 6 +- .../Writer/Word2007/Element/ListItemRun.php | 20 +- .../Writer/Word2007/Element/OLEObject.php | 6 +- .../Writer/Word2007/Element/PageBreak.php | 6 +- .../Word2007/Element/ParagraphAlignment.php | 4 +- .../Writer/Word2007/Element/PreserveText.php | 8 +- src/PhpWord/Writer/Word2007/Element/SDT.php | 26 +- src/PhpWord/Writer/Word2007/Element/Shape.php | 47 +- src/PhpWord/Writer/Word2007/Element/TOC.php | 29 +- src/PhpWord/Writer/Word2007/Element/Table.php | 23 +- .../Word2007/Element/TableAlignment.php | 4 +- src/PhpWord/Writer/Word2007/Element/Text.php | 14 +- .../Writer/Word2007/Element/TextBox.php | 6 +- .../Writer/Word2007/Element/TextBreak.php | 6 +- .../Writer/Word2007/Element/TextRun.php | 6 +- src/PhpWord/Writer/Word2007/Element/Title.php | 6 +- .../Writer/Word2007/Part/AbstractPart.php | 23 +- src/PhpWord/Writer/Word2007/Part/Chart.php | 112 ++-- src/PhpWord/Writer/Word2007/Part/Comments.php | 16 +- .../Writer/Word2007/Part/ContentTypes.php | 34 +- .../Writer/Word2007/Part/DocPropsApp.php | 6 +- .../Writer/Word2007/Part/DocPropsCore.php | 6 +- .../Writer/Word2007/Part/DocPropsCustom.php | 15 +- src/PhpWord/Writer/Word2007/Part/Document.php | 18 +- src/PhpWord/Writer/Word2007/Part/Endnotes.php | 12 +- .../Writer/Word2007/Part/FontTable.php | 5 +- src/PhpWord/Writer/Word2007/Part/Footer.php | 13 +- .../Writer/Word2007/Part/Footnotes.php | 28 +- src/PhpWord/Writer/Word2007/Part/Header.php | 6 +- .../Writer/Word2007/Part/Numbering.php | 42 +- src/PhpWord/Writer/Word2007/Part/Rels.php | 35 +- .../Writer/Word2007/Part/RelsDocument.php | 20 +- src/PhpWord/Writer/Word2007/Part/RelsPart.php | 15 +- src/PhpWord/Writer/Word2007/Part/Settings.php | 200 +++---- src/PhpWord/Writer/Word2007/Part/Styles.php | 34 +- src/PhpWord/Writer/Word2007/Part/Theme.php | 21 +- .../Writer/Word2007/Part/WebSettings.php | 10 +- .../Writer/Word2007/Style/AbstractStyle.php | 53 +- src/PhpWord/Writer/Word2007/Style/Cell.php | 24 +- .../Writer/Word2007/Style/Extrusion.php | 6 +- src/PhpWord/Writer/Word2007/Style/Fill.php | 6 +- src/PhpWord/Writer/Word2007/Style/Font.php | 16 +- src/PhpWord/Writer/Word2007/Style/Frame.php | 58 +- src/PhpWord/Writer/Word2007/Style/Image.php | 4 +- .../Writer/Word2007/Style/Indentation.php | 10 +- src/PhpWord/Writer/Word2007/Style/Line.php | 23 +- .../Writer/Word2007/Style/LineNumbering.php | 8 +- .../Writer/Word2007/Style/MarginBorder.php | 37 +- src/PhpWord/Writer/Word2007/Style/Outline.php | 6 +- .../Writer/Word2007/Style/Paragraph.php | 24 +- src/PhpWord/Writer/Word2007/Style/Row.php | 8 +- src/PhpWord/Writer/Word2007/Style/Section.php | 34 +- src/PhpWord/Writer/Word2007/Style/Shading.php | 12 +- src/PhpWord/Writer/Word2007/Style/Shadow.php | 6 +- src/PhpWord/Writer/Word2007/Style/Shape.php | 8 +- src/PhpWord/Writer/Word2007/Style/Spacing.php | 14 +- src/PhpWord/Writer/Word2007/Style/Tab.php | 6 +- src/PhpWord/Writer/Word2007/Style/Table.php | 51 +- .../Writer/Word2007/Style/TablePosition.php | 32 +- src/PhpWord/Writer/Word2007/Style/TextBox.php | 8 +- src/PhpWord/Writer/WriterInterface.php | 6 +- tests/PhpWord/Collection/CollectionTest.php | 18 +- .../ComplexType/FootnotePropertiesTest.php | 36 +- tests/PhpWord/ComplexType/ProofStateTest.php | 26 +- tests/PhpWord/Element/AbstractElementTest.php | 18 +- tests/PhpWord/Element/BookmarkTest.php | 12 +- tests/PhpWord/Element/CellTest.php | 165 +++--- tests/PhpWord/Element/CheckBoxTest.php | 50 +- tests/PhpWord/Element/CommentTest.php | 71 +-- tests/PhpWord/Element/FieldTest.php | 120 ++-- tests/PhpWord/Element/FooterTest.php | 106 ++-- tests/PhpWord/Element/FootnoteTest.php | 64 +-- tests/PhpWord/Element/HeaderTest.php | 155 +++--- tests/PhpWord/Element/ImageTest.php | 194 +++---- tests/PhpWord/Element/LineTest.php | 53 +- tests/PhpWord/Element/LinkTest.php | 53 +- tests/PhpWord/Element/ListItemRunTest.php | 118 ++-- tests/PhpWord/Element/ListItemTest.php | 29 +- tests/PhpWord/Element/ObjectTest.php | 57 +- tests/PhpWord/Element/PageBreakTest.php | 11 +- tests/PhpWord/Element/PreserveTextTest.php | 36 +- tests/PhpWord/Element/RowTest.php | 39 +- tests/PhpWord/Element/SDTTest.php | 40 +- tests/PhpWord/Element/SectionTest.php | 83 +-- tests/PhpWord/Element/TOCTest.php | 54 +- tests/PhpWord/Element/TableTest.php | 63 +-- tests/PhpWord/Element/TextBoxTest.php | 41 +- tests/PhpWord/Element/TextBreakTest.php | 41 +- tests/PhpWord/Element/TextRunTest.php | 122 ++--- tests/PhpWord/Element/TextTest.php | 48 +- tests/PhpWord/Element/TitleTest.php | 31 +- tests/PhpWord/Element/TrackChangeTest.php | 32 +- tests/PhpWord/Escaper/RtfEscaper2Test.php | 28 +- .../Exception/CopyFileExceptionTest.php | 7 +- .../CreateTemporaryFileExceptionTest.php | 7 +- tests/PhpWord/Exception/ExceptionTest.php | 10 +- .../Exception/InvalidImageExceptionTest.php | 10 +- .../Exception/InvalidStyleExceptionTest.php | 10 +- .../UnsupportedImageTypeExceptionTest.php | 10 +- tests/PhpWord/IOFactoryTest.php | 30 +- tests/PhpWord/MediaTest.php | 65 +-- tests/PhpWord/Metadata/DocInfoTest.php | 170 +++--- tests/PhpWord/Metadata/SettingsTest.php | 123 ++--- tests/PhpWord/PhpWordTest.php | 119 ++-- tests/PhpWord/Reader/HTMLTest.php | 18 +- tests/PhpWord/Reader/MsDocTest.php | 36 +- tests/PhpWord/Reader/ODTextTest.php | 11 +- tests/PhpWord/Reader/RTFTest.php | 18 +- tests/PhpWord/Reader/Word2007/ElementTest.php | 132 ++--- tests/PhpWord/Reader/Word2007/PartTest.php | 66 +-- tests/PhpWord/Reader/Word2007/StyleTest.php | 124 ++--- tests/PhpWord/Reader/Word2007Test.php | 39 +- tests/PhpWord/SettingsTest.php | 195 +++---- tests/PhpWord/Shared/ConverterTest.php | 102 ++-- tests/PhpWord/Shared/DrawingTest.php | 108 ++-- tests/PhpWord/Shared/HtmlTest.php | 515 +++++++++--------- .../Shared/Microsoft/PasswordEncoderTest.php | 29 +- tests/PhpWord/Shared/TextTest.php | 74 +-- tests/PhpWord/Shared/XMLReaderTest.php | 79 +-- tests/PhpWord/Shared/XMLWriterTest.php | 18 +- tests/PhpWord/Shared/ZipArchiveTest.php | 38 +- tests/PhpWord/Style/AbstractStyleTest.php | 56 +- tests/PhpWord/Style/CellTest.php | 57 +- tests/PhpWord/Style/ChartTest.php | 139 ++--- tests/PhpWord/Style/FontTest.php | 162 +++--- tests/PhpWord/Style/ImageTest.php | 78 +-- tests/PhpWord/Style/IndentationTest.php | 26 +- tests/PhpWord/Style/LanguageTest.php | 37 +- tests/PhpWord/Style/LineNumberingTest.php | 26 +- tests/PhpWord/Style/LineTest.php | 87 +-- tests/PhpWord/Style/ListItemTest.php | 29 +- tests/PhpWord/Style/NumberingLevelTest.php | 38 +- tests/PhpWord/Style/NumberingTest.php | 28 +- tests/PhpWord/Style/PaperTest.php | 34 +- tests/PhpWord/Style/ParagraphTest.php | 112 ++-- tests/PhpWord/Style/RowTest.php | 35 +- tests/PhpWord/Style/SectionTest.php | 261 ++++----- tests/PhpWord/Style/ShadingTest.php | 24 +- tests/PhpWord/Style/SpacingTest.php | 26 +- tests/PhpWord/Style/TOCTest.php | 24 +- tests/PhpWord/Style/TabTest.php | 24 +- tests/PhpWord/Style/TablePositionTest.php | 42 +- tests/PhpWord/Style/TableTest.php | 156 +++--- tests/PhpWord/Style/TextBoxTest.php | 204 +++---- tests/PhpWord/StyleTest.php | 77 ++- tests/PhpWord/TemplateProcessorTest.php | 334 ++++++------ tests/PhpWord/Writer/HTML/ElementTest.php | 107 ++-- tests/PhpWord/Writer/HTML/PartTest.php | 8 +- tests/PhpWord/Writer/HTML/StyleTest.php | 12 +- tests/PhpWord/Writer/HTMLTest.php | 40 +- .../Writer/ODText/Element/ImageTest.php | 30 +- tests/PhpWord/Writer/ODText/ElementTest.php | 138 ++--- .../Writer/ODText/Part/AbstractPartTest.php | 17 +- .../Writer/ODText/Part/ContentTest.php | 34 +- .../PhpWord/Writer/ODText/Style/FontTest.php | 212 +++---- .../Writer/ODText/Style/ParagraphTest.php | 374 ++++++------- .../Writer/ODText/Style/SectionTest.php | 202 +++---- tests/PhpWord/Writer/ODText/StyleTest.php | 12 +- tests/PhpWord/Writer/ODTextTest.php | 60 +- tests/PhpWord/Writer/PDF/DomPDFTest.php | 22 +- tests/PhpWord/Writer/PDF/MPDFTest.php | 10 +- tests/PhpWord/Writer/PDF/TCPDFTest.php | 10 +- tests/PhpWord/Writer/PDFTest.php | 14 +- tests/PhpWord/Writer/RTF/ElementTest.php | 54 +- tests/PhpWord/Writer/RTF/HeaderFooterTest.php | 40 +- tests/PhpWord/Writer/RTF/StyleTest.php | 48 +- tests/PhpWord/Writer/RTFTest.php | 38 +- .../Writer/Word2007/Element/ChartTest.php | 120 ++-- .../Writer/Word2007/Element/FormFieldTest.php | 34 +- tests/PhpWord/Writer/Word2007/ElementTest.php | 363 ++++++------ .../Writer/Word2007/Part/AbstractPartTest.php | 18 +- .../Writer/Word2007/Part/CommentsTest.php | 23 +- .../Writer/Word2007/Part/DocumentTest.php | 323 +++++------ .../Writer/Word2007/Part/FooterTest.php | 11 +- .../Writer/Word2007/Part/FootnotesTest.php | 15 +- .../Writer/Word2007/Part/HeaderTest.php | 10 +- .../Writer/Word2007/Part/NumberingTest.php | 50 +- .../Writer/Word2007/Part/SettingsTest.php | 188 +++---- .../Writer/Word2007/Part/StylesTest.php | 43 +- tests/PhpWord/Writer/Word2007/PartTest.php | 10 +- .../Writer/Word2007/Style/FontTest.php | 93 ++-- .../Writer/Word2007/Style/ImageTest.php | 79 +-- .../Writer/Word2007/Style/ParagraphTest.php | 43 +- .../Writer/Word2007/Style/SectionTest.php | 19 +- .../Writer/Word2007/Style/TableTest.php | 89 +-- tests/PhpWord/Writer/Word2007/StyleTest.php | 30 +- tests/PhpWord/Writer/Word2007Test.php | 98 ++-- .../PhpWord/_includes/AbstractTestReader.php | 30 +- .../AbstractWebServerEmbeddedTest.php | 2 +- tests/PhpWord/_includes/TestHelperDOCX.php | 22 +- .../_includes/TestableTemplateProcesor.php | 4 +- tests/PhpWord/_includes/XmlDocument.php | 66 ++- tests/bootstrap.php | 6 +- 466 files changed, 10885 insertions(+), 10175 deletions(-) create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .php_cs.dist diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000000..14d58dac68 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,228 @@ +notName('pclzip.lib.php') + ->notName('OLERead.php') + ->in('samples') + ->in('src') + ->in('tests'); + +$config = new PhpCsFixer\Config(); +$config + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__)) + ->setRules([ + 'align_multiline_comment' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'backtick_to_shell_exec' => true, + 'binary_operator_spaces' => true, + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => true, + 'braces' => true, + 'cast_spaces' => true, + 'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const + 'class_definition' => false, + 'class_keyword_remove' => false, // ::class keyword gives us better support in IDE + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => false, // interferes with annotations + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => true, + 'date_time_immutable' => false, // Break our unit tests + 'declare_equal_normalize' => true, + 'declare_strict_types' => false, // Too early to adopt strict types + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => true, + 'doctrine_annotation_braces' => true, + 'doctrine_annotation_indentation' => true, + 'doctrine_annotation_spaces' => true, + 'elseif' => true, + 'encoding' => true, + 'ereg_to_preg' => true, + 'escape_implicit_backslashes' => true, + 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read + 'explicit_string_variable' => false, // I feel it makes the code actually harder to read + 'final_class' => false, // We need non-final classes + 'final_internal_class' => true, + 'final_public_method_for_abstract_class' => false, // We need non-final methods + 'fopen_flag_order' => true, + 'fopen_flags' => true, + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, + 'function_declaration' => true, + 'function_to_constant' => true, + 'function_typehint_space' => true, + 'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']], + 'global_namespace_import' => true, + 'header_comment' => false, // We don't use common header in all our files + 'heredoc_indentation' => false, // Requires PHP >= 7.3 + 'heredoc_to_nowdoc' => false, // Not sure about this one + 'implode_call' => true, + 'include' => true, + 'increment_style' => true, + 'indentation_type' => true, + 'is_null' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => true, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'mb_str_functions' => false, // No, too dangerous to change that + 'method_argument_space' => true, + 'method_chaining_indentation' => true, + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => true, + 'native_constant_invocation' => false, // Micro optimization that look messy + 'native_function_casing' => true, + 'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it + 'native_function_type_declaration_casing' => true, + 'new_with_braces' => true, + 'no_alias_functions' => true, + 'no_alternative_syntax' => true, + 'no_binary_string' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace + 'no_break_comment' => true, + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_php4_constructor' => true, + 'no_short_bool_cast' => true, + 'echo_tag_syntax' => ['format' => 'long'], + 'no_singleline_whitespace_before_semicolons' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => true, + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => false, // Might be risky on a huge code base + 'no_superfluous_phpdoc_tags' => ['allow_mixed' => true], + 'no_trailing_comma_in_list_call' => true, + 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unneeded_curly_braces' => true, + 'no_unneeded_final_method' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces + 'not_operator_with_successor_space' => false, // idem + 'nullable_type_declaration_for_default_null_value' => true, + 'object_operator_without_whitespace' => true, + 'ordered_class_elements' => false, // We prefer to keep some freedom + 'ordered_imports' => true, + 'ordered_interfaces' => true, + 'php_unit_construct' => true, + 'php_unit_dedicate_assert' => true, + 'php_unit_dedicate_assert_internal_type' => true, + 'php_unit_expectation' => true, + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => false, // Because tests are excluded from package + 'php_unit_method_casing' => true, + 'php_unit_mock' => true, + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => true, + 'php_unit_no_expectation_annotation' => true, + 'phpdoc_order_by_value' => ['annotations' => ['covers']], + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, // That seems extra work to maintain for little benefits + 'php_unit_strict' => false, // We sometime actually need assertEquals + 'php_unit_test_annotation' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage + 'phpdoc_add_missing_param_annotation' => false, // Don't add things that bring no value + 'phpdoc_align' => false, // Waste of time + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_indent' => true, + //'phpdoc_inline_tag' => true, + 'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this + 'phpdoc_no_access' => true, + 'phpdoc_no_alias_tag' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_return_self_reference' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => true, + 'phpdoc_to_comment' => false, // interferes with annotations + 'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use + 'phpdoc_to_return_type' => false, // idem + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => true, + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + //'psr0' => true, + //'psr4' => true, + 'random_api_migration' => true, + 'return_assignment' => false, // Sometimes useful for clarity or debug + 'return_type_declaration' => true, + 'self_accessor' => true, + 'self_static_accessor' => true, + 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages + 'simplified_null_return' => false, // Even if technically correct we prefer to be explicit + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => true, + 'single_import_per_statement' => true, + 'single_line_after_imports' => true, + 'single_line_comment_style' => true, + 'single_line_throw' => false, // I don't see any reason for having a special case for Exception + 'single_quote' => true, + 'single_trait_insert_per_statement' => true, + 'space_after_semicolon' => true, + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` + 'strict_comparison' => false, // No, too dangerous to change that + 'strict_param' => false, // No, too dangerous to change that + 'string_line_ending' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => true, + 'trim_array_spaces' => true, + 'unary_operator_spaces' => true, + 'visibility_required' => ['elements' => ['property', 'method']], // not const + 'void_return' => true, + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => false, + ]); + +return $config; diff --git a/.php_cs.dist b/.php_cs.dist deleted file mode 100644 index 895ed80f56..0000000000 --- a/.php_cs.dist +++ /dev/null @@ -1,146 +0,0 @@ -notName('pclzip.lib.php') - ->notName('OLERead.php') - ->in('samples') - ->in('src') - ->in('tests'); - -return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setFinder($finder) - ->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' => 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' => array('spacing' => 'one'), - 'declare_equal_normalize' => true, - 'declare_strict_types' => false, // Too early to adopt strict types - 'dir_constant' => true, - 'elseif' => true, - 'encoding' => true, - 'ereg_to_preg' => true, - 'full_opening_tag' => true, - 'function_declaration' => true, - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => false, // No use for that - 'hash_to_slash_comment' => true, - 'header_comment' => false, // We don't use common header in all our files - 'heredoc_to_nowdoc' => false, // Not sure about this one - 'is_null' => false, // Risky - 'include' => true, - 'indentation_type' => true, - 'line_ending' => true, - 'linebreak_after_opening_tag' => true, - 'lowercase_cast' => true, - 'lowercase_constants' => true, - 'lowercase_keywords' => true, - 'mb_str_functions' => false, // No, too dangerous to change that - 'method_argument_space' => true, - 'method_separation' => true, - 'modernize_types_casting' => true, - 'native_function_casing' => true, - 'native_function_invocation'=> false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now - 'new_with_braces' => true, - 'no_alias_functions' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace - 'no_closing_tag' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - '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, - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'no_php4_constructor' => true, - 'no_short_bool_cast' => true, - 'no_short_echo_tag' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_spaces_after_function_name' => true, - 'no_spaces_around_offset' => true, - 'no_spaces_inside_parenthesis' => true, - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unreachable_default_argument_value' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'normalize_index_brace' => true, - 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces - 'not_operator_with_successor_space' => false, // idem - 'object_operator_without_whitespace' => true, - 'ordered_class_elements' => false, // We prefer to keep some freedom - 'ordered_imports' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_align' => false, // Waste of time - 'phpdoc_annotation_without_dot' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, - 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_return_self_reference' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => false, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => false, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'pow_to_exponentiation' => false, - 'pre_increment' => false, - 'protected_to_private' => true, - 'psr0' => true, - 'psr4' => true, - 'random_api_migration' => false, // This breaks our unit tests - 'return_type_declaration' => true, - 'self_accessor' => true, - 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` - 'short_scalar_cast' => true, - 'silenced_deprecation_error' => true, - 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null - 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => true, - 'single_class_element_per_statement' => true, - 'single_import_per_statement' => true, - 'single_line_after_imports' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'strict_comparison' => false, // No, too dangerous to change that - 'strict_param' => false, // No, too dangerous to change that - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => false, - 'unary_operator_spaces' => true, - 'visibility_required' => true, - 'whitespace_after_comma_in_array' => true, - )); diff --git a/samples/Sample_01_SimpleText.php b/samples/Sample_01_SimpleText.php index 8af44d20aa..e89f7323ba 100644 --- a/samples/Sample_01_SimpleText.php +++ b/samples/Sample_01_SimpleText.php @@ -1,4 +1,5 @@ getSettings()->setThemeFontLang($languageEnGb); $fontStyleName = 'rStyle'; -$phpWord->addFontStyle($fontStyleName, array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true)); +$phpWord->addFontStyle($fontStyleName, ['bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true]); $paragraphStyleName = 'pStyle'; -$phpWord->addParagraphStyle($paragraphStyleName, array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'spaceAfter' => 100)); +$phpWord->addParagraphStyle($paragraphStyleName, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'spaceAfter' => 100]); -$phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240)); +$phpWord->addTitleStyle(1, ['bold' => true], ['spaceAfter' => 240]); // New portrait section $section = $phpWord->addSection(); @@ -28,7 +29,7 @@ // $pStyle = new Font(); // $pStyle->setLang() -$section->addText('Ce texte-ci est en français.', array('lang' => \PhpOffice\PhpWord\Style\Language::FR_BE)); +$section->addText('Ce texte-ci est en français.', ['lang' => \PhpOffice\PhpWord\Style\Language::FR_BE]); // Two text break $section->addTextBreak(2); @@ -47,33 +48,33 @@ $textrun = $section->addTextRun(); $textrun->addText('I am inline styled ', $fontStyle); $textrun->addText('with '); -$textrun->addText('color', array('color' => '996699')); +$textrun->addText('color', ['color' => '996699']); $textrun->addText(', '); -$textrun->addText('bold', array('bold' => true)); +$textrun->addText('bold', ['bold' => true]); $textrun->addText(', '); -$textrun->addText('italic', array('italic' => true)); +$textrun->addText('italic', ['italic' => true]); $textrun->addText(', '); -$textrun->addText('underline', array('underline' => 'dash')); +$textrun->addText('underline', ['underline' => 'dash']); $textrun->addText(', '); -$textrun->addText('strikethrough', array('strikethrough' => true)); +$textrun->addText('strikethrough', ['strikethrough' => true]); $textrun->addText(', '); -$textrun->addText('doubleStrikethrough', array('doubleStrikethrough' => true)); +$textrun->addText('doubleStrikethrough', ['doubleStrikethrough' => true]); $textrun->addText(', '); -$textrun->addText('superScript', array('superScript' => true)); +$textrun->addText('superScript', ['superScript' => true]); $textrun->addText(', '); -$textrun->addText('subScript', array('subScript' => true)); +$textrun->addText('subScript', ['subScript' => true]); $textrun->addText(', '); -$textrun->addText('smallCaps', array('smallCaps' => true)); +$textrun->addText('smallCaps', ['smallCaps' => true]); $textrun->addText(', '); -$textrun->addText('allCaps', array('allCaps' => true)); +$textrun->addText('allCaps', ['allCaps' => true]); $textrun->addText(', '); -$textrun->addText('fgColor', array('fgColor' => 'yellow')); +$textrun->addText('fgColor', ['fgColor' => 'yellow']); $textrun->addText(', '); -$textrun->addText('scale', array('scale' => 200)); +$textrun->addText('scale', ['scale' => 200]); $textrun->addText(', '); -$textrun->addText('spacing', array('spacing' => 120)); +$textrun->addText('spacing', ['spacing' => 120]); $textrun->addText(', '); -$textrun->addText('kerning', array('kerning' => 10)); +$textrun->addText('kerning', ['kerning' => 10]); $textrun->addText('. '); // Link @@ -81,7 +82,7 @@ $section->addTextBreak(); // Image -$section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18)); +$section->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_02_TabStops.php b/samples/Sample_02_TabStops.php index 4f588ee7b8..74a0ed1fa3 100644 --- a/samples/Sample_02_TabStops.php +++ b/samples/Sample_02_TabStops.php @@ -1,4 +1,5 @@ addParagraphStyle( $multipleTabsStyleName, - array( - 'tabs' => array( + [ + 'tabs' => [ new \PhpOffice\PhpWord\Style\Tab('left', 1550), new \PhpOffice\PhpWord\Style\Tab('center', 3200), new \PhpOffice\PhpWord\Style\Tab('right', 5300), - ), - ) + ], + ] ); $rightTabStyleName = 'rightTab'; -$phpWord->addParagraphStyle($rightTabStyleName, array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090)))); +$phpWord->addParagraphStyle($rightTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('right', 9090)]]); $leftTabStyleName = 'centerTab'; -$phpWord->addParagraphStyle($leftTabStyleName, array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('center', 4680)))); +$phpWord->addParagraphStyle($leftTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('center', 4680)]]); // New portrait section $section = $phpWord->addSection(); diff --git a/samples/Sample_03_Sections.php b/samples/Sample_03_Sections.php index 5bb9ecc2e4..b02a277c43 100644 --- a/samples/Sample_03_Sections.php +++ b/samples/Sample_03_Sections.php @@ -1,4 +1,5 @@ addSection(array('borderColor' => '00FF00', 'borderSize' => 12)); +$section = $phpWord->addSection(['borderColor' => '00FF00', 'borderSize' => 12]); $section->addText('I am placed on a default section.'); // New landscape section -$section = $phpWord->addSection(array('orientation' => 'landscape')); +$section = $phpWord->addSection(['orientation' => 'landscape']); $section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.'); $section->addPageBreak(); $section->addPageBreak(); // New portrait section $section = $phpWord->addSection( - array('paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600) + ['paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600] ); $section->addText('This section uses other margins with folio papersize.'); // The text of this section is vertically centered $section = $phpWord->addSection( - array('vAlign' => VerticalJc::CENTER) + ['vAlign' => VerticalJc::CENTER] ); $section->addText('This section is vertically centered.'); // New portrait section with Header & Footer $section = $phpWord->addSection( - array( - 'marginLeft' => 200, - 'marginRight' => 200, - 'marginTop' => 200, + [ + 'marginLeft' => 200, + 'marginRight' => 200, + 'marginTop' => 200, 'marginBottom' => 200, 'headerHeight' => 50, 'footerHeight' => 50, - ) + ] ); $section->addText('This section and we play with header/footer height.'); $section->addHeader()->addText('Header'); diff --git a/samples/Sample_04_Textrun.php b/samples/Sample_04_Textrun.php index ecd0c88a9f..33af08a5b4 100644 --- a/samples/Sample_04_Textrun.php +++ b/samples/Sample_04_Textrun.php @@ -1,4 +1,5 @@ addParagraphStyle($paragraphStyleName, array('spacing' => 100)); +$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]); $boldFontStyleName = 'BoldText'; -$phpWord->addFontStyle($boldFontStyleName, array('bold' => true)); +$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]); $coloredFontStyleName = 'ColoredText'; -$phpWord->addFontStyle($coloredFontStyleName, array('color' => 'FF8080', 'bgColor' => 'FFFFCC')); +$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']); $linkFontStyleName = 'NLink'; -$phpWord->addLinkStyle($linkFontStyleName, array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); +$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]); // New portrait section $section = $phpWord->addSection(); @@ -26,21 +27,21 @@ $textrun->addText('Each textrun can contain native text, link elements or an image.'); $textrun->addText(' No break is placed after adding an element.', $boldFontStyleName); $textrun->addText(' Both '); -$textrun->addText('superscript', array('superScript' => true)); +$textrun->addText('superscript', ['superScript' => true]); $textrun->addText(' and '); -$textrun->addText('subscript', array('subScript' => true)); +$textrun->addText('subscript', ['subScript' => true]); $textrun->addText(' are also available.'); $textrun->addText(' All elements are placed inside a paragraph with the optionally given paragraph style.', $coloredFontStyleName); $textrun->addText(' Sample Link: '); $textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName); $textrun->addText(' Sample Image: '); -$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18)); +$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]); $textrun->addText(' Sample Object: '); $textrun->addObject('resources/_sheet.xls'); $textrun->addText(' Here is some more text. '); $textrun = $section->addTextRun(); -$textrun->addText('This text is not visible.', array('hidden' => true)); +$textrun->addText('This text is not visible.', ['hidden' => true]); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_05_Multicolumn.php b/samples/Sample_05_Multicolumn.php index f7cefa58d3..093dd60424 100644 --- a/samples/Sample_05_Multicolumn.php +++ b/samples/Sample_05_Multicolumn.php @@ -1,4 +1,5 @@ addSection( - array( - 'colsNum' => 2, + [ + 'colsNum' => 2, 'colsSpace' => 1440, 'breakType' => 'continuous', - ) + ] ); $section->addText("Two columns, one inch (1440 twips) spacing. {$filler}"); // Normal -$section = $phpWord->addSection(array('breakType' => 'continuous')); +$section = $phpWord->addSection(['breakType' => 'continuous']); $section->addText("Normal paragraph again. {$filler}"); // Three columns $section = $phpWord->addSection( - array( - 'colsNum' => 3, + [ + 'colsNum' => 3, 'colsSpace' => 720, 'breakType' => 'continuous', - ) + ] ); $section->addText("Three columns, half inch (720 twips) spacing. {$filler}"); // Normal -$section = $phpWord->addSection(array('breakType' => 'continuous')); +$section = $phpWord->addSection(['breakType' => 'continuous']); $section->addText("Normal paragraph again. {$filler}"); // Save file diff --git a/samples/Sample_06_Footnote.php b/samples/Sample_06_Footnote.php index 19d6a52462..f3c369b342 100644 --- a/samples/Sample_06_Footnote.php +++ b/samples/Sample_06_Footnote.php @@ -1,4 +1,5 @@ addParagraphStyle($paragraphStyleName, array('spacing' => 100)); +$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]); $boldFontStyleName = 'BoldText'; -$phpWord->addFontStyle($boldFontStyleName, array('bold' => true)); +$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]); $coloredFontStyleName = 'ColoredText'; -$phpWord->addFontStyle($coloredFontStyleName, array('color' => 'FF8080', 'bgColor' => 'FFFFCC')); +$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']); $linkFontStyleName = 'NLink'; -$phpWord->addLinkStyle($linkFontStyleName, array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)); +$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]); // New portrait section $section = $phpWord->addSection(); @@ -38,7 +39,7 @@ $footnote->addText('links like '); $footnote->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName); $footnote->addText(', image like '); -$footnote->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18)); +$footnote->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]); $footnote->addText(', or object like '); $footnote->addObject('resources/_sheet.xls'); $footnote->addText('But you can only put footnote in section, not in header or footer.'); diff --git a/samples/Sample_07_TemplateCloneRow.php b/samples/Sample_07_TemplateCloneRow.php index 42c53269e8..a921569f64 100644 --- a/samples/Sample_07_TemplateCloneRow.php +++ b/samples/Sample_07_TemplateCloneRow.php @@ -1,4 +1,5 @@ setValue('rowNumber#10', '10'); // Table with a spanned cell -$values = array( - array( - 'userId' => 1, +$values = [ + [ + 'userId' => 1, 'userFirstName' => 'James', - 'userName' => 'Taylor', - 'userPhone' => '+1 428 889 773', - ), - array( - 'userId' => 2, + 'userName' => 'Taylor', + 'userPhone' => '+1 428 889 773', + ], + [ + 'userId' => 2, 'userFirstName' => 'Robert', - 'userName' => 'Bell', - 'userPhone' => '+1 428 889 774', - ), - array( - 'userId' => 3, + 'userName' => 'Bell', + 'userPhone' => '+1 428 889 774', + ], + [ + 'userId' => 3, 'userFirstName' => 'Michael', - 'userName' => 'Ray', - 'userPhone' => '+1 428 889 775', - ), -); + 'userName' => 'Ray', + 'userPhone' => '+1 428 889 775', + ], +]; $templateProcessor->cloneRowAndSetValues('userId', $values); @@ -80,7 +81,7 @@ echo date('H:i:s'), ' Saving the result document...', EOL; $templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx'); -echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_07_TemplateCloneRow.docx'); +echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_07_TemplateCloneRow.docx'); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_08_ParagraphPagination.php b/samples/Sample_08_ParagraphPagination.php index 3c21b138fc..f343366a84 100644 --- a/samples/Sample_08_ParagraphPagination.php +++ b/samples/Sample_08_ParagraphPagination.php @@ -1,15 +1,16 @@ setDefaultParagraphStyle( - array( - 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::BOTH, + [ + 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::BOTH, 'spaceAfter' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(12), - 'spacing' => 120, - ) + 'spacing' => 120, + ] ); // New section @@ -19,8 +20,8 @@ '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('space' => array('before' => 360, 'after' => 480)) + ['bold' => true], + ['space' => ['before' => 360, 'after' => 480]] ); $section->addText( @@ -30,7 +31,7 @@ . 'itself at the bottom of a page. Set this option to "false" if you want ' . 'to disable this automatic control.', null, - array('widowControl' => false, 'indentation' => array('left' => 240, 'right' => 120)) + ['widowControl' => false, 'indentation' => ['left' => 240, 'right' => 120]] ); $section->addText( @@ -39,7 +40,7 @@ . 'breaks between paragraphs. Set this option to "true" if you do not want ' . 'your paragraph to be separated with the next paragraph.', null, - array('keepNext' => true, 'indentation' => array('firstLine' => 240)) + ['keepNext' => true, 'indentation' => ['firstLine' => 240]] ); $section->addText( @@ -48,7 +49,7 @@ . 'break within a paragraph. Set this option to "true" if you do not want ' . 'all lines of your paragraph to be in the same page.', null, - array('keepLines' => true, 'indentation' => array('left' => 240, 'hanging' => 240)) + ['keepLines' => true, 'indentation' => ['left' => 240, 'hanging' => 240]] ); $section->addText('Keep scrolling. More below.'); @@ -59,7 +60,7 @@ . 'your paragraph into the next page. This option is most useful for ' . 'heading styles.', null, - array('pageBreakBefore' => true) + ['pageBreakBefore' => true] ); // Save file diff --git a/samples/Sample_09_Tables.php b/samples/Sample_09_Tables.php index 3115543865..f1b67c9ecc 100644 --- a/samples/Sample_09_Tables.php +++ b/samples/Sample_09_Tables.php @@ -1,4 +1,5 @@ addSection(); -$header = array('size' => 16, 'bold' => true); +$header = ['size' => 16, 'bold' => true]; // 1. Basic table @@ -17,9 +18,9 @@ $section->addText('Basic table', $header); $table = $section->addTable(); -for ($r = 1; $r <= $rows; $r++) { +for ($r = 1; $r <= $rows; ++$r) { $table->addRow(); - for ($c = 1; $c <= $cols; $c++) { + for ($c = 1; $c <= $cols; ++$c) { $table->addCell(1750)->addText("Row {$r}, Cell {$c}"); } } @@ -30,11 +31,11 @@ $section->addText('Fancy table', $header); $fancyTableStyleName = 'Fancy Table'; -$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50); -$fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'); -$fancyTableCellStyle = array('valign' => 'center'); -$fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); -$fancyTableFontStyle = array('bold' => true); +$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50]; +$fancyTableFirstRowStyle = ['borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF']; +$fancyTableCellStyle = ['valign' => 'center']; +$fancyTableCellBtlrStyle = ['valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR]; +$fancyTableFontStyle = ['bold' => true]; $phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle); $table = $section->addTable($fancyTableStyleName); $table->addRow(900); @@ -43,7 +44,7 @@ $table->addCell(2000, $fancyTableCellStyle)->addText('Row 3', $fancyTableFontStyle); $table->addCell(2000, $fancyTableCellStyle)->addText('Row 4', $fancyTableFontStyle); $table->addCell(500, $fancyTableCellBtlrStyle)->addText('Row 5', $fancyTableFontStyle); -for ($i = 1; $i <= 8; $i++) { +for ($i = 1; $i <= 8; ++$i) { $table->addRow(); $table->addCell(2000)->addText("Cell {$i}"); $table->addCell(2000)->addText("Cell {$i}"); @@ -65,12 +66,12 @@ $section->addPageBreak(); $section->addText('Table with colspan and rowspan', $header); -$fancyTableStyle = array('borderSize' => 6, 'borderColor' => '999999'); -$cellRowSpan = array('vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00'); -$cellRowContinue = array('vMerge' => 'continue'); -$cellColSpan = array('gridSpan' => 2, 'valign' => 'center'); -$cellHCentered = array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER); -$cellVCentered = array('valign' => 'center'); +$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '999999']; +$cellRowSpan = ['vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00']; +$cellRowContinue = ['vMerge' => 'continue']; +$cellColSpan = ['gridSpan' => 2, 'valign' => 'center']; +$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]; +$cellVCentered = ['valign' => 'center']; $spanTableStyleName = 'Colspan Rowspan'; $phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle); @@ -111,22 +112,22 @@ $section->addPageBreak(); $section->addText('Table with colspan and rowspan', $header); -$styleTable = array('borderSize' => 6, 'borderColor' => '999999'); +$styleTable = ['borderSize' => 6, 'borderColor' => '999999']; $phpWord->addTableStyle('Colspan Rowspan', $styleTable); $table = $section->addTable('Colspan Rowspan'); $row = $table->addRow(); -$row->addCell(1000, array('vMerge' => 'restart'))->addText('A'); -$row->addCell(1000, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B'); +$row->addCell(1000, ['vMerge' => 'restart'])->addText('A'); +$row->addCell(1000, ['gridSpan' => 2, 'vMerge' => 'restart'])->addText('B'); $row->addCell(1000)->addText('1'); $row = $table->addRow(); -$row->addCell(1000, array('vMerge' => 'continue')); -$row->addCell(1000, array('vMerge' => 'continue', 'gridSpan' => 2)); +$row->addCell(1000, ['vMerge' => 'continue']); +$row->addCell(1000, ['vMerge' => 'continue', 'gridSpan' => 2]); $row->addCell(1000)->addText('2'); $row = $table->addRow(); -$row->addCell(1000, array('vMerge' => 'continue')); +$row->addCell(1000, ['vMerge' => 'continue']); $row->addCell(1000)->addText('C'); $row->addCell(1000)->addText('D'); $row->addCell(1000)->addText('3'); @@ -136,10 +137,10 @@ $section->addTextBreak(2); $section->addText('Nested table in a centered and 50% width table.', $header); -$table = $section->addTable(array('width' => 50 * 50, 'unit' => 'pct', 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER)); +$table = $section->addTable(['width' => 50 * 50, 'unit' => 'pct', 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER]); $cell = $table->addRow()->addCell(); $cell->addText('This cell contains nested table.'); -$innerCell = $cell->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER))->addRow()->addCell(); +$innerCell = $cell->addTable(['alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER])->addRow()->addCell(); $innerCell->addText('Inside nested table'); // 6. Table with floating position @@ -147,7 +148,7 @@ $section->addTextBreak(2); $section->addText('Table with floating positioning.', $header); -$table = $section->addTable(array('borderSize' => 6, 'borderColor' => '999999', 'position' => array('vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1)))); +$table = $section->addTable(['borderSize' => 6, 'borderColor' => '999999', 'position' => ['vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1)]]); $cell = $table->addRow()->addCell(); $cell->addText('This is a single cell.'); diff --git a/samples/Sample_10_EastAsianFontStyle.php b/samples/Sample_10_EastAsianFontStyle.php index 87345ae0e8..c8a6ec3a5e 100644 --- a/samples/Sample_10_EastAsianFontStyle.php +++ b/samples/Sample_10_EastAsianFontStyle.php @@ -1,13 +1,14 @@ addSection(); -$header = array('size' => 16, 'bold' => true); +$header = ['size' => 16, 'bold' => true]; //1.Use EastAisa FontStyle -$section->addText('中文楷体样式测试', array('name' => '楷体', 'size' => 16, 'color' => '1B2232', 'lang' => array('latin' => 'en-US', 'eastAsia' => 'zh-CN'))); +$section->addText('中文楷体样式测试', ['name' => '楷体', 'size' => 16, 'color' => '1B2232', 'lang' => ['latin' => 'en-US', 'eastAsia' => 'zh-CN']]); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_11_ReadWord2007.php b/samples/Sample_11_ReadWord2007.php index c0b54c7a49..313cc00797 100644 --- a/samples/Sample_11_ReadWord2007.php +++ b/samples/Sample_11_ReadWord2007.php @@ -1,4 +1,5 @@ addTextRun(); $textrun->addText('This is the header with '); $textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub'); -$table->addCell(4500)->addImage('resources/PhpWord.png', array('width' => 80, 'height' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END)); +$table->addCell(4500)->addImage('resources/PhpWord.png', ['width' => 80, 'height' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]); // Add header for all other pages $subsequent = $section->addHeader(); $subsequent->addText('Subsequent pages in Section 1 will Have this!'); -$subsequent->addImage('resources/_mars.jpg', array('width' => 80, 'height' => 80)); +$subsequent->addImage('resources/_mars.jpg', ['width' => 80, 'height' => 80]); // Add footer $footer = $section->addFooter(); -$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.', null, array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); +$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.', null, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]); $footer->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub'); // Write some text diff --git a/samples/Sample_13_Images.php b/samples/Sample_13_Images.php index f7be3be969..30b9cae949 100644 --- a/samples/Sample_13_Images.php +++ b/samples/Sample_13_Images.php @@ -1,4 +1,5 @@ addText('Local image with styles:'); -$section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); +$section->addImage('resources/_earth.jpg', ['width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]); // Remote image printSeparator($section); @@ -33,21 +34,21 @@ //Wrapping style printSeparator($section); $text = str_repeat('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 2); -$wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight'); +$wrappingStyles = ['inline', 'behind', 'infront', 'square', 'tight']; foreach ($wrappingStyles as $wrappingStyle) { $section->addText("Wrapping style {$wrappingStyle}"); $section->addImage( 'resources/_earth.jpg', - array( - 'positioning' => 'relative', - 'marginTop' => -1, - 'marginLeft' => 1, - 'width' => 80, - 'height' => 80, - 'wrappingStyle' => $wrappingStyle, - 'wrapDistanceRight' => Converter::cmToPoint(1), + [ + 'positioning' => 'relative', + 'marginTop' => -1, + 'marginLeft' => 1, + 'width' => 80, + 'height' => 80, + 'wrappingStyle' => $wrappingStyle, + 'wrapDistanceRight' => Converter::cmToPoint(1), 'wrapDistanceBottom' => Converter::cmToPoint(1), - ) + ] ); $section->addText($text); printSeparator($section); @@ -57,16 +58,16 @@ $section->addText('Absolute positioning: see top right corner of page'); $section->addImage( 'resources/_mars.jpg', - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), - 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE, - 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT, + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), + 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE, + 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT, 'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE, - 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE, - 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.5), - 'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.55), - ) + 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE, + 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.5), + 'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.55), + ] ); //Relative positioning @@ -75,21 +76,21 @@ $section->addText('Vertical position top relative to line'); $section->addImage( 'resources/_mars.jpg', - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), - 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE, - 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER, + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3), + 'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE, + 'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER, 'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_COLUMN, - 'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP, - 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_LINE, - ) + 'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP, + 'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_LINE, + ] ); -function printSeparator(Section $section) +function printSeparator(Section $section): void { $section->addTextBreak(); - $lineStyle = array('weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center'); + $lineStyle = ['weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center']; $section->addLine($lineStyle); $section->addTextBreak(2); } diff --git a/samples/Sample_14_ListItem.php b/samples/Sample_14_ListItem.php index f40e9f6fb9..3b509f3577 100644 --- a/samples/Sample_14_ListItem.php +++ b/samples/Sample_14_ListItem.php @@ -1,4 +1,5 @@ addFontStyle($fontStyleName, array('color' => 'FF0000')); +$phpWord->addFontStyle($fontStyleName, ['color' => 'FF0000']); $paragraphStyleName = 'P-Style'; -$phpWord->addParagraphStyle($paragraphStyleName, array('spaceAfter' => 95)); +$phpWord->addParagraphStyle($paragraphStyleName, ['spaceAfter' => 95]); $multilevelNumberingStyleName = 'multilevel'; $phpWord->addNumberingStyle( $multilevelNumberingStyleName, - array( - 'type' => 'multilevel', - 'levels' => array( - array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360), - array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720), - ), - ) + [ + 'type' => 'multilevel', + 'levels' => [ + ['format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360], + ['format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720], + ], + ] ); -$predefinedMultilevelStyle = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED); +$predefinedMultilevelStyle = ['listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED]; // New section $section = $phpWord->addSection(); @@ -63,32 +64,32 @@ $section->addText('List with inline formatting.'); $listItemRun = $section->addListItemRun(); $listItemRun->addText('List item 1'); -$listItemRun->addText(' in bold', array('bold' => true)); +$listItemRun->addText(' in bold', ['bold' => true]); $listItemRun = $section->addListItemRun(1, $predefinedMultilevelStyle, $paragraphStyleName); $listItemRun->addText('List item 2'); -$listItemRun->addText(' in italic', array('italic' => true)); +$listItemRun->addText(' in italic', ['italic' => true]); $footnote = $listItemRun->addFootnote(); $footnote->addText('this is a footnote on a list item'); $listItemRun = $section->addListItemRun(); $listItemRun->addText('List item 3'); -$listItemRun->addText(' underlined', array('underline' => 'dash')); +$listItemRun->addText(' underlined', ['underline' => 'dash']); $section->addTextBreak(2); // Numbered heading $headingNumberingStyleName = 'headingNumbering'; $phpWord->addNumberingStyle( $headingNumberingStyleName, - array('type' => 'multilevel', - 'levels' => array( - array('pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'), - array('pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'), - array('pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'), - ), - ) + ['type' => 'multilevel', + 'levels' => [ + ['pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'], + ['pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'], + ['pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'], + ], + ] ); -$phpWord->addTitleStyle(1, array('size' => 16), array('numStyle' => $headingNumberingStyleName, 'numLevel' => 0)); -$phpWord->addTitleStyle(2, array('size' => 14), array('numStyle' => $headingNumberingStyleName, 'numLevel' => 1)); -$phpWord->addTitleStyle(3, array('size' => 12), array('numStyle' => $headingNumberingStyleName, 'numLevel' => 2)); +$phpWord->addTitleStyle(1, ['size' => 16], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 0]); +$phpWord->addTitleStyle(2, ['size' => 14], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 1]); +$phpWord->addTitleStyle(3, ['size' => 12], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 2]); $section->addTitle('Heading 1', 1); $section->addTitle('Heading 2', 2); diff --git a/samples/Sample_15_Link.php b/samples/Sample_15_Link.php index 86c7973bc1..faef305962 100644 --- a/samples/Sample_15_Link.php +++ b/samples/Sample_15_Link.php @@ -1,4 +1,5 @@ addLinkStyle($linkFontStyleName, array('bold' => true, 'color' => '808000')); +$phpWord->addLinkStyle($linkFontStyleName, ['bold' => true, 'color' => '808000']); // New section $section = $phpWord->addSection(); @@ -16,7 +17,7 @@ $section->addLink( 'https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', - array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE) + ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE] ); $section->addTextBreak(2); $section->addLink('http://www.bing.com', null, $linkFontStyleName); diff --git a/samples/Sample_16_Object.php b/samples/Sample_16_Object.php index c4db7f6106..b68fb1675b 100644 --- a/samples/Sample_16_Object.php +++ b/samples/Sample_16_Object.php @@ -1,4 +1,5 @@ addSection(); // Define styles -$fontStyle12 = array('spaceAfter' => 60, 'size' => 12); -$fontStyle10 = array('size' => 10); -$phpWord->addTitleStyle(null, array('size' => 22, 'bold' => true)); -$phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true)); -$phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666')); -$phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true)); -$phpWord->addTitleStyle(4, array('size' => 12)); +$fontStyle12 = ['spaceAfter' => 60, 'size' => 12]; +$fontStyle10 = ['size' => 10]; +$phpWord->addTitleStyle(null, ['size' => 22, 'bold' => true]); +$phpWord->addTitleStyle(1, ['size' => 20, 'color' => '333333', 'bold' => true]); +$phpWord->addTitleStyle(2, ['size' => 16, 'color' => '666666']); +$phpWord->addTitleStyle(3, ['size' => 14, 'italic' => true]); +$phpWord->addTitleStyle(4, ['size' => 12]); // Add text elements $section->addTitle('Table of contents 1', 0); diff --git a/samples/Sample_18_Watermark.php b/samples/Sample_18_Watermark.php index dbab2b7f26..aebb369023 100644 --- a/samples/Sample_18_Watermark.php +++ b/samples/Sample_18_Watermark.php @@ -1,4 +1,5 @@ addSection(); $header = $section->addHeader(); -$header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55)); +$header->addWatermark('resources/_earth.jpg', ['marginTop' => 200, 'marginLeft' => 55]); $section->addText('The header reference to the current section includes a watermark image.'); // Save file diff --git a/samples/Sample_19_TextBreak.php b/samples/Sample_19_TextBreak.php index 17e2b1cbd7..45c79beeb6 100644 --- a/samples/Sample_19_TextBreak.php +++ b/samples/Sample_19_TextBreak.php @@ -1,4 +1,5 @@ 24); +$fontStyle24 = ['size' => 24]; -$paragraphStyle24 = array('spacing' => 240, 'size' => 24); +$paragraphStyle24 = ['spacing' => 240, 'size' => 24]; $fontStyleName = 'fontStyle'; -$phpWord->addFontStyle($fontStyleName, array('size' => 9)); +$phpWord->addFontStyle($fontStyleName, ['size' => 9]); $paragraphStyleName = 'paragraphStyle'; -$phpWord->addParagraphStyle($paragraphStyleName, array('spacing' => 480)); +$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 480]); // New section $section = $phpWord->addSection(); diff --git a/samples/Sample_20_BGColor.php b/samples/Sample_20_BGColor.php index 628ae8902e..915a824171 100644 --- a/samples/Sample_20_BGColor.php +++ b/samples/Sample_20_BGColor.php @@ -1,4 +1,5 @@ addText( 'This is some text highlighted using fgColor (limited to 15 colors)', - array('fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW) + ['fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW] ); -$section->addText('This one uses bgColor and is using hex value (0xfbbb10)', array('bgColor' => 'fbbb10')); -$section->addText('Compatible with font colors', array('color' => '0000ff', 'bgColor' => 'fbbb10')); +$section->addText('This one uses bgColor and is using hex value (0xfbbb10)', ['bgColor' => 'fbbb10']); +$section->addText('Compatible with font colors', ['color' => '0000ff', 'bgColor' => 'fbbb10']); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_21_TableRowRules.php b/samples/Sample_21_TableRowRules.php index ca33de3bcd..42fc2d92a5 100644 --- a/samples/Sample_21_TableRowRules.php +++ b/samples/Sample_21_TableRowRules.php @@ -1,4 +1,5 @@ addTable(array('cellMargin' => 0, 'cellMarginRight' => 0, 'cellMarginBottom' => 0, 'cellMarginLeft' => 0)); +$table1 = $section->addTable(['cellMargin' => 0, 'cellMarginRight' => 0, 'cellMarginBottom' => 0, 'cellMarginLeft' => 0]); $table1->addRow(3750); -$cell1 = $table1->addCell(null, array('valign' => 'top', 'borderSize' => 30, 'borderColor' => 'ff0000')); -$cell1->addImage('./resources/_earth.jpg', array('width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); +$cell1 = $table1->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => 'ff0000']); +$cell1->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]); $section->addTextBreak(); $section->addText("But if we set the rowStyle 'exactHeight' to true, the real row height is used, removing the textbreak:"); $table2 = $section->addTable( - array( - 'cellMargin' => 0, - 'cellMarginRight' => 0, + [ + 'cellMargin' => 0, + 'cellMarginRight' => 0, 'cellMarginBottom' => 0, - 'cellMarginLeft' => 0, - ) + 'cellMarginLeft' => 0, + ] ); -$table2->addRow(3750, array('exactHeight' => true)); -$cell2 = $table2->addCell(null, array('valign' => 'top', 'borderSize' => 30, 'borderColor' => '00ff00')); -$cell2->addImage('./resources/_earth.jpg', array('width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); +$table2->addRow(3750, ['exactHeight' => true]); +$cell2 = $table2->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => '00ff00']); +$cell2->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]); $section->addTextBreak(); $section->addText('In this example, image is 250px height. Rows are calculated in twips, and 1px = 15twips.'); diff --git a/samples/Sample_22_CheckBox.php b/samples/Sample_22_CheckBox.php index 5a2ac3e2cc..33d4e39c66 100644 --- a/samples/Sample_22_CheckBox.php +++ b/samples/Sample_22_CheckBox.php @@ -1,4 +1,5 @@ saveAs('results/Sample_23_TemplateBlock.docx'); -echo getEndingNotes(array('Word2007' => 'docx'), 'Sample_23_TemplateBlock'); +echo getEndingNotes(['Word2007' => 'docx'], 'Sample_23_TemplateBlock'); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_24_ReadODText.php b/samples/Sample_24_ReadODText.php index 42df23ae2b..73c110203e 100644 --- a/samples/Sample_24_ReadODText.php +++ b/samples/Sample_24_ReadODText.php @@ -1,4 +1,5 @@ addTextBox( - array( - 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, - 'width' => 400, - 'height' => 150, - 'borderSize' => 1, + [ + 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, + 'width' => 400, + 'height' => 150, + 'borderSize' => 1, 'borderColor' => '#FF0000', - ) + ] ); $textbox->addText('Text box content in section.'); $textbox->addText('Another line.'); @@ -26,19 +27,19 @@ // Inside table $section->addTextBreak(2); $cell = $section->addTable()->addRow()->addCell(300); -$textbox = $cell->addTextBox(array('borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100)); +$textbox = $cell->addTextBox(['borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100]); $textbox->addText('Textbox inside table'); // Inside header with textrun $header = $section->addHeader(); -$textbox = $header->addTextBox(array('width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00')); +$textbox = $header->addTextBox(['width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00']); $textrun = $textbox->addTextRun(); $textrun->addText('TextBox in header. TextBox can contain a TextRun '); -$textrun->addText('with bold text', array('bold' => true)); +$textrun->addText('with bold text', ['bold' => true]); $textrun->addText(', '); $textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub'); $textrun->addText(', and image '); -$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18)); +$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]); $textrun->addText('.'); // Save file diff --git a/samples/Sample_26_Html.php b/samples/Sample_26_Html.php index 6bd926fe5b..84468faaa5 100644 --- a/samples/Sample_26_Html.php +++ b/samples/Sample_26_Html.php @@ -1,10 +1,11 @@ addParagraphStyle('Heading2', array('alignment' => 'center')); +$phpWord->addParagraphStyle('Heading2', ['alignment' => 'center']); $section = $phpWord->addSection(); $html = '

Adding element via HTML

'; diff --git a/samples/Sample_27_Field.php b/samples/Sample_27_Field.php index 4e7a5b2264..d250946169 100644 --- a/samples/Sample_27_Field.php +++ b/samples/Sample_27_Field.php @@ -1,4 +1,5 @@ 14)); +PhpOffice\PhpWord\Style::addTitleStyle(1, ['size' => 14]); // New section $section = $phpWord->addSection(); @@ -15,53 +16,53 @@ // Add Field elements // See Element/Field.php for all options $section->addText('Date field:'); -$section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); +$section->addField('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']); $section->addText('Style Ref field:'); -$section->addField('STYLEREF', array('StyleIdentifier' => 'Heading 1')); +$section->addField('STYLEREF', ['StyleIdentifier' => 'Heading 1']); $section->addText('Page field:'); -$section->addField('PAGE', array('format' => 'Arabic')); +$section->addField('PAGE', ['format' => 'Arabic']); $section->addText('Number of pages field:'); -$section->addField('NUMPAGES', array('numformat' => '0,00', 'format' => 'Arabic'), array('PreserveFormat')); +$section->addField('NUMPAGES', ['numformat' => '0,00', 'format' => 'Arabic'], ['PreserveFormat']); $section->addTextBreak(); $textrun = $section->addTextRun(); $textrun->addText('An index field is '); -$textrun->addField('XE', array(), array('Italic'), 'My first index'); +$textrun->addField('XE', [], ['Italic'], 'My first index'); $textrun->addText('here:'); $indexEntryText = new TextRun(); $indexEntryText->addText('My '); -$indexEntryText->addText('bold index', array('bold' => true)); +$indexEntryText->addText('bold index', ['bold' => true]); $indexEntryText->addText(' entry'); $textrun = $section->addTextRun(); $textrun->addText('A complex index field is '); -$textrun->addField('XE', array(), array('Bold'), $indexEntryText); +$textrun->addField('XE', [], ['Bold'], $indexEntryText); $textrun->addText('here:'); $section->addText('The actual index:'); -$section->addField('INDEX', array(), array('\\e " "'), 'right click to update the index'); +$section->addField('INDEX', [], ['\\e " "'], 'right click to update the index'); -$textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER)); +$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]); $textrun->addText('This is the date of lunar calendar '); -$textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar')); +$textrun->addField('DATE', ['dateformat' => 'd-M-yyyy H:mm:ss'], ['PreserveFormat', 'LunarCalendar']); $textrun->addText(' written in a textrun.'); $section->addTextBreak(); $macroText = new TextRun(); -$macroText->addText('Double click', array('bold' => true)); +$macroText->addText('Double click', ['bold' => true]); $macroText->addText(' to '); -$macroText->addText('zoom to 100%', array('italic' => true)); +$macroText->addText('zoom to 100%', ['italic' => true]); $section->addText('A macro button with styled text:'); -$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), $macroText); +$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], $macroText); $section->addTextBreak(); $section->addText('A macro button with simple text:'); -$section->addField('MACROBUTTON', array('macroname' => 'Zoom100'), array(), 'double click to zoom'); +$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], 'double click to zoom'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_28_ReadRTF.php b/samples/Sample_28_ReadRTF.php index 76ac3d48bb..43b859ac28 100644 --- a/samples/Sample_28_ReadRTF.php +++ b/samples/Sample_28_ReadRTF.php @@ -1,4 +1,5 @@ addText('Horizontal Line (Inline style):'); $section->addLine( - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), 'positioning' => 'absolute', - ) + ] ); $section->addText('Vertical Line (Inline style):'); $section->addLine( - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1), + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1), 'positioning' => 'absolute', - ) + ] ); // Two text break $section->addTextBreak(1); $section->addText('Positioned Line (red):'); $section->addLine( - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1), - 'positioning' => 'absolute', + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1), + 'positioning' => 'absolute', 'posHorizontalRel' => 'page', - 'posVerticalRel' => 'page', - 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(10), - 'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(8), - 'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE, - 'color' => 'red', - ) + 'posVerticalRel' => 'page', + 'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(10), + 'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(8), + 'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE, + 'color' => 'red', + ] ); $section->addText('Horizontal Formatted Line'); $section->addLine( - array( - 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15), - 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), + [ + 'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15), + 'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0), 'positioning' => 'absolute', - 'beginArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_BLOCK, - 'endArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_OVAL, - 'dash' => \PhpOffice\PhpWord\Style\Line::DASH_STYLE_LONG_DASH_DOT_DOT, - 'weight' => 10, - ) + 'beginArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_BLOCK, + 'endArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_OVAL, + 'dash' => \PhpOffice\PhpWord\Style\Line::DASH_STYLE_LONG_DASH_DOT_DOT, + 'weight' => 10, + ] ); // Save file diff --git a/samples/Sample_30_ReadHTML.php b/samples/Sample_30_ReadHTML.php index 029f8c8cfd..8698fe639a 100644 --- a/samples/Sample_30_ReadHTML.php +++ b/samples/Sample_30_ReadHTML.php @@ -1,4 +1,5 @@ addSection(); // Define styles -$phpWord->addTitleStyle(1, array('size' => 14, 'bold' => true)); +$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true]); // Arc $section->addTitle('Arc', 1); $section->addShape( 'arc', - array( - 'points' => '-90 20', - 'frame' => array('width' => 120, 'height' => 120), - 'outline' => array('color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'), - ) + [ + 'points' => '-90 20', + 'frame' => ['width' => 120, 'height' => 120], + 'outline' => ['color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'], + ] ); // Curve $section->addTitle('Curve', 1); $section->addShape( 'curve', - array( - 'points' => '1,100 200,1 1,50 200,50', + [ + 'points' => '1,100 200,1 1,50 200,50', 'connector' => 'elbow', - 'outline' => array( - 'color' => '#66cc00', - 'weight' => 2, - 'dash' => 'dash', + 'outline' => [ + 'color' => '#66cc00', + 'weight' => 2, + 'dash' => 'dash', 'startArrow' => 'diamond', - 'endArrow' => 'block', - ), - ) + 'endArrow' => 'block', + ], + ] ); // Line $section->addTitle('Line', 1); $section->addShape( 'line', - array( - 'points' => '1,1 150,30', - 'outline' => array( - 'color' => '#cc00ff', - 'line' => 'thickThin', - 'weight' => 3, + [ + 'points' => '1,1 150,30', + 'outline' => [ + 'color' => '#cc00ff', + 'line' => 'thickThin', + 'weight' => 3, 'startArrow' => 'oval', - 'endArrow' => 'classic', - ), - ) + 'endArrow' => 'classic', + ], + ] ); // Polyline $section->addTitle('Polyline', 1); $section->addShape( 'polyline', - array( - 'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50', - 'outline' => array('color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'), - ) + [ + 'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50', + 'outline' => ['color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'], + ] ); // Rectangle $section->addTitle('Rectangle', 1); $section->addShape( 'rect', - array( + [ 'roundness' => 0.2, - 'frame' => array('width' => 100, 'height' => 100, 'left' => 1, 'top' => 1), - 'fill' => array('color' => '#FFCC33'), - 'outline' => array('color' => '#990000', 'weight' => 1), - 'shadow' => array(), - ) + 'frame' => ['width' => 100, 'height' => 100, 'left' => 1, 'top' => 1], + 'fill' => ['color' => '#FFCC33'], + 'outline' => ['color' => '#990000', 'weight' => 1], + 'shadow' => [], + ] ); // Oval $section->addTitle('Oval', 1); $section->addShape( 'oval', - array( - 'frame' => array('width' => 100, 'height' => 70, 'left' => 1, 'top' => 1), - 'fill' => array('color' => '#33CC99'), - 'outline' => array('color' => '#333333', 'weight' => 2), - 'extrusion' => array(), - ) + [ + 'frame' => ['width' => 100, 'height' => 70, 'left' => 1, 'top' => 1], + 'fill' => ['color' => '#33CC99'], + 'outline' => ['color' => '#333333', 'weight' => 2], + 'extrusion' => [], + ] ); // Save file diff --git a/samples/Sample_32_Chart.php b/samples/Sample_32_Chart.php index bfb9ffe86b..7e99984e41 100644 --- a/samples/Sample_32_Chart.php +++ b/samples/Sample_32_Chart.php @@ -1,4 +1,5 @@ addTitleStyle(1, array('size' => 14, 'bold' => true), array('keepNext' => true, 'spaceBefore' => 240)); -$phpWord->addTitleStyle(2, array('size' => 14, 'bold' => true), array('keepNext' => true, 'spaceBefore' => 240)); +$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]); +$phpWord->addTitleStyle(2, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]); // 2D charts $section = $phpWord->addSection(); $section->addTitle('2D charts', 1); -$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous')); +$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']); -$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'); -$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'); -$threeSeries = array('bar', 'line'); -$categories = array('A', 'B', 'C', 'D', 'E'); -$series1 = array(1, 3, 2, 5, 4); -$series2 = array(3, 1, 7, 2, 6); -$series3 = array(8, 3, 2, 5, 4); +$chartTypes = ['pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column']; +$twoSeries = ['bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column']; +$threeSeries = ['bar', 'line']; +$categories = ['A', 'B', 'C', 'D', 'E']; +$series1 = [1, 3, 2, 5, 4]; +$series2 = [3, 1, 7, 2, 6]; +$series3 = [8, 3, 2, 5, 4]; $showGridLines = false; $showAxisLabels = false; $showLegend = true; @@ -48,20 +49,20 @@ } // 3D charts -$section = $phpWord->addSection(array('breakType' => 'continuous')); +$section = $phpWord->addSection(['breakType' => 'continuous']); $section->addTitle('3D charts', 1); -$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous')); +$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']); -$chartTypes = array('pie', 'bar', 'column', 'line', 'area'); -$multiSeries = array('bar', 'column', 'line', 'area'); -$style = array( - 'width' => Converter::cmToEmu(5), - 'height' => Converter::cmToEmu(4), - '3d' => true, +$chartTypes = ['pie', 'bar', 'column', 'line', 'area']; +$multiSeries = ['bar', 'column', 'line', 'area']; +$style = [ + 'width' => Converter::cmToEmu(5), + 'height' => Converter::cmToEmu(4), + '3d' => true, 'showAxisLabels' => $showAxisLabels, - 'showGridX' => $showGridLines, - 'showGridY' => $showGridLines, -); + 'showGridX' => $showGridLines, + 'showGridY' => $showGridLines, +]; foreach ($chartTypes as $chartType) { $section->addTitle(ucfirst($chartType), 2); $chart = $section->addChart($chartType, $categories, $series1, $style); diff --git a/samples/Sample_33_FormField.php b/samples/Sample_33_FormField.php index a855d42a02..61abc415cc 100644 --- a/samples/Sample_33_FormField.php +++ b/samples/Sample_33_FormField.php @@ -1,4 +1,5 @@ addText(', checkbox '); $textrun->addFormField('checkbox')->setDefault(true); $textrun->addText(', or dropdown '); -$textrun->addFormField('dropdown')->setEntries(array('Choice 1', 'Choice 2', 'Choice 3')); +$textrun->addFormField('dropdown')->setEntries(['Choice 1', 'Choice 2', 'Choice 3']); $textrun->addText('. You have to set document protection to "forms" to enable dropdown.'); $section->addText('They can also be added as a stand alone paragraph.'); diff --git a/samples/Sample_34_SDT.php b/samples/Sample_34_SDT.php index f9077a1a44..c1722b5b5c 100644 --- a/samples/Sample_34_SDT.php +++ b/samples/Sample_34_SDT.php @@ -1,4 +1,5 @@ addTextRun(); $textrun->addText('Combobox: '); -$textrun->addSDT('comboBox')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2')); +$textrun->addSDT('comboBox')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2']); $textrun = $section->addTextRun(); $textrun->addText('Date: '); @@ -24,7 +25,7 @@ $textrun = $section->addTextRun(); $textrun->addText('Drop down list: '); -$textrun->addSDT('dropDownList')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2'))->setValue('Choice 1'); +$textrun->addSDT('dropDownList')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2'])->setValue('Choice 1'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); diff --git a/samples/Sample_35_InternalLink.php b/samples/Sample_35_InternalLink.php index 5ab7d9b4d9..e59c353001 100644 --- a/samples/Sample_35_InternalLink.php +++ b/samples/Sample_35_InternalLink.php @@ -1,4 +1,5 @@ addTextRun(); $textrun->addText('This is a Left to Right paragraph.'); -$textrun = $section->addTextRun(array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END)); -$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true)); +$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]); +$textrun->addText('سلام این یک پاراگراف راست به چپ است', ['rtl' => true]); $section->addText('Table visually presented as RTL'); -$style = array('rtl' => true, 'size' => 12); -$tableStyle = array('borderSize' => 6, 'borderColor' => '000000', 'width' => 5000, 'unit' => \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT, 'bidiVisual' => true); +$style = ['rtl' => true, 'size' => 12]; +$tableStyle = ['borderSize' => 6, 'borderColor' => '000000', 'width' => 5000, 'unit' => \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT, 'bidiVisual' => true]; $table = $section->addTable($tableStyle); -$cellHCentered = array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER); -$cellHEnd = array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END); -$cellVCentered = array('valign' => \PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER); +$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]; +$cellHEnd = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]; +$cellVCentered = ['valign' => \PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER]; //Vidually bidirectinal table $table->addRow(); diff --git a/samples/Sample_37_Comments.php b/samples/Sample_37_Comments.php index 268739bc67..79647478e8 100644 --- a/samples/Sample_37_Comments.php +++ b/samples/Sample_37_Comments.php @@ -1,4 +1,5 @@ addText('Test', array('bold' => true)); +$comment->addText('Test', ['bold' => true]); $phpWord->addComment($comment); $section = $phpWord->addSection(); @@ -27,9 +28,9 @@ $textrunWithEnd = $section->addTextRun(); $textrunWithEnd->addText('This '); -$textToStartOn = $textrunWithEnd->addText('is', array('bold' => true)); +$textToStartOn = $textrunWithEnd->addText('is', ['bold' => true]); $textToStartOn->setCommentRangeStart($commentWithStartAndEnd); -$textrunWithEnd->addText(' another', array('italic' => true)); +$textrunWithEnd->addText(' another', ['italic' => true]); $textToEndOn = $textrunWithEnd->addText(' test'); $textToEndOn->setCommentRangeEnd($commentWithStartAndEnd); @@ -39,7 +40,7 @@ $commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime()); $imageComment = $commentOnImage->addTextRun(); $imageComment->addText('Hey, Mars does look '); -$imageComment->addText('red', array('color' => 'FF0000')); +$imageComment->addText('red', ['color' => 'FF0000']); $phpWord->addComment($commentOnImage); $image = $section->addImage('resources/_mars.jpg'); $image->setCommentRangeStart($commentOnImage); @@ -50,7 +51,7 @@ $anotherText = $section->addText('another text'); $comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials'); -$comment1->addText('Test', array('bold' => true)); +$comment1->addText('Test', ['bold' => true]); $comment1->setStartElement($anotherText); $comment1->setEndElement($anotherText); $phpWord->addComment($comment1); diff --git a/samples/Sample_38_Protection.php b/samples/Sample_38_Protection.php index ee2b460b2f..9f61538096 100644 --- a/samples/Sample_38_Protection.php +++ b/samples/Sample_38_Protection.php @@ -1,4 +1,5 @@ addText('Hello World! Time to '); -$text = $textRun->addText('wake ', array('bold' => true)); +$text = $textRun->addText('wake ', ['bold' => true]); $text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800); $text = $textRun->addText('up'); diff --git a/samples/Sample_40_TemplateSetComplexValue.php b/samples/Sample_40_TemplateSetComplexValue.php index 094823f784..38ecb3f7ae 100644 --- a/samples/Sample_40_TemplateSetComplexValue.php +++ b/samples/Sample_40_TemplateSetComplexValue.php @@ -1,4 +1,5 @@ addText('This title has been set ', array('bold' => true, 'italic' => true, 'color' => 'blue')); -$title->addText('dynamically', array('bold' => true, 'italic' => true, 'color' => 'red', 'underline' => 'single')); +$title->addText('This title has been set ', ['bold' => true, 'italic' => true, 'color' => 'blue']); +$title->addText('dynamically', ['bold' => true, 'italic' => true, 'color' => 'red', 'underline' => 'single']); $templateProcessor->setComplexBlock('title', $title); $inline = new TextRun(); -$inline->addText('by a red italic text', array('italic' => true, 'color' => 'red')); +$inline->addText('by a red italic text', ['italic' => true, 'color' => 'red']); $templateProcessor->setComplexValue('inline', $inline); -$table = new Table(array('borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP)); +$table = new Table(['borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP]); $table->addRow(); $table->addCell(150)->addText('Cell A1'); $table->addCell(150)->addText('Cell A2'); @@ -30,7 +31,7 @@ $table->addCell(150)->addText('Cell B3'); $templateProcessor->setComplexBlock('table', $table); -$field = new Field('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat')); +$field = new Field('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']); $templateProcessor->setComplexValue('field', $field); // $link = new Link('https://github.com/PHPOffice/PHPWord'); @@ -39,7 +40,7 @@ echo date('H:i:s'), ' Saving the result document...', EOL; $templateProcessor->saveAs('results/Sample_40_TemplateSetComplexValue.docx'); -echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_40_TemplateSetComplexValue.docx'); +echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_40_TemplateSetComplexValue.docx'); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_41_TemplateSetChart.php b/samples/Sample_41_TemplateSetChart.php index 2b017d7f7c..88eb2ccbd9 100644 --- a/samples/Sample_41_TemplateSetChart.php +++ b/samples/Sample_41_TemplateSetChart.php @@ -1,4 +1,5 @@ setHeight(Converter::inchToEmu(3)); $templateProcessor->setChart("chart{$i}", $chart); - $i++; + ++$i; } echo date('H:i:s'), ' Saving the result document...', EOL; $templateProcessor->saveAs('results/Sample_41_TemplateSetChart.docx'); -echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_41_TemplateSetChart.docx'); +echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_41_TemplateSetChart.docx'); if (!CLI) { include_once 'Sample_Footer.php'; } diff --git a/samples/Sample_Header.php b/samples/Sample_Header.php index f0fc626627..53674b7914 100644 --- a/samples/Sample_Header.php +++ b/samples/Sample_Header.php @@ -19,7 +19,7 @@ } // Set writers -$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'); +$writers = ['Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf']; // Set PDF renderer if (null === Settings::getPdfRendererPath()) { @@ -43,7 +43,7 @@ // Populate samples $files = ''; if ($handle = opendir('.')) { - $sampleFiles = array(); + $sampleFiles = []; while (false !== ($sampleFile = readdir($handle))) { $sampleFiles[] = $sampleFile; } @@ -59,7 +59,7 @@ } /** - * Write documents + * Write documents. * * @param \PhpOffice\PhpWord\PhpWord $phpWord * @param string $filename @@ -89,10 +89,11 @@ function write($phpWord, $filename, $writers) } /** - * Get ending notes + * Get ending notes. * * @param array $writers * @param mixed $filename + * * @return string */ function getEndingNotes($writers, $filename) @@ -114,7 +115,7 @@ function getEndingNotes($writers, $filename) $result .= '

 

'; $result .= '

Results: '; foreach ($types as $type) { - if (!is_null($type)) { + if (null !== $type) { $resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type; if (file_exists($resultFile)) { $result .= "{$type} "; diff --git a/samples/index.php b/samples/index.php index d539cd620d..c47deebe46 100644 --- a/samples/index.php +++ b/samples/index.php @@ -3,15 +3,15 @@ use PhpOffice\PhpWord\Settings; -$requirements = array( - 'php' => array('PHP 7.4', version_compare(PHP_VERSION, '7.4', '>=')), - 'xml' => array('PHP extension XML', extension_loaded('xml')), - 'temp' => array('Temp folder "' . Settings::getTempDir() . '" is writable', is_writable(Settings::getTempDir())), - 'zip' => array('PHP extension ZipArchive (optional)', extension_loaded('zip')), - 'gd' => array('PHP extension GD (optional)', extension_loaded('gd')), - 'xmlw' => array('PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')), - 'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')), -); +$requirements = [ + 'php' => ['PHP 7.4', version_compare(PHP_VERSION, '7.4', '>=')], + 'xml' => ['PHP extension XML', extension_loaded('xml')], + 'temp' => ['Temp folder "' . Settings::getTempDir() . '" is writable', is_writable(Settings::getTempDir())], + 'zip' => ['PHP extension ZipArchive (optional)', extension_loaded('zip')], + 'gd' => ['PHP extension GD (optional)', extension_loaded('gd')], + 'xmlw' => ['PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')], + 'xsl' => ['PHP extension XSL (optional)', extension_loaded('xsl')], +]; if (!CLI) { ?>

@@ -28,7 +28,7 @@ echo '

Requirement check:

'; echo '