Additional Scrutinizer Recommendations
Some more editorial changes.
This commit is contained in:
parent
7657992a83
commit
5e64b26451
|
|
@ -29,24 +29,22 @@ class Title extends Text
|
||||||
/** @var \PhpOffice\PhpWord\Element\Title $element Type hint */
|
/** @var \PhpOffice\PhpWord\Element\Title $element Type hint */
|
||||||
$element = $this->element;
|
$element = $this->element;
|
||||||
$style = $element->getStyle();
|
$style = $element->getStyle();
|
||||||
if (is_string($style)) {
|
$style = str_replace('Heading', 'Heading_', $style);
|
||||||
$style = str_replace('Heading', 'Heading_', $style);
|
$style = \PhpOffice\PhpWord\Style::getStyle($style);
|
||||||
$style = \PhpOffice\PhpWord\Style::getStyle($style);
|
if ($style instanceof \PhpOffice\PhpWord\Style\Font) {
|
||||||
if ($style instanceof \PhpOffice\PhpWord\Style\Font) {
|
$this->fontStyle = $style;
|
||||||
$this->fontStyle = $style;
|
$pstyle = $style->getParagraph();
|
||||||
$pstyle = $style->getParagraph();
|
if ($pstyle instanceof \PhpOffice\PhpWord\Style\Paragraph && $pstyle->hasPageBreakBefore()) {
|
||||||
if ($pstyle instanceof \PhpOffice\PhpWord\Style\Paragraph && $pstyle->hasPageBreakBefore()) {
|
$sect = $element->getParent();
|
||||||
$sect = $element->getParent();
|
if ($sect instanceof \PhpOffice\PhpWord\Element\Section) {
|
||||||
if ($sect instanceof \PhpOffice\PhpWord\Element\Section) {
|
$elems = $sect->getElements();
|
||||||
$elems = $sect->getElements();
|
if ($elems[0] === $element) {
|
||||||
if ($elems[0] === $element) {
|
$pstyle = clone $pstyle;
|
||||||
$pstyle = clone $pstyle;
|
$pstyle->setPageBreakBefore(false);
|
||||||
$pstyle->setPageBreakBefore(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->paragraphStyle = $pstyle;
|
|
||||||
}
|
}
|
||||||
|
$this->paragraphStyle = $pstyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +55,7 @@ class Title extends Text
|
||||||
*/
|
*/
|
||||||
public function write()
|
public function write()
|
||||||
{
|
{
|
||||||
/** @var \PhpOffice\PhpWord\Element\Text $element Type hint */
|
/** @var \PhpOffice\PhpWord\Element\Title $element Type hint */
|
||||||
$element = $this->element;
|
$element = $this->element;
|
||||||
$elementClass = str_replace('\\Writer\\RTF', '', get_class($this));
|
$elementClass = str_replace('\\Writer\\RTF', '', get_class($this));
|
||||||
if (!$element instanceof $elementClass || !is_string($element->getText())) {
|
if (!$element instanceof $elementClass || !is_string($element->getText())) {
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,6 @@ class Paragraph extends AbstractStyle
|
||||||
Jc::END => '\qr',
|
Jc::END => '\qr',
|
||||||
Jc::CENTER => '\qc',
|
Jc::CENTER => '\qc',
|
||||||
Jc::BOTH => '\qj',
|
Jc::BOTH => '\qj',
|
||||||
"left" => '\ql',
|
|
||||||
"right" => '\qr',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$spaceAfter = $style->getSpaceAfter();
|
$spaceAfter = $style->getSpaceAfter();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue