Skip to content

Commit

Permalink
CodeStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
fisharebest committed Sep 8, 2021
1 parent c69b134 commit 5213572
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions app/Report/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

namespace Fisharebest\Webtrees\Report;

use Fisharebest\Webtrees\Functions\FunctionsRtl;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\MediaFile;
use Fisharebest\Webtrees\Webtrees;
Expand Down Expand Up @@ -622,7 +621,7 @@ public function getTextCellHeight(string $str): float
$nl = $this->countLines($str);

// Calculate the cell height
return ceil(($this->getCurrentStyleHeight() * $this->cellHeightRatio) * $nl);
return ceil($this->getCurrentStyleHeight() * $this->cellHeightRatio * $nl);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/Report/PdfRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function body(): void
public function footnotes(): void
{
foreach ($this->printedfootnotes as $element) {
if (($this->tcpdf->GetY() + $element->getFootnoteHeight($this)) > $this->tcpdf->getPageHeight()) {
if ($this->tcpdf->GetY() + $element->getFootnoteHeight($this) > $this->tcpdf->getPageHeight()) {
$this->tcpdf->AddPage();
}

Expand Down Expand Up @@ -334,10 +334,10 @@ public function getMaxLineWidth(): float
{
$m = $this->tcpdf->getMargins();
if ($this->tcpdf->getRTL()) {
return ($this->tcpdf->getRemainingWidth() + $m['right']);
return $this->tcpdf->getRemainingWidth() + $m['right'];
}

return ($this->tcpdf->getRemainingWidth() + $m['left']);
return $this->tcpdf->getRemainingWidth() + $m['left'];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions app/Report/ReportHtmlCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function render($renderer)
$this->width = $renderer->getRemainingWidth();
}
// We have to calculate a different width for the padding, counting on both side
$cW = $this->width - ($cP * 2);
$cW = $this->width - $cP * 2;

// If there is any text
if (!empty($temptext)) {
Expand Down Expand Up @@ -202,12 +202,12 @@ public function render($renderer)
$renderer->lastCellHeight = $this->height;
} elseif ($this->newline === 1) {
// -> On a new line at the margin - Default
$renderer->setXy(0, $renderer->getY() + $this->height + ($cP * 2));
$renderer->setXy(0, $renderer->getY() + $this->height + $cP * 2);
// Reset the last cell height for the next line
$renderer->lastCellHeight = 0;
} elseif ($this->newline === 2) {
// -> On a new line at the end of this cell
$renderer->setXy($renderer->getX() + $this->width, $renderer->getY() + $this->height + ($cP * 2));
$renderer->setXy($renderer->getX() + $this->width, $renderer->getY() + $this->height + $cP * 2);
// Reset the last cell height for the next line
$renderer->lastCellHeight = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Report/ReportHtmlFootnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function getFootnoteHeight($html, float $cellWidth = 0): float
$ct = substr_count($this->text, "\n");
$fsize = $html->getCurrentStyleHeight();

return ($fsize * $ct) * $html->cellHeightRatio;
return $fsize * $ct * $html->cellHeightRatio;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions app/Report/ReportHtmlImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function render($renderer)
if ($this->y === ReportBaseElement::CURRENT_POSITION) {
//-- first check for a collision with the last picture
if ($lastpicbottom !== null && $renderer->pageNo() === $lastpicpage && $lastpicbottom >= $renderer->getY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) {
$renderer->setY($lastpicbottom + ($renderer->cPadding * 2));
$renderer->setY($lastpicbottom + $renderer->cPadding * 2);
}
$this->y = $renderer->getY();
}
Expand Down Expand Up @@ -88,6 +88,6 @@ public function render($renderer)
*/
public function getHeight($renderer): float
{
return $this->height + ($renderer->cPadding * 2);
return $this->height + $renderer->cPadding * 2;
}
}
2 changes: 1 addition & 1 deletion app/Report/ReportHtmlText.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getHeight($renderer): float
}
$style = $renderer->getStyle($this->styleName);

return ($style['size'] * $ct) * $renderer->cellHeightRatio;
return $style['size'] * $ct * $renderer->cellHeightRatio;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions app/Report/ReportHtmlTextbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function render($renderer)
}

// For padding, we have to use less wrap width
$cW = $this->width - ($cP * 2);
$cW = $this->width - $cP * 2;

//-- calculate the text box height
// Number of lines, will be converted to height
Expand Down Expand Up @@ -242,9 +242,9 @@ public function render($renderer)
// Border setup
if ($this->border) {
echo ' border:solid black 1pt;';
echo 'width:', ($this->width - 1 - ($cP * 2)), 'pt;height:', $cH - 1, 'pt;';
echo 'width:', $this->width - 1 - $cP * 2, 'pt;height:', $cH - 1, 'pt;';
} else {
echo 'width:', ($this->width - ($cP * 2)), 'pt;height:', $cH, 'pt;';
echo 'width:', $this->width - $cP * 2, 'pt;height:', $cH, 'pt;';
}
echo '">';

Expand Down Expand Up @@ -279,7 +279,7 @@ public function render($renderer)
$renderer->setXy($cX + $this->width, $this->top);
$renderer->lastCellHeight = $cH;
} else {
$renderer->setXy(0, $this->top + $cH + ($cP * 2));
$renderer->setXy(0, $this->top + $cH + $cP * 2);
$renderer->lastCellHeight = 0;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/Report/ReportPdfCell.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public function render($renderer)
$cM = $renderer->tcpdf->getMargins();
// Add padding
if (is_array($cM['cell'])) {
$cHT += ($cM['padding_bottom'] + $cM['padding_top']);
$cHT += $cM['padding_bottom'] + $cM['padding_top'];
} else {
$cHT += ($cM['cell'] * 2);
$cHT += $cM['cell'] * 2;
}
// Add a new page if needed
if ($renderer->checkPageBreakPDF($cHT)) {
Expand Down
8 changes: 4 additions & 4 deletions app/Report/ReportPdfTextBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function render($renderer)
}
// Save the Footnote with it’s link number as key for sorting later
$footnote_element[$element->num] = $element;
} elseif (!($element instanceof ReportPdfFootnote) || trim($element->getValue()) != '') {
} elseif (!$element instanceof ReportPdfFootnote || trim($element->getValue()) != '') {
// Do not keep empty footnotes
if (!empty($footnote_element)) {
ksort($footnote_element);
Expand Down Expand Up @@ -155,7 +155,7 @@ public function render($renderer)
if (is_array($cM['cell'])) {
$cWT = $cW - ($cM['padding_left'] + $cM['padding_right']);
} else {
$cWT = $cW - ($cM['cell'] * 2);
$cWT = $cW - $cM['cell'] * 2;
}
// Element height (exept text)
$eH = 0;
Expand Down Expand Up @@ -209,9 +209,9 @@ public function render($renderer)
// Add cell padding
if ($this->padding) {
if (is_array($cM['cell'])) {
$cHT += ($cM['padding_bottom'] + $cM['padding_top']);
$cHT += $cM['padding_bottom'] + $cM['padding_top'];
} else {
$cHT += ($cM['cell'] * 2);
$cHT += $cM['cell'] * 2;
}
}
if ($cH < $cHT) {
Expand Down

0 comments on commit 5213572

Please sign in to comment.