lib/Objects/Meta.php
Function render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
public function render(): string
{
if ($this->title) {
$this->addValue('Title', $this->document->filterText($this->title, 'UTF-16', true, true));
}
- 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
Define a constant instead of duplicating this literal "UTF-16" 6 times. Open
Open
$this->addValue('Title', $this->document->filterText($this->title, 'UTF-16', true, true));
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $author = 'YetiForce';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $subject = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $keywords = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->author = $author;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $title = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $author
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $producer = 'YetiForcePDF';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get author.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setTitle(string $title)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->keywords;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function render(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!empty($this->keywords) && '' !== trim(implode('', $this->keywords))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Keywords', $this->document->filterText(implode(', ', $this->keywords), 'UTF-16', true, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $producer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setSubject(string $subject)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get subject.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
unset($keyword);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set author.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setAuthor(string $author)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get creator.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getCreator()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->keywords = $keywords;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $creator = 'YetiForceCRM';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $title
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->title;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set keywords.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Creator', $this->document->filterText($this->creator, 'UTF-16', true, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->title = $title;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getTitle()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->creator = $creator;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get keywords.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->author;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get producer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Get title.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
foreach ($keywords as &$keyword) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->creator;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getAuthor()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->producer = $producer;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set title.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set producer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->subject = $subject;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getProducer()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->subject;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set subject.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string[] $keywords
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Author', $this->document->filterText($this->author, 'UTF-16', true, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($this->producer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Set creator.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setCreator(string $creator)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setProducer(string $producer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->producer;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getSubject()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getKeywords()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($this->title) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($this->author) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $creator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function setKeywords(array $keywords)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Subject', $this->document->filterText($this->subject, 'UTF-16', true, true));
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
Open
$this->addValue('Keywords', $this->document->filterText(implode(', ', $this->keywords), 'UTF-16', true, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Title', $this->document->filterText($this->title, 'UTF-16', true, true));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($this->subject) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($this->creator) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return parent::render();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* @param string $subject
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$keyword = trim($keyword);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->addValue('Producer', $this->document->filterText($this->producer, 'UTF-16', true, true));
- Exclude checks