Function Form_Create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function Form_Create() {
$strPluginName = QApplication::QueryString('strName');
$this->strPluginType = QApplication::QueryString('strType');
if (!isset($strPluginName) || !isset($this->strPluginType) ||
strlen($strPluginName) == 0 || strlen($this->strPluginType) == 0) {
- 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
Method Form_Create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function Form_Create() {
$strPluginName = QApplication::QueryString('strName');
$this->strPluginType = QApplication::QueryString('strType');
if (!isset($strPluginName) || !isset($this->strPluginType) ||
strlen($strPluginName) == 0 || strlen($this->strPluginType) == 0) {
The method Form_Create() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
protected function Form_Create() {
$strPluginName = QApplication::QueryString('strName');
$this->strPluginType = QApplication::QueryString('strType');
if (!isset($strPluginName) || !isset($this->strPluginType) ||
strlen($strPluginName) == 0 || strlen($this->strPluginType) == 0) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The class PluginEditForm has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
class PluginEditForm extends QForm {
/**
* @var QPlugin the plugin we're currently viewing the details for
*/
private $objPlugin = null;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '130', column '47'). Open
$this->btnCancelInstallation->AddAction(new QClickEvent(), new QAjaxAction('btnCancelInstallation_click'));
- 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
Missing class import via use statement (line '108', column '29'). Open
$this->btnUninstall = new QButton($this);
- 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
Missing class import via use statement (line '111', column '38'). Open
$this->btnUninstall->AddAction(new QClickEvent(), new QAjaxAction('btnUninstall_click'));
- 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
Missing class import via use statement (line '77', column '26'). Open
$this->dlgStatus = new QDialogBox($this);
- 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
Missing class import via use statement (line '92', column '36'). Open
$this->btnInstall->AddAction(new QClickEvent(), new QAjaxAction('btnInstall_click'));
- 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
Missing class import via use statement (line '111', column '57'). Open
$this->btnUninstall->AddAction(new QClickEvent(), new QAjaxAction('btnUninstall_click'));
- 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
Missing class import via use statement (line '128', column '38'). Open
$this->btnCancelInstallation = new QButton($this);
- 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
Missing class import via use statement (line '155', column '33'). Open
$this->lblPluginVersion = new QLabel($this);
- 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
Missing class import via use statement (line '167', column '30'). Open
$this->lblAuthorName = new QLabel($this);
- 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
Missing class import via use statement (line '53', column '14'). Open
throw new Exception("Invalid value of the type URL parameter: " . $this->strPluginType);
- 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
Missing class import via use statement (line '37', column '14'). Open
throw new Exception("Mandatory parameter was not set");
- 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
Missing class import via use statement (line '90', column '27'). Open
$this->btnInstall = new QButton($this);
- 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
Missing class import via use statement (line '110', column '57'). Open
$this->btnUninstall->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to uninstall this plugin?'));
- 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
Missing class import via use statement (line '149', column '31'). Open
$this->lblDescription = new QLabel($this);
- 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
Missing class import via use statement (line '173', column '31'). Open
$this->lblAuthorEmail = new QLabel($this);
- 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
Missing class import via use statement (line '73', column '35'). Open
$this->objDefaultWaitIcon = new QWaitIcon($this);
- 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
Missing class import via use statement (line '130', column '66'). Open
$this->btnCancelInstallation->AddAction(new QClickEvent(), new QAjaxAction('btnCancelInstallation_click'));
- 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
Missing class import via use statement (line '143', column '24'). Open
$this->lblName = new QLabel($this);
- 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
Missing class import via use statement (line '110', column '38'). Open
$this->btnUninstall->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to uninstall this plugin?'));
- 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
Missing class import via use statement (line '161', column '35'). Open
$this->lblPlatformVersion = new QLabel($this);
- 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
Missing class import via use statement (line '193', column '25'). Open
$this->lblFiles = new QLabel($this);
- 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
Missing class import via use statement (line '57', column '14'). Open
throw new Exception ("Plugin not found: " . $strPluginName);
- 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
Missing class import via use statement (line '92', column '55'). Open
$this->btnInstall->AddAction(new QClickEvent(), new QAjaxAction('btnInstall_click'));
- 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 'QPluginInstaller' in method 'btnCancelInstallation_click'. Open
QPluginInstaller::cleanupExtractedFiles(QApplication::QueryString('strName'));
- 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 'QApplication' in method 'lblAuthorEmail_Create'. Open
$this->lblAuthorEmail->Name = QApplication::Translate('Author\'s email');
- 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 'QPluginConfigParser' in method 'Form_Create'. Open
$this->objPlugin = QPluginConfigParser::parseNewPlugin($configFile);
- 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 'QPluginInstaller' in method 'btnInstall_Click'. Open
list($status, $log) = QPluginInstaller::installFromExpanded(QApplication::QueryString('strName'));
- 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 'QApplication' in method 'lblFiles_Create'. Open
$this->lblFiles->Text = count($this->objPlugin->objAllFilesArray) . ' ' . QApplication::Translate("file(s)") . "; ";
- 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 'QApplication' in method 'redirectToListPage'. Open
QApplication::Redirect('plugin_manager.php');
- 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 'QApplication' in method 'Form_Create'. Open
$this->strPluginType = QApplication::QueryString('strType');
- 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 'QPluginConfigParser' in method 'Form_Create'. Open
$installedPlugins = QPluginConfigParser::parseInstalledPlugins();
- 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 'QApplication' in method 'lblFiles_Create'. Open
$this->lblFiles->Text .= count($this->objPlugin->objIncludesArray) . ' ' . QApplication::Translate("include(s)") . "; ";
- 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 'QApplication' in method 'Form_Run'. Open
QApplication::CheckRemoteAdmin();
- 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 'QPluginUninstaller' in method 'btnUninstall_Click'. Open
list($status,$log) = QPluginUninstaller::uninstallExisting(QApplication::QueryString('strName'));
- 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 'QApplication' in method 'btnUninstall_Click'. Open
list($status,$log) = QPluginUninstaller::uninstallExisting(QApplication::QueryString('strName'));
- 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 'QApplication' in method 'lblName_Create'. Open
$this->lblName->Name = QApplication::Translate('Title');
- 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 'QApplication' in method 'lblDescription_Create'. Open
$this->lblDescription->Name = QApplication::Translate('Description');
- 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 'QApplication' in method 'lblPluginVersion_Create'. Open
$this->lblPluginVersion->Name = QApplication::Translate('Plugin Version');
- 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 'QApplication' in method 'lblPlatformVersion_Create'. Open
$this->lblPlatformVersion->Name = QApplication::Translate('Compatible QCubed Version');
- 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 'QApplication' in method 'btnCancelInstallation_click'. Open
QPluginInstaller::cleanupExtractedFiles(QApplication::QueryString('strName'));
- 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
The method Form_Create uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new Exception("Invalid value of the type URL parameter: " . $this->strPluginType);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'QApplication' in method 'btnInstall_Click'. Open
list($status, $log) = QPluginInstaller::installFromExpanded(QApplication::QueryString('strName'));
- 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 'QApplication' in method 'Form_Create'. Open
$strPluginName = QApplication::QueryString('strName');
- 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 'QApplication' in method 'lblAuthorName_Create'. Open
$this->lblAuthorName->Name = QApplication::Translate('Author');
- 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 'QApplication' in method 'lblFiles_Create'. Open
$this->lblFiles->Name = QApplication::Translate("Contains: ");
- 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 'QApplication' in method 'lblFiles_Create'. Open
$this->lblFiles->Text .= count($this->objPlugin->objExamplesArray) . ' ' . QApplication::Translate("example(s)");
- 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 excessively long variable names like $btnCancelInstallation. Keep variable name length under 20. Open
protected $btnCancelInstallation;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
The method Form_Run is not named in camelCase. Open
protected function Form_Run() {
QApplication::CheckRemoteAdmin();
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method Form_Create is not named in camelCase. Open
protected function Form_Create() {
$strPluginName = QApplication::QueryString('strName');
$this->strPluginType = QApplication::QueryString('strType');
if (!isset($strPluginName) || !isset($this->strPluginType) ||
strlen($strPluginName) == 0 || strlen($this->strPluginType) == 0) {
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnCancelInstallation_Create is not named in camelCase. Open
private function btnCancelInstallation_Create() {
$this->btnCancelInstallation = new QButton($this);
$this->btnCancelInstallation->Text = "Cancel Installation";
$this->btnCancelInstallation->AddAction(new QClickEvent(), new QAjaxAction('btnCancelInstallation_click'));
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblPluginVersion_Create is not named in camelCase. Open
private function lblPluginVersion_Create() {
$this->lblPluginVersion = new QLabel($this);
$this->lblPluginVersion->Text = $this->objPlugin->strVersion;
$this->lblPluginVersion->Name = QApplication::Translate('Plugin Version');
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnCancelInstallation_click is not named in camelCase. Open
public function btnCancelInstallation_click() {
QPluginInstaller::cleanupExtractedFiles(QApplication::QueryString('strName'));
self::redirectToListPage();
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblDescription_Create is not named in camelCase. Open
private function lblDescription_Create() {
$this->lblDescription = new QLabel($this);
$this->lblDescription->Text = $this->objPlugin->strDescription;
$this->lblDescription->Name = QApplication::Translate('Description');
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnInstall_Click is not named in camelCase. Open
public function btnInstall_Click() {
list($status, $log) = QPluginInstaller::installFromExpanded(QApplication::QueryString('strName'));
$linkToProceed = "<h2><a href='plugin_manager.php'>Click here to continue</a></h2>";
$this->dlgStatus->Text = $status.'<br/>'.$linkToProceed.'<a href="#" onclick="jQuery(\'#install_details\').toggle()">Details</a><div id="install_details" style="display:none;border:1px solid black;height:300px; overflow-y:auto;margin-top:20px;padding:10px;">'.nl2br($log).'</div>';
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblPlatformVersion_Create is not named in camelCase. Open
private function lblPlatformVersion_Create() {
$this->lblPlatformVersion = new QLabel($this);
$this->lblPlatformVersion->Text = $this->objPlugin->strPlatformVersion;
$this->lblPlatformVersion->Name = QApplication::Translate('Compatible QCubed Version');
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblAuthorEmail_Create is not named in camelCase. Open
private function lblAuthorEmail_Create() {
$this->lblAuthorEmail = new QLabel($this);
$this->lblAuthorEmail->Name = QApplication::Translate('Author\'s email');
$this->lblAuthorEmail->HtmlEntities = false;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblName_Create is not named in camelCase. Open
private function lblName_Create() {
$this->lblName = new QLabel($this);
$this->lblName->Text = $this->objPlugin->strName;
$this->lblName->Name = QApplication::Translate('Title');
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnUninstall_Create is not named in camelCase. Open
private function btnUninstall_Create() {
$this->btnUninstall = new QButton($this);
$this->btnUninstall->Text = "Uninstall (delete) this Plugin";
$this->btnUninstall->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to uninstall this plugin?'));
$this->btnUninstall->AddAction(new QClickEvent(), new QAjaxAction('btnUninstall_click'));
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method dlgStatus_Create is not named in camelCase. Open
private function dlgStatus_Create(){
$this->dlgStatus = new QDialogBox($this);
// Let's setup some basic appearance options
// This could and should normally be done in a separate CSS class using the CssClass property
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnUninstall_Click is not named in camelCase. Open
public function btnUninstall_Click() {
list($status,$log) = QPluginUninstaller::uninstallExisting(QApplication::QueryString('strName'));
$linkToProceed = "<h2><a href='plugin_manager.php'>Click here to continue</h2></a>";
$this->dlgStatus->Text = $status.'<br/>'.$linkToProceed.'<a href="#" onclick="jQuery(\'#uninstall_details\').toggle()">Details</a><div id="uninstall_details" style="display:none;border:1px solid black;height:300px; overflow-y:auto;margin-top:20px;padding:10px;">'.nl2br($log).'</div>';
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblAuthorName_Create is not named in camelCase. Open
private function lblAuthorName_Create() {
$this->lblAuthorName = new QLabel($this);
$this->lblAuthorName->Text = $this->objPlugin->strAuthorName;
$this->lblAuthorName->Name = QApplication::Translate('Author');
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method btnInstall_Create is not named in camelCase. Open
private function btnInstall_Create() {
$this->btnInstall = new QButton($this);
$this->btnInstall->Text = "Install this Plugin";
$this->btnInstall->AddAction(new QClickEvent(), new QAjaxAction('btnInstall_click'));
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method lblFiles_Create is not named in camelCase. Open
private function lblFiles_Create() {
$this->lblFiles = new QLabel($this);
$this->lblFiles->Name = QApplication::Translate("Contains: ");
$this->lblFiles->Text = count($this->objPlugin->objAllFilesArray) . ' ' . QApplication::Translate("file(s)") . "; ";
$this->lblFiles->Text .= count($this->objPlugin->objIncludesArray) . ' ' . QApplication::Translate("include(s)") . "; ";
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}