Function process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
$qualifiedModuleName = $request->getModule(false);
$toInstall = \App\YetiForce\Updater::getToInstall();
- 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
Avoid using static access to class 'Settings_Updates_Module_Model' in method 'process'. Open
$viewer->assign('INSTALLED', Settings_Updates_Module_Model::getUpdates());
- 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\YetiForce\Updater' in method 'process'. Open
$toInstall = \App\YetiForce\Updater::getToInstall();
- 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\YetiForce\Updater' in method 'process'. Open
\App\YetiForce\Updater::download($package);
- 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
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('TO_INSTALL', $toInstall);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('INSTALLED', Settings_Updates_Module_Model::getUpdates());
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Updates_Index_View extends Settings_Vtiger_Index_View
- Exclude checks
The class Settings_Updates_Index_View is not named in CamelCase. Open
class Settings_Updates_Index_View extends Settings_Vtiger_Index_View
{
public function process(App\Request $request)
{
$viewer = $this->getViewer($request);
- 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
Expected 1 space after "as"; 2 found Open
foreach ($toInstall as $package) {
- 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
$viewer->view('Index.tpl', $qualifiedModuleName);
- 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
$qualifiedModuleName = $request->getModule(false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($toInstall as $package) {
- 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
$viewer->assign('TO_INSTALL', $toInstall);
- 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
$viewer = $this->getViewer($request);
- 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
$download = $request->getByType('download', 'Alnum');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$toInstall = \App\YetiForce\Updater::getToInstall();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($package['hash'] === $download) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\YetiForce\Updater::download($package);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('INSTALLED', Settings_Updates_Module_Model::getUpdates());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$request->isEmpty('download')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Class name "Settings_Updates_Index_View" is not in camel caps format Open
class Settings_Updates_Index_View extends Settings_Vtiger_Index_View
- Exclude checks