Function addRoleToPicklist
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function addRoleToPicklist($fields): void
{
\App\Log::trace('Entering ' . __METHOD__);
$db = \App\Db::getInstance();
$schema = $db->getSchema();
- 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 addRoleToPicklist
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addRoleToPicklist($fields): void
{
\App\Log::trace('Entering ' . __METHOD__);
$db = \App\Db::getInstance();
$schema = $db->getSchema();
Function cron
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function cron($crons): array
{
if (!$crons) {
return [];
}
- 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
Function removeRoleToPicklist
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function removeRoleToPicklist($fields): void
{
\App\Log::trace('Entering ' . __METHOD__);
$db = \App\Db::getInstance();
$schema = $db->getSchema();
- 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
Function batchInsert
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function batchInsert($rows): array
{
$dbCommand = \App\Db::getInstance()->createCommand();
$s = 0;
foreach ($rows as $row) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '82', column '17'). Open
$query = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 16])->andWhere(['fieldname' => $fields]);
- 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 '152', column '15'). Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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 '20'). Open
$query2 = (new \App\Db\Query())->select([$identifier, 'sortorderid'])->from($picklistTable);
- 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 '17'). Open
$query = (new \App\Db\Query())->from('vtiger_field')
- 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 '207', column '21'). Open
$isExists = (new \App\Db\Query())->from('vtiger_cron_task')->where(['name' => $cronData[0], 'handler_class' => $cronData[1]])->exists();
- 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 '147', column '34'). Open
if (!isset($row[2]) || !(new \App\db\Query())->from($row[0])->where($row[2])->exists()) {
- 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 '122', column '15'). Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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 '36', column '19'). Open
$roleIds = (new \App\Db\Query())->select(['roleid'])->from('vtiger_role')->column();
- 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 '179', column '15'). Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'conditions' => $row[1] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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 '24'). Open
$picklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- 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 '48', column '27'). Open
$newPicklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Utils' in method 'batchDelete'. Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'conditions' => $row[1] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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\Utils' in method 'batchInsert'. Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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\Utils' in method 'batchUpdate'. Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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 '\vtlib\Cron' in method 'cron'. Open
\vtlib\Cron::register($cronData[0], $cronData[1], $cronData[2], $cronData[6], $cronData[5], 0, $cronData[8]);
- 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 '\vtlib\Cron' in method 'cron'. Open
\vtlib\Cron::deregister($cronData[0]);
- 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\Log' in method 'cron'. Open
\App\Log::trace('Entering ' . __METHOD__);
- 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\Log' in method 'cron'. Open
\App\Log::trace('Exiting ' . __METHOD__);
- 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\Log' in method 'removeRoleToPicklist'. Open
\App\Log::trace('Entering ' . __METHOD__);
- 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\Log' in method 'removeRoleToPicklist'. Open
\App\Log::trace('Exiting ' . __METHOD__);
- 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\Log' in method 'addRoleToPicklist'. Open
\App\Log::trace('Exiting ' . __METHOD__);
- 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\Log' in method 'addRoleToPicklist'. Open
\App\Log::trace('Entering ' . __METHOD__);
- 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\Db' in method 'addRoleToPicklist'. Open
$db = \App\Db::getInstance();
- 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\Db' in method 'removeRoleToPicklist'. Open
$db = \App\Db::getInstance();
- 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 "picklist_valueid" 5 times. Open
if ($tableSchema && !isset($tableSchema->columns['picklist_valueid'])) {
- 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_field" 4 times. Open
$query = (new \App\Db\Query())->from('vtiger_field')
- 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 "Exiting " 3 times. Open
\App\Log::trace('Exiting ' . __METHOD__);
- 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 "affected" 3 times. Open
return ['affected' => $s, 'all' => \count($rows)];
- 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 "picklistid" 4 times. Open
$newPicklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- 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 "tableName" 3 times. Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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 "uitype" 4 times. Open
->where(['uitype' => 16])
- 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 "fieldname" 9 times. Open
->andWhere(['fieldname' => $fields]);
- 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 "Entering " 3 times. Open
\App\Log::trace('Entering ' . __METHOD__);
- 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_picklist" 4 times. Open
$dbCommand->insert('vtiger_picklist', ['name' => $row['fieldname']])->execute();
- 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 "fieldid" 4 times. Open
$dbCommand->update('vtiger_field', ['uitype' => 15], ['fieldid' => $row['fieldid']])->execute();
- 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 "conditions" 3 times. Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- 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.
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query2 = (new \App\Db\Query())->select([$identifier, 'sortorderid'])->from($picklistTable);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$roleIds = (new \App\Db\Query())->select(['roleid'])->from('vtiger_role')->column();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$picklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Exclude checks
Reference to constant TYPE_INTEGER
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
$dbCommand->addColumn($picklistTable, 'picklist_valueid', $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10)->notNull()->defaultValue(0))->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$newPicklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 16])->andWhere(['fieldname' => $fields]);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('vtiger_field')
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Argument 5 (status)
is string
but \vtlib\Cron::register()
takes int
defined at /code/vtlib/Vtiger/Cron.php:398
Open
\vtlib\Cron::register($cronData[0], $cronData[1], $cronData[2], $cronData[6], $cronData[5], 0, $cronData[8]);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
if (!isset($row[2]) || !(new \App\db\Query())->from($row[0])->where($row[2])->exists()) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
Argument 3 (frequency)
is string
but \vtlib\Cron::register()
takes int
defined at /code/vtlib/Vtiger/Cron.php:398
Open
\vtlib\Cron::register($cronData[0], $cronData[1], $cronData[2], $cronData[6], $cronData[5], 0, $cronData[8]);
- Exclude checks
Suspicious array access to ?mixed
Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExists = (new \App\Db\Query())->from('vtiger_cron_task')->where(['name' => $cronData[0], 'handler_class' => $cronData[1]])->exists();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
When fetching an array index from a value of type string,
found an array index of type 'type',
but expected the index to be of type int
Open
if (!$isExists && 'add' === $cron['type']) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
When fetching an array index from a value of type string,
found an array index of type 'type',
but expected the index to be of type int
Open
} elseif ($isExists && 'remove' === $cron['type']) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Suspicious array access to ?mixed
Open
$dbCommand->insert($row[0], $row[1])->execute();
- Exclude checks
When fetching an array index from a value of type string,
found an array index of type 'data',
but expected the index to be of type int
Open
$cronData = $cron['data'];
- Exclude checks
Avoid variables with short names like $s. Configured minimum length is 3. Open
$s = 0;
- 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
Avoid variables with short names like $s. Configured minimum length is 3. Open
$s = 0;
- 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
Avoid variables with short names like $s. Configured minimum length is 3. Open
$s = 0;
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- 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
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- 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 for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Batch insert rows.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function batchDelete($rows): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param array $rows
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($rows as $row) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['type' => 'add', 'data' => ['LBL_BROWSING_HISTORY', 'cron/BrowsingHistory.php', 86400, NULL, NULL, 1, NULL, 29, NULL]],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!$crons) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$cronAction[] = $cronData[0];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($rows as $row) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
++$s;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param array $rows
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$s += $dbCommand->delete($row[0], $row[1])->execute();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['vtiger_cvcolumnlist', ['cvid' => 43, 'columnindex' => 5, 'columnname' => 'cc'], ],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$s = 0;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$s = 0;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return ['affected' => $s, 'all' => \count($rows)];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return int[]
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function batchUpdate($rows): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($rows as $row) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return int[]
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!isset($row[2]) || !(new \App\db\Query())->from($row[0])->where($row[2])->exists()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['vtiger_cvcolumnlist', ['cvid' => 43]],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$isExists = (new \App\Db\Query())->from('vtiger_cron_task')->where(['name' => $cronData[0], 'handler_class' => $cronData[1]])->exists();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* $crons = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$s = 0;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Batch insert rows.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!$isExists && 'add' === $cron['type']) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['u_#__squotes_invfield', ['colspan' => 25], ['id' => 1]],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dbCommand->insert($row[0], $row[1])->execute();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function cron($crons): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} elseif ($isExists && 'remove' === $cron['type']) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\vtlib\Cron::deregister($cronData[0]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param array $rows
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* $rows = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return ['affected' => $s, 'all' => \count($rows)];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* $rows = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['table name', [ update ], [ condition ],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @throws \App\Exceptions\DbException
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @throws \App\Exceptions\DbException
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'conditions' => $row[1] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @throws \App\Exceptions\DbException
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$cronAction = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return ['affected' => $s, 'all' => \count($rows)];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($crons as $cron) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public static function batchInsert($rows): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* ['type' => 'remove', 'data' => ['LBL_BATCH_PROCESSES']],
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string[] $crons
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$s += $dbCommand->update($row[0], $row[1], $row[2] ?? '')->execute();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Function to add and remove cron.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (empty($cron)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $cronAction;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return int[]
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$cronData = $cron['data'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\vtlib\Cron::register($cronData[0], $cronData[1], $cronData[2], $cronData[6], $cronData[5], 0, $cronData[8]);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function addRoleToPicklist($fields): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newPicklistValueId = $db->getUniqueID('vtiger_picklistvalues');
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$dbCommand->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid', 'sortid'], $insertedData)->execute();
- 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
->andWhere(['fieldname' => $fields]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistTable = 'vtiger_' . $row['fieldname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader2 = $query2->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function removeRoleToPicklist($fields): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function used to change picklist type field (uitype 16) to field with permissions based on role (uitype 15).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- 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
\App\Log::trace('Entering ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- 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 $fields
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newPicklistId = $db->getLastInsertID('vtiger_picklist_picklistid_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistTable = 'vtiger_' . $row['fieldname'];
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$picklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($picklistTable);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->addColumn($picklistTable, 'picklist_valueid', $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10)->notNull()->defaultValue(0))->execute();
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$dbCommand->update($picklistTable, ['picklist_valueid' => $newPicklistValueId], [$identifier => $picklistRow[$identifier]])->execute();
- 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
$query = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 16])->andWhere(['fieldname' => $fields]);
- 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
* 'osstimecontrol_status',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('vtiger_picklist', ['name' => $row['fieldname']])->execute();
- 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
$insertedData = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($roleIds as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema && isset($tableSchema->columns['picklist_valueid'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roleIds = (new \App\Db\Query())->select(['roleid'])->from('vtiger_role')->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- 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
* $fields = [
- 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
* Function used to change picklist type field (uitype 15 to 16).
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropColumn($picklistTable, 'picklist_valueid')->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from('vtiger_field')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema && !isset($tableSchema->columns['picklist_valueid'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$newPicklistId) {
- 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
$query2 = (new \App\Db\Query())->select([$identifier, 'sortorderid'])->from($picklistTable);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update($picklistTable, ['picklist_valueid' => $newPicklistValueId], [$identifier => $picklistRow[$identifier]])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_field', ['uitype' => 15], ['fieldid' => $row['fieldid']])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* 'fieldName',
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
$dbCommand->addColumn($picklistTable, 'picklist_valueid', $schema->createColumnSchemaBuilder(\yii\db\Schema::TYPE_INTEGER, 10)->notNull()->defaultValue(0))->execute();
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$newPicklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$identifier = $row['fieldname'] . 'id';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$query = (new \App\Db\Query())->from('vtiger_field')->where(['uitype' => 16])->andWhere(['fieldname' => $fields]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($picklistId) {
- 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
$newPicklistId = (new \App\Db\Query())->select(['picklistid'])->from('vtiger_picklist')->where(['name' => $row['fieldname']])->scalar();
- 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[] $fields List of field names
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_field', ['uitype' => 15], ['fieldid' => $row['fieldid']])->execute();
- 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
$insertedData[] = [$value, $newPicklistValueId, $newPicklistId, $picklistRow['sortorderid']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid', 'sortid'], $insertedData)->execute();
- 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
->where(['uitype' => 16])
- 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
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($picklistRow = $dataReader2->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($picklistTable);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
* ['type' => 'add', 'data' => ['LBL_BROWSING_HISTORY', 'cron/BrowsingHistory.php', 86400, NULL, NULL, 1, NULL, 29, NULL]],
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
\vtlib\Cron::register($cronData[0], $cronData[1], $cronData[2], $cronData[6], $cronData[5], 0, $cronData[8]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['table name', [ update ], [ condition ],
- Exclude checks
Line exceeds 120 characters; contains 182 characters Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'conditions' => $row[1] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_picklist', ['name' => $row['fieldname']])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_role2picklist', ['picklistid' => $picklistId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exiting ' . __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 204 characters Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$isExists = (new \App\Db\Query())->from('vtiger_cron_task')->where(['name' => $cronData[0], 'handler_class' => $cronData[1]])->exists();
- 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
* Batch update rows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* $rows = [
- 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 204 characters Open
throw new \App\Exceptions\DbException(\App\Utils::varExport(['tableName' => $row[0], 'columns' => $row[1], 'conditions' => $row[2] ?? null]) . PHP_EOL . $th->__toString(), $th->getCode());
- Exclude checks