Function process
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function process(): void
{
try {
$checker = (new \App\Security\Dependency())->securityChecker();
$this->status = $checker ? 0 : 1;
- 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
Missing class import via use statement (line '34', column '20'). Open
$checker = (new \App\Security\Dependency())->securityChecker();
- 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 '\App\Security\AdminAccess' in method 'process'. Open
if (\App\Security\AdminAccess::isPermitted('Dependencies')) {
- 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
$this->linkTitle = \App\Language::translate('Security', 'Settings:SystemWarnings');
- 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
$this->description = \App\Language::translate('LBL_VULNERABILITIES_IN_DEPENDENCIES_DESC', 'Settings:SystemWarnings') . '<br />';
- 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
$this->description .= '<h3><u>' . \App\Language::translate("LBL_SECURITY_{$type}", 'Settings:Dependencies') . ':</u></h3><br />';
- 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
Reference to undeclared property \App\SystemWarnings\Security\Dependencies->linkTitle
Open
$this->linkTitle = \App\Language::translate('Security', 'Settings:SystemWarnings');
- 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(): void
- 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
$checker = (new \App\Security\Dependency())->securityChecker();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->link = 'index.php?module=Dependencies&parent=Settings&view=Vulnerabilities';
- Exclude checks
Line exceeds 120 characters; contains 176 characters Open
$this->description .= "<li><h5><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"{$data['link']}\">{$data['cve']}</a></h5> {$data['title']}</li>";
- 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->status = $checker ? 0 : 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $priority = 9;
- 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->status = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($vulnerabilities as $name => $vulnerability) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description .= "<h4>$name ({$vulnerability['version']}):</h4><br />";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $title = 'LBL_VULNERABILITIES_IN_DEPENDENCIES';
- 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 (\App\Security\AdminAccess::isPermitted('Dependencies')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description .= "<li><h5><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"{$data['link']}\">{$data['cve']}</a></h5> {$data['title']}</li>";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Checks if encryption is active.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description = \App\Language::translate('LBL_VULNERABILITIES_IN_DEPENDENCIES_DESC', 'Settings:SystemWarnings') . '<br />';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description .= '<h3><u>' . \App\Language::translate("LBL_SECURITY_{$type}", 'Settings:Dependencies') . ':</u></h3><br />';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->linkTitle = \App\Language::translate('Security', 'Settings:SystemWarnings');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$this->description = \App\Language::translate('LBL_VULNERABILITIES_IN_DEPENDENCIES_DESC', 'Settings:SystemWarnings') . '<br />';
- 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
/** {@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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($checker as $type => $vulnerabilities) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($vulnerability['advisories'] as $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description .= '</ul><hr />';
- 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
if (0 === $this->status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = strtoupper($type);
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$this->description .= '<h3><u>' . \App\Language::translate("LBL_SECURITY_{$type}", 'Settings:Dependencies') . ':</u></h3><br />';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->description .= '<ul>';
- 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