Method getInstructions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getInstructions(): string
{
$style = $this->getStyle();
$rules = $style->getRules();
$graphicState = $this->style->getGraphicState();
Missing class import via use statement (line '38', column '23'). Open
$this->style = (new \YetiForcePDF\Style\Style())
- 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
Avoid using static access to class '\YetiForcePDF\Math' in method 'measurePosition'. Open
$this->getCoordinates()->setX(Math::add($parent->getCoordinates()->getX(), $this->getOffset()->getLeft()));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\YetiForcePDF\Math' in method 'getInstructions'. Open
$baseLineY = Math::sub($pdfY, $baseLine);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\YetiForcePDF\Math' in method 'measurePosition'. Open
$this->getCoordinates()->setY(Math::add($parent->getCoordinates()->getY(), $this->getOffset()->getTop()));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
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
{
- 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
$this->getOffset()->setLeft('0');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get element PDF instructions to use in content stream.
- 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
$rules = $style->getRules();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$graphicStateStr,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transform,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'BT',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'q',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* {@inheritdoc}
- 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
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getDimensions()->setHeight($this->getStyle()->getFont()->getTextHeight($this->getText()));
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Position.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getCoordinates()->setY(Math::add($parent->getCoordinates()->getY(), $this->getOffset()->getTop()));
- 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
$baseLineY = Math::sub($pdfY, $baseLine);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$element = array_merge($element, [
- 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
$graphicState = $this->style->getGraphicState();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$graphicStateStr = '/' . $graphicState->getNumber() . ' gs';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$font = $style->getFont();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"0 0 $textWidth $textHeight re",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Q',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return implode("\n", $element);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set text.
- 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
$pdfX = $coordinates->getPdfX();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textHeight = $style->getFont()->getTextHeight();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'q',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected string $text;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get text.
- 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 measureHeight(): self
- 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
$this->offset = clone $this->offset;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ET',
- 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 $this->text;
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"1 0 0 1 $pdfX $pdfY cm",
- 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 measurePosition(): self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->style = clone $this->style;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->dimensions = clone $this->dimensions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$coordinates = $this->getCoordinates();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setBox($this)
- 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
$this->getCoordinates()->setX(Math::add($parent->getCoordinates()->getX(), $this->getOffset()->getLeft()));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->coordinates = clone $this->coordinates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->children = [];
- 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
{
- 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
$this->getDimensions()->setWidth($this->getStyle()->getFont()->getTextWidth($this->getText()));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Position.
- 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
$baseLine = $style->getFont()->getDescender();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$element = [
- 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
public function getText(): 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
$style = $this->getStyle();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdfY = $coordinates->getPdfY();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transform = $style->getTransformations($pdfX, $baseLineY);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'1 w',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'1 0 0 RG',
- 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
parent::init();
- 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
* Measure width.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function measureWidth(): self
- 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
$fontStr = '/' . $font->getNumber() . ' ' . $font->getSize() . ' Tf';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textContent = $this->document->filterText($this->getText());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'Q',
- 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
->init();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setText(string $text): self
- 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
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Measure height.
- 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 ($this->drawTextOutline) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public bool $drawTextOutline = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->style = (new \YetiForcePDF\Style\Style())
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textWidth = $style->getFont()->getTextWidth($this->getText());
- 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 init()
- 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 measureOffset(): self
- 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
$this->getOffset()->setTop('0');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parent = $this->getParent();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getInstructions(): 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
* @return string
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __clone()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"{$rules['color'][0]} {$rules['color'][1]} {$rules['color'][2]} rg",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fontStr,
- 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
* @param string $text
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->text = $text;
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"$textContent Tj",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'S',
- Exclude checks