Function setGroupOptions
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
{
$childDomElement = $domDocument->documentElement->firstChild;
if (!$childDomElement instanceof \DOMElement) {
return $this;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse()
{
if ('' === $this->html) {
return null;
}
Function parse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function parse()
{
if ('' === $this->html) {
return null;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method setGroupOptions
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
{
$childDomElement = $domDocument->documentElement->firstChild;
if (!$childDomElement instanceof \DOMElement) {
return $this;
The method setGroupOptions() has an NPath complexity of 13122. The configured NPath complexity threshold is 200. Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
{
$childDomElement = $domDocument->documentElement->firstChild;
if (!$childDomElement instanceof \DOMElement) {
return $this;
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method parse() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function parse()
{
if ('' === $this->html) {
return null;
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method setGroupOptions() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
{
$childDomElement = $domDocument->documentElement->firstChild;
if (!$childDomElement instanceof \DOMElement) {
return $this;
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. Open
public function parse()
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 25 to the 15 allowed. Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '209', column '23'). Open
$domDocument = new \DOMDocument();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '231', column '24'). Open
$rootElement = (new \YetiForcePDF\Html\Element())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getHtmlPageGroups uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pageGroups[] = substr($html, $start);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Rename "$pageGroups" which has the same name as the field declared at line 43. Open
$pageGroups = [];
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Rename "$domDocument" which has the same name as the field declared at line 28. Open
$domDocument = new \DOMDocument();
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Spaces must be used to indent lines; tabs are not allowed Open
* @var array page groups with html content divided
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return preg_replace('/\n/', "\r", $html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHtmlPageGroups(string $html)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($pageGroups)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function cleanUpHtml(string $html)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $html
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->html = htmlspecialchars_decode($html, ENT_HTML5);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->html = $this->cleanUpHtml($html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stop = $matches[$i + 1][1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set page group options.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// ~0 - negated 0 - convert negation of nothing (so convert all)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$len = $stop - $start;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $html = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Cleanup html.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function loadHtml(string $html, string $fromEncoding): self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->html;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $html
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($matches[$i + 1])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $fromEncoding
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// 0 - do not ommit any unicode char
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $pageGroups;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html = preg_replace('/\r\n/', "\r", $html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Divide html into page groups.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroups[] = substr($html, $start);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Load html string.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get html.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$groupsCount = \count($matches);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroups[] = substr($html, $start, $len);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = 0; $i < $groupsCount; ++$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \DOMDocument $domDocument
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setGroupOptions(PageGroupBox $root, \DOMDocument $domDocument)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $html
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->html = mb_encode_numericentity($this->html, [0x80, 0x10FFFF, 0, ~0], $fromEncoding);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return preg_replace('/<!--((?!-->))[\w\W]+-->/uUi', '', $html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \DOMDocument
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $html
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $domDocument;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHtml(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove comment blocks.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroups = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$matches = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$matches = $matches[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = $matches[$i][1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $htmlPageGroups = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [$html];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// 0x10FFFF - end of unicode range
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function removeComments(string $html)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $pageGroups = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $fromEncoding
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Parser
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// 0x80 - start of unicode range
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
preg_match_all('/\<div\s+data-page-group\s?/ui', $html, $matches, PREG_OFFSET_CAPTURE);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PageGroupBox $root
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->marginTop) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-header-top')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup = (new PageGroupBox())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->format = $this->document->getDefaultFormat();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setGroupOptions($pageGroup, $domDocument);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page = $this->document->addPage($pageGroup->format, $pageGroup->orientation);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->setStyle($rootElement->parseStyle());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->document->getPages($groupIndex) as $page) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginRight = (float) $childDomElement->getAttribute('data-margin-right');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-margin-top')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginBottom = 40;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument->encoding = 'UTF-8';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->marginRight = $margins['right'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rootElement = (new \YetiForcePDF\Html\Element())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->document->getPages($groupIndex) as $page) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getBox()->replacePageNumbers();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getContentStream()->addRawContent($box->getInstructions());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument->loadHTML('<div id="yetiforcepdf">' . $htmlPageGroup . '</div>', LIBXML_HTML_NOIMPLIED | LIBXML_NOWARNING | LIBXML_NOBLANKS | LIBXML_NOERROR);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->setElement($rootElement);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$childDomElement instanceof \DOMElement) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-format')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->orientation = $childDomElement->getAttribute('data-orientation');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function parse()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->format = 'A4';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->orientation) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->orientation = 'P';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->marginLeft) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->footerBottom) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Convert loaded html to pdf objects.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->init();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$margins = $this->document->getDefaultMargins();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->marginTop = $margins['top'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rootElement->init();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getBox()->getStyle()->fixDomTree();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$children = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->footerBottom = (float) $childDomElement->getAttribute('data-footer-bottom');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument->strictErrorChecking = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->marginRight) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->htmlPageGroups = $this->getHtmlPageGroups($this->html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->orientation = $this->document->getDefaultOrientation();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setDOMElement($domDocument->documentElement);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->breakOverflow();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($children as $box) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->headerTop) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument->recover = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->marginBottom = $margins['bottom'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->setUpAbsoluteBoxes();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getBox()->getAllChildren($children);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->setMargins($pageGroup->marginLeft, $pageGroup->marginTop, $pageGroup->marginRight, $pageGroup->marginBottom);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$childDomElement = $domDocument->documentElement->firstChild;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->headerTop = (float) $childDomElement->getAttribute('data-header-top');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' === $this->html) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->htmlPageGroups as $groupIndex => $htmlPageGroup) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument->substituteEntities = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->marginLeft = $margins['left'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->format) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-orientation')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->headerTop = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->footerBottom = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->setPageNumber(1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// root element must be defined before initialisation
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->getStyle()->fixDomTree();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->document->getPages($groupIndex) as $page) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->document->getPages($groupIndex) as $page) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->document->fixPageNumbers();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginLeft = (float) $childDomElement->getAttribute('data-margin-left');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginBottom = (float) $childDomElement->getAttribute('data-margin-bottom');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->html = $this->removeComments($this->html);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->setGroup($groupIndex);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->layout();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getBox()->breakPageAfter();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-margin-right')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginTop = 40;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$domDocument = new \DOMDocument();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setDocument($this->document)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setRoot(true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->document->setCurrentPage($page);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$box instanceof \YetiForcePDF\Layout\LineBox && $box->isRenderable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->format = $childDomElement->getAttribute('data-format');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-margin-left')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginRight = 30;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$root->marginBottom) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-footer-bottom')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setDocument($this->document)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->buildTree();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->getBox()->spanAllRows();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginLeft = 30;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$root->marginTop = (float) $childDomElement->getAttribute('data-margin-top');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($childDomElement->hasAttribute('data-margin-bottom')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$domDocument->loadHTML('<div id="yetiforcepdf">' . $htmlPageGroup . '</div>', LIBXML_HTML_NOIMPLIED | LIBXML_NOWARNING | LIBXML_NOBLANKS | LIBXML_NOERROR);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$page->setMargins($pageGroup->marginLeft, $pageGroup->marginTop, $pageGroup->marginRight, $pageGroup->marginBottom);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageGroup->fixTables();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$page->setBox($pageGroup);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks