Skip to content

Commit 63d53ac

Browse files
committed
Use section "style" instead of "settings" for consistency
1 parent a9c9c21 commit 63d53ac

File tree

29 files changed

+103
-83
lines changed

29 files changed

+103
-83
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This release added drawing shapes (arc, curve, line, polyline, rect, oval) eleme
2121
### Deprecated
2222

2323
- `Element\Link::getTarget()` replaced by `Element\Link::getSource()`
24+
- `Element\Section::getSettings()` and `Element\Section::setSettings()` replaced by `Element\Section::getStyle()` and `Element\Section::setStyle()`
2425

2526
### Miscellaneous
2627

docs/containers.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ section. Example:
3232
Section settings
3333
~~~~~~~~~~~~~~~~
3434

35-
Below are the available settings for section:
35+
Below are the available styles for section:
3636

3737
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
3838
'landscape'
@@ -56,8 +56,8 @@ Below are the available settings for section:
5656
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
5757
evenPage, oddPage)
5858

59-
The following two settings are automatically set by the use of the
60-
``orientation`` setting. You can alter them but that's not recommended.
59+
The following two styles are automatically set by the use of the
60+
``orientation`` style. You can alter them but that's not recommended.
6161

6262
- ``pageSizeW`` Page width in twips
6363
- ``pageSizeH`` Page height in twips
@@ -66,7 +66,7 @@ Page number
6666
~~~~~~~~~~~
6767

6868
You can change a section page number by using the ``pageNumberingStart``
69-
property of the section.
69+
style of the section.
7070

7171
.. code-block:: php
7272
@@ -75,13 +75,13 @@ property of the section.
7575
7676
// Method 2
7777
$section = $phpWord->addSection();
78-
$section->getSettings()->setPageNumberingStart(1);
78+
$section->getStyle()->setPageNumberingStart(1);
7979
8080
Multicolumn
8181
~~~~~~~~~~~
8282

8383
You can change a section layout to multicolumn (like in a newspaper) by
84-
using the ``breakType`` and ``colsNum`` property of the section.
84+
using the ``breakType`` and ``colsNum`` style of the section.
8585

8686
.. code-block:: php
8787
@@ -90,14 +90,14 @@ using the ``breakType`` and ``colsNum`` property of the section.
9090
9191
// Method 2
9292
$section = $phpWord->addSection();
93-
$section->getSettings()->setBreakType('continuous');
94-
$section->getSettings()->setColsNum(2);
93+
$section->getStyle()->setBreakType('continuous');
94+
$section->getStyle()->setColsNum(2);
9595
9696
9797
### Line numbering
9898

9999
You can apply line numbering to a section by using the ``lineNumbering``
100-
property of the section.
100+
style of the section.
101101

102102
.. code-block:: php
103103
@@ -106,7 +106,7 @@ property of the section.
106106
107107
// Method 2
108108
$section = $phpWord->addSection();
109-
$section->getSettings()->setLineNumbering(array());
109+
$section->getStyle()->setLineNumbering(array());
110110
111111
Below are the properties of the line numbering style.
112112

docs/general.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ points to twips.
138138
);
139139
140140
$section = $phpWord->addSection();
141-
$sectionStyle = $section->getSettings();
141+
$sectionStyle = $section->getStyle();
142142
// half inch left margin
143143
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
144144
// 2 cm right margin

docs/src/documentation.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ $phpWord->addParagraphStyle('My Style', array(
304304
);
305305

306306
$section = $phpWord->addSection();
307-
$sectionStyle = $section->getSettings();
307+
$sectionStyle = $section->getStyle();
308308
// half inch left margin
309309
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
310310
// 2 cm right margin
@@ -333,9 +333,9 @@ $sectionSettings = array(
333333
);
334334
```
335335

336-
### Section settings
336+
### Section style
337337

338-
Below are the available settings for section:
338+
Below are the available styles for section:
339339

340340
- `orientation` Page orientation, i.e. 'portrait' (default) or 'landscape'
341341
- `marginTop` Page margin top in twips
@@ -357,49 +357,49 @@ Below are the available settings for section:
357357
- `colsSpace` Spacing between columns
358358
- `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
359359

360-
The following two settings are automatically set by the use of the `orientation` setting. You can alter them but that's not recommended.
360+
The following two styles are automatically set by the use of the `orientation` style. You can alter them but that's not recommended.
361361

362362
- `pageSizeW` Page width in twips
363363
- `pageSizeH` Page height in twips
364364

365365
### Page number
366366

367-
You can change a section page number by using the `pageNumberingStart` property of the section.
367+
You can change a section page number by using the `pageNumberingStart` style of the section.
368368

369369
```php
370370
// Method 1
371371
$section = $phpWord->addSection(array('pageNumberingStart' => 1));
372372

373373
// Method 2
374374
$section = $phpWord->addSection();
375-
$section->getSettings()->setPageNumberingStart(1);
375+
$section->getStyle()->setPageNumberingStart(1);
376376
```
377377

378378
### Multicolumn
379379

380-
You can change a section layout to multicolumn (like in a newspaper) by using the `breakType` and `colsNum` property of the section.
380+
You can change a section layout to multicolumn (like in a newspaper) by using the `breakType` and `colsNum` style of the section.
381381

382382
```php
383383
// Method 1
384384
$section = $phpWord->addSection(array('breakType' => 'continuous', 'colsNum' => 2));
385385

386386
// Method 2
387387
$section = $phpWord->addSection();
388-
$section->getSettings()->setBreakType('continuous');
389-
$section->getSettings()->setColsNum(2);
388+
$section->getStyle()->setBreakType('continuous');
389+
$section->getStyle()->setColsNum(2);
390390
```
391391

392392
### Line numbering
393393

394-
You can apply line numbering to a section by using the `lineNumbering` property of the section.
394+
You can apply line numbering to a section by using the `lineNumbering` style of the section.
395395

396396
```php
397397
// Method 1
398398
$section = $phpWord->addSection(array('lineNumbering' => array()));
399399

400400
// Method 2
401401
$section = $phpWord->addSection();
402-
$section->getSettings()->setLineNumbering(array());
402+
$section->getStyle()->setLineNumbering(array());
403403
```
404404

405405
Below are the properties of the line numbering style.

src/PhpWord/Element/AbstractElement.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,14 @@ public function isInSection()
343343
}
344344

345345
/**
346-
* Set style value
346+
* Set new style value
347347
*
348348
* @param mixed $styleObject Style object
349349
* @param mixed $styleValue Style value
350350
* @param bool $returnObject Always return object
351351
* @return mixed
352352
*/
353-
protected function setStyle($styleObject, $styleValue = null, $returnObject = false)
353+
protected function setNewStyle($styleObject, $styleValue = null, $returnObject = false)
354354
{
355355
if (!is_null($styleValue) && is_array($styleValue)) {
356356
$styleObject->setStyleByArray($styleValue);

src/PhpWord/Element/Cell.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Cell extends AbstractContainer
5252
public function __construct($width = null, $style = null)
5353
{
5454
$this->width = $width;
55-
$this->style = $this->setStyle(new CellStyle(), $style, true);
55+
$this->style = $this->setNewStyle(new CellStyle(), $style, true);
5656
}
5757

5858
/**

src/PhpWord/Element/Endnote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ class Endnote extends Footnote
3838
*/
3939
public function __construct($paragraphStyle = null)
4040
{
41-
$this->paragraphStyle = $this->setStyle(new Paragraph(), $paragraphStyle);
41+
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
4242
}
4343
}

src/PhpWord/Element/Footnote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Footnote extends AbstractContainer
5050
*/
5151
public function __construct($paragraphStyle = null)
5252
{
53-
$this->paragraphStyle = $this->setStyle(new Paragraph(), $paragraphStyle);
53+
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
5454
$this->setDocPart($this->container);
5555
}
5656

src/PhpWord/Element/Image.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function __construct($source, $style = null, $watermark = false)
131131
{
132132
$this->source = $source;
133133
$this->setIsWatermark($watermark);
134-
$this->style = $this->setStyle(new ImageStyle(), $style, true);
134+
$this->style = $this->setNewStyle(new ImageStyle(), $style, true);
135135

136136
$this->checkImage($source);
137137
}

src/PhpWord/Element/Line.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Line extends AbstractElement
3838
*/
3939
public function __construct($style = null)
4040
{
41-
$this->style = $this->setStyle(new LineStyle(), $style);
41+
$this->style = $this->setNewStyle(new LineStyle(), $style);
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)