Avoid using static access to class '\App\Language' in method 'process'. Open
['label' => \App\Language::translate('SINGLE_IStorages', $this->textParser->moduleName), 'width' => '50%', 'align' => 'left'],
- 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 '\App\Language' in method 'process'. Open
['label' => \App\Language::translate('LBL_STORAGE_OWNER', $this->textParser->moduleName), 'width' => '40%', 'align' => 'center'],
- 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 '\App\Language' in method 'process'. Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- 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
Define a constant instead of duplicating this literal "width" 4 times. Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- 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.
Define a constant instead of duplicating this literal "align" 7 times. Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- 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.
Define a constant instead of duplicating this literal "label" 4 times. Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- 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.
Reference to instance property record
from undeclared class \App\TextParser
Open
$hierarchy = $this->textParser->recordModel->getEntity()->getHierarchy($this->textParser->record, false, false);
- Exclude checks
Reference to instance property recordModel
from undeclared class \App\TextParser
Open
$hierarchy = $this->textParser->recordModel->getEntity()->getHierarchy($this->textParser->record, false, false);
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
['label' => \App\Language::translate('LBL_STORAGE_OWNER', $this->textParser->moduleName), 'width' => '40%', 'align' => 'center'],
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- Exclude checks
Reference to instance property moduleName
from undeclared class \App\TextParser
Open
['label' => \App\Language::translate('SINGLE_IStorages', $this->textParser->moduleName), 'width' => '50%', 'align' => 'left'],
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class IStorages_TableHierarchy_Textparser extends \App\TextParser\Base
- Exclude checks
The class IStorages_TableHierarchy_Textparser is not named in CamelCase. Open
class IStorages_TableHierarchy_Textparser extends \App\TextParser\Base
{
/** @var string Class name */
public $name = 'LBL_TABLE_HIERARCHY';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
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 $name = 'LBL_TABLE_HIERARCHY';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['label' => \App\Language::translate('SINGLE_IStorages', $this->textParser->moduleName), 'width' => '50%', 'align' => 'left'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '<th style="width:' . $thData['width'] . ';text-align:' . $thData['align'] . ';">' . $thData['label'] . '</th>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$rowNum;
- 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
$rowNum = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['label' => \App\Language::translate('LBL_STORAGE_OWNER', $this->textParser->moduleName), 'width' => '40%', 'align' => 'center'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Class name */
- 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 process()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '.storagesTable td,.storagesTable th{padding:5px}';
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$html .= '<th style="width:' . $thData['width'] . ';text-align:' . $thData['align'] . ';">' . $thData['label'] . '</th>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html = '<style>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '.storagesTable tbody tr:nth-child(odd){background:#eee}';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- 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
$hierarchy = $this->textParser->recordModel->getEntity()->getHierarchy($this->textParser->record, false, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '<table class="storagesTable"><thead><tr>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var mixed Parser type */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$thDataArray = [
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
['label' => \App\Language::translate('LBL_STORAGE_OWNER', $this->textParser->moduleName), 'width' => '40%', 'align' => 'center'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '.storagesTable{width:100%;font-size:10px;border:1px solid #ddd;border-collapse:collapse}';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
['label' => \App\Language::translate('LBL_ROW_NUM', $this->textParser->moduleName), 'width' => '10%', 'align' => 'center'],
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
['label' => \App\Language::translate('SINGLE_IStorages', $this->textParser->moduleName), 'width' => '50%', 'align' => 'left'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $html . '</tbody></table>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '</tr></thead><tbody>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '<td style="text-align:' . $thDataArray[1]['align'] . ';">' . $entry[0] . '</td>';
- 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 ($thDataArray as $thData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($hierarchy['entries'] as $entry) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '<td style="text-align:' . $thDataArray[2]['align'] . ';">' . $entry[1] . '</td></tr>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $type = 'pdf';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Process.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$html .= '</style>';
- 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 .= '<tr><td style="text-align:' . $thDataArray[0]['align'] . ';">' . $rowNum . '.</td>';
- 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
Class name "IStorages_TableHierarchy_Textparser" is not in camel caps format Open
class IStorages_TableHierarchy_Textparser extends \App\TextParser\Base
- Exclude checks