Avoid using undefined variables such as '$tree1' which will lead to PHP notices. Open
$tree1[] = $this->createItemForTree('item2', 2);
- 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 '$share2' which will lead to PHP notices. Open
$share2[] = \App\Module::getModuleId('Contacts');
- 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 '$share2' which will lead to PHP notices. Open
[2, null, [], $share2],
- 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 '$tree4' which will lead to PHP notices. Open
[4, null, $tree4, []],
- 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 '$share2' which will lead to PHP notices. Open
[3, null, $tree1, $share2],
- 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 '$tree1' which will lead to PHP notices. Open
[1, null, $tree1, []],
- 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 '$share2' which will lead to PHP notices. Open
$share2[] = \App\Module::getModuleId('Calendar');
- 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 '$tree4' which will lead to PHP notices. Open
$tree4[] = $this->createItemForTree('item1Edit', 1);
- 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 '$share1' which will lead to PHP notices. Open
[2, $tree4, $share1],
- 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 '$share1' which will lead to PHP notices. Open
$share1[] = \App\Module::getModuleId('Leads');
- 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 '$tree0' which will lead to PHP notices. Open
[0, $tree0, []],
- 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 '$share1' which will lead to PHP notices. Open
[1, [], $share1],
- 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 '$tree1' which will lead to PHP notices. Open
$tree1[] = $this->createItemForTree('item1', 1);
- 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 '$tree1' which will lead to PHP notices. Open
[3, null, $tree1, $share2],
- 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 '$tree4' which will lead to PHP notices. Open
$tree4[] = $this->createItemForTree('item2Edit', 2, [$this->createItemForTree('item3Edit', 3), $this->createItemForTree('itemEdit4', 4)]);
- 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 '$share2' which will lead to PHP notices. Open
$share2[] = \App\Module::getModuleId('Leads');
- 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 '$tree0' which will lead to PHP notices. Open
$tree0[] = $this->createItemForTree('itemEdit1', 1);
- 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 '$share1' which will lead to PHP notices. Open
$share1[] = \App\Module::getModuleId('Calendar');
- 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 '$tree4' which will lead to PHP notices. Open
[2, $tree4, $share1],
- 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 '$tree4' which will lead to PHP notices. Open
$tree4[] = $this->createItemForTree('item1', 1);
- 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 '$tree4' which will lead to PHP notices. Open
$tree4[] = $this->createItemForTree('item2', 2, [$this->createItemForTree('item3', 3), $this->createItemForTree('item4', 4)]);
- 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 '$share1' which will lead to PHP notices. Open
$share1[] = \App\Module::getModuleId('Contacts');
- 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 '$tree0' which will lead to PHP notices. Open
$tree0[] = $this->createItemForTree('itemEdit2', 2);
- 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 '47', column '15'). Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- 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 '95', column '26'). Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- 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 '112', column '27'). Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$treesId[$key]);
- 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 '51', column '26'). Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- 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 '15'). Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- 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 '114', column '26'). Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), 0, 'The records were not removed from the table "vtiger_trees_templates_data"');
- 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 '\Settings_TreesManager_Record_Model' in method 'testEditTree'. Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- 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 '\Settings_TreesManager_Record_Model' in method 'testDeleteTree'. Open
$recordModel = \Settings_TreesManager_Record_Model::getInstanceById(self::$treesId[$key]);
- 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\Module' in method 'providerForEditTree'. Open
$share1[] = \App\Module::getModuleId('Calendar');
- 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 '\Settings_TreesManager_Record_Model' in method 'testAddTree'. Open
$recordModel = \Settings_TreesManager_Record_Model::getCleanInstance();
- 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\Module' in method 'providerForTree'. Open
$share2[] = \App\Module::getModuleId('Contacts');
- 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\Module' in method 'testAddTree'. Open
$moduleId = \App\Module::getModuleId('Dashboard');
- 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 '\Settings_TreesManager_Record_Model' in method 'testAddTree'. Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- 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 '\Settings_TreesManager_Record_Model' in method 'testEditTree'. Open
$recordModel = \Settings_TreesManager_Record_Model::getInstanceById(self::$treesId[$key]);
- 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\Module' in method 'providerForEditTree'. Open
$share1[] = \App\Module::getModuleId('Leads');
- 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\Module' in method 'providerForTree'. Open
$share2[] = \App\Module::getModuleId('Leads');
- 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\Module' in method 'providerForEditTree'. Open
$share1[] = \App\Module::getModuleId('Contacts');
- 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\Module' in method 'providerForTree'. Open
$share2[] = \App\Module::getModuleId('Calendar');
- 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 "share" 4 times. Open
$recordModel->set('share', $share);
- 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 "vtiger_trees_templates_data" 3 times. Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- 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 "children" 3 times. Open
if (\is_array($item['children'])) {
- 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 "templateid" 6 times. Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- 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 "vtiger_trees_templates" 3 times. Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- 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.
Avoid unused parameters such as '$tree'. Open
public function testDeleteTree($key, $moduleId = null, $tree = [], $share = [])
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$share'. Open
public function testDeleteTree($key, $moduleId = null, $tree = [], $share = [])
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$moduleId'. Open
public function testDeleteTree($key, $moduleId = null, $tree = [], $share = [])
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to undeclared method \App\Db\Query::from
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$treesId[$key]);
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), 0, 'The records were not removed from the table "vtiger_trees_templates_data"');
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Variable $tree1
was undeclared, but array fields are being added to it. Open
$tree1[] = $this->createItemForTree('item1', 1);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), 0, 'The records were not removed from the table "vtiger_trees_templates_data"');
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame($row['name'], 'TestTreeEdit' . $key);
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertNotNull
Open
$this->assertNotNull($recordModel, 'Settings_TreesManager_Record_Model is null');
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertFalse
Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$treesId[$key]);
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame($row['tabid'], $moduleId);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- Exclude checks
Call to undeclared method \Tests\Settings\TreesManager::assertSame
Open
$this->assertSame($row['name'], 'TestTree' . $key);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- Exclude checks
Variable $tree4
was undeclared, but array fields are being added to it. Open
$tree4[] = $this->createItemForTree('item1', 1);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Variable $share2
was undeclared, but array fields are being added to it. Open
$share2[] = \App\Module::getModuleId('Contacts');
- Exclude checks
Variable $tree4
was undeclared, but array fields are being added to it. Open
$tree4[] = $this->createItemForTree('item1Edit', 1);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Variable $share1
was undeclared, but array fields are being added to it. Open
$share1[] = \App\Module::getModuleId('Contacts');
- Exclude checks
Variable $tree0
was undeclared, but array fields are being added to it. Open
$tree0[] = $this->createItemForTree('itemEdit1', 1);
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
private function createItemForTree($itemName, $id, $children = [])
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
public function testAddTree($key, $moduleId = null, $tree = [], $share = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($moduleId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $tree
- 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
[4, null, $tree4, []],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $children
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- 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
Line exceeds 120 characters; contains 167 characters Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->delete();
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$tree4[] = $this->createItemForTree('item2Edit', 2, [$this->createItemForTree('item3Edit', 3), $this->createItemForTree('itemEdit4', 4)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $treesId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $tree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cnt += self::countItems($item['children']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $share
- 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
* @codeCoverageIgnore
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create item for tree array.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'a_attr' => ['href' => '#', 'id' => $id . '_anchor'],
- 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
[2, $tree4, $share1],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Count item in tree.
- 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
* Testing edition tree.
- 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
$tree4[] = $this->createItemForTree('item2', 2, [$this->createItemForTree('item3', 3), $this->createItemForTree('item4', 4)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[1, null, $tree1, []],
- 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
* @param string $itemName
- 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
private function createItemForTree($itemName, $id, $children = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'data' => [],
- 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree4[] = $this->createItemForTree('item1Edit', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree4[] = $this->createItemForTree('item2Edit', 2, [$this->createItemForTree('item3Edit', 3), $this->createItemForTree('itemEdit4', 4)]);
- 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
* @param int|string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], 'TestTree' . $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cnt = \count($tree);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_TreesManager_Record_Model::getInstanceById(self::$treesId[$key]);
- Exclude checks
Line exceeds 120 characters; contains 215 characters Open
$this->assertFalse((new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$treesId[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree1[] = $this->createItemForTree('item2', 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider providerForTree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = \App\Module::getModuleId('Dashboard');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('tree', $tree);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['tabid'], $moduleId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tree as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['name'], 'TestTreeEdit' . $key);
- 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
$recordModel->set('share', $share);
- 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
* @param array $tree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('name', 'TestTreeEdit' . $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $moduleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree1[] = $this->createItemForTree('item1', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$share2[] = \App\Module::getModuleId('Calendar');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[3, null, $tree1, $share2],
- 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function providerForEditTree()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree0[] = $this->createItemForTree('itemEdit2', 2);
- 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
* Array of trees id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('tabid', $moduleId);
- 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
$recordModel->set('share', $share);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing deletion tree.
- 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
$share2[] = \App\Module::getModuleId('Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$share2[] = \App\Module::getModuleId('Leads');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[2, null, [], $share2],
- 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 [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'children' => $children,
- 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
[1, [], $share1],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- 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
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- 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
* Data provider for testAddTree.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree4[] = $this->createItemForTree('item1', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[0, null, [], []],
- 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
$share1[] = \App\Module::getModuleId('Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[3, [], []],
- 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
$recordModel = \Settings_TreesManager_Record_Model::getInstanceById(self::$treesId[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- 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
'text' => $itemName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tree0[] = $this->createItemForTree('itemEdit1', 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$share1[] = \App\Module::getModuleId('Calendar');
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Settings_TreesManager_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$treesId[$key] = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static function countItems($tree)
- 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->assertNotNull($recordModel, 'Settings_TreesManager_Record_Model is null');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('replace', '');
- 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->assertFalse((new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->exists(), 'The record was not removed from the database ID: ' . self::$treesId[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), 0, 'The records were not removed from the table "vtiger_trees_templates_data"');
- 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
[0, $tree0, []],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Testing creation tree.
- 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 (\is_array($item['children'])) {
- Exclude checks
Line exceeds 120 characters; contains 222 characters Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), 0, 'The records were not removed from the table "vtiger_trees_templates_data"');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function providerForTree()
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$tree4[] = $this->createItemForTree('item2', 2, [$this->createItemForTree('item3', 3), $this->createItemForTree('item4', 4)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'state' => ['loaded' => '1', 'opened' => false, 'selected' => false, 'disabled' => false],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$share1[] = \App\Module::getModuleId('Leads');
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame($row['share'], \Settings_TreesManager_Record_Model::getShareFromArray($share));
- 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
* @param int|string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @codeCoverageIgnore
- 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
$recordModel->set('tree', $tree);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$row = (new \App\Db\Query())->from('vtiger_trees_templates')->where(['templateid' => self::$treesId[$key]])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $share
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function testDeleteTree($key, $moduleId = null, $tree = [], $share = [])
- 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
'li_attr' => ['id' => $id],
- 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
[4, [], []],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $tree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- 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
public function testEditTree($key, $tree = [], $share = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->assertSame((new \App\Db\Query())->from('vtiger_trees_templates_data')->where(['templateid' => self::$treesId[$key]])->count(), self::countItems($tree));
- 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
'id' => $id,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- 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
* @param int|null $moduleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $share
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('name', 'TestTree' . $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$treesId[$key];
- 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 $cnt;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider providerForEditTree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @dataProvider providerForTree
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Data provider for testEditTree.
- Exclude checks