Function dtgPlugins_Bind
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function dtgPlugins_Bind() {
if (!is_dir(__PLUGINS__)) {
return;
}
$pluginDirArray = scandir ( __PLUGINS__);
- 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 dtgPlugins_Bind
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dtgPlugins_Bind() {
if (!is_dir(__PLUGINS__)) {
return;
}
$pluginDirArray = scandir ( __PLUGINS__);
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$itemArray[] = $arrayItem;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$arrayItem['Description'] = $composerDetails['description'];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$arrayItem['Examples'][] = $strExample;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$arrayItem['Description'] = '';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$arrayItem['Examples'] = null;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arrayItem' which will lead to PHP notices. Open
$arrayItem['Name'] = $dirItem;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '26', column '39'). Open
$this->btnNewPlugin->AddAction(new QClickEvent(), new QAjaxAction('btnNewPlugin_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 '34', column '28'). Open
$this->dtgPlugins = new QDataGrid($this, 'dtgPlugins');
- 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 '26', column '58'). Open
$this->btnNewPlugin->AddAction(new QClickEvent(), new QAjaxAction('btnNewPlugin_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 '24', column '30'). Open
$this->btnNewPlugin = 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
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 'QApplication' in method 'RenderExampleLink'. Open
'">' . QApplication::HtmlEntities($strItem) . '</a><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 unused private methods such as 'btnNewPlugin_Create'. Open
private function btnNewPlugin_Create() {
$this->btnNewPlugin = new QButton($this);
$this->btnNewPlugin->Text = "Install a New Plugin";
$this->btnNewPlugin->AddAction(new QClickEvent(), new QAjaxAction('btnNewPlugin_Click'));
}
- Read upRead up
- Exclude checks
UnusedPrivateMethod
Since: 0.2
Unused Private Method detects when a private method is declared but is unused.
Example
class Something
{
private function foo() {} // unused
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod
Avoid unused private fields such as '$objPluginArray'. Open
private $objPluginArray;
- Read upRead up
- Exclude checks
UnusedPrivateField
Since: 0.2
Detects when a private field is declared and/or assigned a value, but not used.
Example
class Something
{
private static $FOO = 2; // Unused
private $i = 5; // Unused
private $j = 6;
public function addOne()
{
return $this->j++;
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedprivatefield
The method dtgPlugins_Bind is not named in camelCase. Open
public function dtgPlugins_Bind() {
if (!is_dir(__PLUGINS__)) {
return;
}
$pluginDirArray = scandir ( __PLUGINS__);
- 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 btnNewPlugin_Create is not named in camelCase. Open
private function btnNewPlugin_Create() {
$this->btnNewPlugin = new QButton($this);
$this->btnNewPlugin->Text = "Install a New Plugin";
$this->btnNewPlugin->AddAction(new QClickEvent(), new QAjaxAction('btnNewPlugin_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 dtgPlugins_Create is not named in camelCase. Open
private function dtgPlugins_Create() {
$this->dtgPlugins = new QDataGrid($this, 'dtgPlugins');
$this->dtgPlugins->SetDataBinder('dtgPlugins_Bind');
$this->dtgPlugins->CssClass = 'datagrid';
- 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 RenderExampleLink is not named in camelCase. Open
public function RenderExampleLink($item) {
if ($item['Examples']) {
$strRet = '';
foreach ($item['Examples'] as $strItem) {
$strRet .= '<a href="' . __PLUGIN_ASSETS__ . '/' . $item['Name'] . '/examples/' . $strItem .
- 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() {
$this->dtgPlugins_Create();
//$this->btnNewPlugin_Create();
//$this->dlgUpload_Create();
}
- 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_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() {
}
}