Method __create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __create($moduleInstance)
{
$this->module = $moduleInstance;
$this->isdefault = (true === $this->isdefault || 'true' == $this->isdefault) ? 1 : 0;
$this->inmetrics = (true === $this->inmetrics || 'true' == $this->inmetrics) ? 1 : 0;
Function __create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __create($moduleInstance)
{
$this->module = $moduleInstance;
$this->isdefault = (true === $this->isdefault || 'true' == $this->isdefault) ? 1 : 0;
$this->inmetrics = (true === $this->inmetrics || 'true' == $this->inmetrics) ? 1 : 0;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class Filter has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Filter
{
/** ID of this filter instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '202', column '19'). Open
$result = (new \App\Db\Query())->from('vtiger_customview')->where(['viewname' => $value, 'entitytype' => $moduleName])->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 '152', column '77'). Open
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->execute();
- 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
The method getInstance has a boolean flag argument $module, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getInstance($value, $module = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '221', column '22'). Open
$dataReader = (new \App\Db\Query())->from('vtiger_customview')
- 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
The method save has a boolean flag argument $moduleInstance, which is a certain sign of a Single Responsibility Principle violation. Open
public function save($moduleInstance = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '58', column '21'). Open
$sequence = (new \App\Db\Query())->from('vtiger_customview')
- 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
The method initialize has a boolean flag argument $module, which is a certain sign of a Single Responsibility Principle violation. Open
public function initialize($valuemap, $module = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '239', column '17'). Open
$cvIds = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])->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
Avoid using static access to class '\App\CustomView' in method 'getInstance'. Open
$result = \App\CustomView::getCVDetails((int) $value, $moduleName ?: null);
- 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 '__create'. Open
\App\Log::trace("Creating Filter $this->name ... DONE", __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\CustomView' in method 'deleteForModule'. Open
\App\CustomView::clearCacheById($cvId, $moduleInstance->name);
- 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\Module' in method 'initialize'. Open
$this->module = Module::getInstance($module ?: $valuemap['tabid']);
- 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 '__update'. Open
\App\Log::trace("Updating Filter $this->name ... DONE", __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 'vtlib\Utils' in method 'getInstance'. Open
if (Utils::isNumber($value)) {
- 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\CustomView' in method '__delete'. Open
\App\CustomView::clearCacheById($this->id, $this->module->name);
- 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 'addRule'. Open
\App\Log::trace('Adding Condition', __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
The method getInstance uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$result = (new \App\Db\Query())->from('vtiger_customview')->where(['viewname' => $value, 'entitytype' => $moduleName])->one();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Db' in method '__create'. 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 'addField'. 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\Log' in method 'addField'. Open
\App\Log::trace("Adding $fieldInstance->name to $this->name filter ... DONE", __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
The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->__create($moduleInstance);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\CustomView_Record_Model' in method 'addRule'. Open
$cvRecordModel = \CustomView_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
The method __create uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->status = '3';
} // Public
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Module' in method 'getInstance'. Open
$moduleName = is_numeric($module) ? \App\Module::getModuleName($module) : $module;
- 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 "vtiger_customview" 7 times. Open
$sequence = (new \App\Db\Query())->from('vtiger_customview')
- 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 "viewname" 3 times. Open
$this->name = $valuemap['viewname'];
- 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 "entitytype" 6 times. Open
->where(['entitytype' => $this->module->name])
- 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 "columnindex" 3 times. Open
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->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.
Assigning '3'
to property but \vtlib\Filter->status
is false
Open
$this->status = '3';
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Updating Filter $this->name ... DONE", __METHOD__);
- Exclude checks
Reference to undeclared property \vtlib\Filter->sequence
Open
if (!isset($this->sequence)) {
- Exclude checks
Assigning 0|1
to property but \vtlib\Filter->inmetrics
is false
Open
$this->inmetrics = (true === $this->inmetrics || 'true' == $this->inmetrics) ? 1 : 0;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Creating Filter $this->name ... DONE", __METHOD__);
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param Module Instance of the module to which this filter should be associated with':
after Module,
did not see an element name (will guess based on comment order) Open
* @param Module Instance of the module to which this filter should be associated with
- Exclude checks
Reference to undeclared property \vtlib\Filter->sequence
(Did you mean $sequence) Open
'sequence' => $this->sequence,
- Exclude checks
Assigning '0'
to property but \vtlib\Filter->status
is false
Open
$this->status = '0';
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['cvid' => $this->id])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$sequence = (new \App\Db\Query())->from('vtiger_customview')
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_customview', [
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param Module Instance of the module to use':
after Module,
did not see an element name (will guess based on comment order) Open
* @param Module Instance of the module to use
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new \App\Db\Query())->from('vtiger_customview')
- Exclude checks
Expected @param annotation for value
to be before the @param annotation for module
Open
* @param mixed $module Mixed id or name of the module
- Exclude checks
Expected @param annotation for valuemap
to be before the @param annotation for module
Open
* @param mixed $module Mixed id or name of the module
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->execute();
- Exclude checks
Returning type array<int>|array{}</int>
but getAllForModule()
is declared to return \vtlib\Filter
Open
return $instances;
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param mixed filterid or filtername':
after mixed,
did not see an element name (will guess based on comment order) Open
* @param mixed filterid or filtername
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$result = (new \App\Db\Query())->from('vtiger_customview')->where(['viewname' => $value, 'entitytype' => $moduleName])->one();
- Exclude checks
Reference to undeclared property \vtlib\Filter->sequence
(Did you mean $sequence) Open
$this->sequence = $sequence ? (int) $sequence + 1 : 0;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['entitytype' => $moduleInstance->name])->execute();
- Exclude checks
Argument 2 (moduleName)
is false
but \App\CustomView::clearCacheById()
takes null|string
defined at /code/app/CustomView.php:763
Open
\App\CustomView::clearCacheById($this->id, $this->module->name);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_cvcolumnlist', [
- Exclude checks
@throws type of addRule
has undeclared type \yii\db\Exception
(Did you mean class \Exception) Open
public function addRule(array $conditions)
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$cvIds = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])->column();
- Exclude checks
Argument 2 (moduleName)
is false
but \App\CustomView::clearCacheById()
takes null|string
defined at /code/app/CustomView.php:763
Open
\App\CustomView::clearCacheById($cvId, $moduleInstance->name);
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->execute();
- Exclude checks
Reference to undeclared property \vtlib\FieldBasic->sourcefieldname
Open
'source_field_name' => $fieldInstance->sourcefieldname ?? null
- Exclude checks
Suspicious type false
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
return "$fieldInstance->table:$fieldInstance->column:$fieldInstance->name:$displayinfo";
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Adding $fieldInstance->name to $this->name filter ... DONE", __METHOD__);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Adding Condition', __METHOD__);
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
public $id;
- 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 to indent lines; tabs are not allowed Open
public function __create($moduleInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete this instance.
- 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
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'columnindex' => $index,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvRecordModel->setConditionsForFilter();
- 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 self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sequence = $sequence ? (int) $sequence + 1 : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'entitytype' => $this->module->name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\CustomView::clearCacheById($this->id, $this->module->name);
- 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 string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tod = explode('~', $fieldInstance->typeofdata);
- 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
$instance->initialize($result, $module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['cvid' => $this->id])->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
} else {
- 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
$displayinfo = $fieldInstance->getModuleName() . '_' . str_replace(' ', '_', $fieldInstance->label) . ':' . $tod[0];
- 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 mixed filterid or filtername
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = (new \App\Db\Query())->from('vtiger_customview')->where(['viewname' => $value, 'entitytype' => $moduleName])->one();
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
$result = (new \App\Db\Query())->from('vtiger_customview')->where(['viewname' => $value, 'entitytype' => $moduleName])->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
$this->status = '0';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->status = '3';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} // Public
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => $this->description,
- 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
public function delete()
- 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
* @throws \yii\db\Exception
- 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('Adding Condition', __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['entitytype' => $moduleInstance->name])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- 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
* @param ModuleBasic $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['entitytype' => $moduleInstance->name])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $inmetrics = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $entitytype = false;
- 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
'featured' => $this->featured,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Updating Filter $this->name ... DONE", __METHOD__);
- 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
* Add rule to this filter instance.
- 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
$cvRecordModel = \CustomView_Record_Model::getCleanInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function deleteForModule(ModuleBasic $moduleInstance)
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$cvIds = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $valuemap
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function initialize($valuemap, $module = false)
- 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
'sequence' => $this->sequence,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __delete()
- 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 mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param FieldBasic $fieldInstance
- 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 129 characters Open
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['entitytype' => $moduleInstance->name])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->id = $valuemap['cvid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Module Instance of the module to which this filter should be associated with
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->inmetrics = (true === $this->inmetrics || 'true' == $this->inmetrics) ? 1 : 0;
- 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
'setdefault' => $this->isdefault,
- 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
* Get the column value to use in custom view tables.
- 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
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Adding $fieldInstance->name to $this->name filter ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($value, $module = false)
- 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 $presence = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->max('sequence');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->status)) {
- 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
$db = \App\Db::getInstance();
- 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
$this->__update();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->__delete();
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all instances of filter for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** ID of this filter instance */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $description;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->module = Module::getInstance($module ?: $valuemap['tabid']);
- 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(['entitytype' => $this->module->name])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __update()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $index
- 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 addField(FieldBasic $fieldInstance, $index = 0)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cvid' => $this->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
$cvRecordModel->set('advfilterlist', $conditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = \App\CustomView::getCVDetails((int) $value, $moduleName ?: 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
public static function getAllForModule(ModuleBasic $moduleInstance)
- 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 $status = false; // 5.1.0 onwards
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initialize this filter instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->name = $valuemap['viewname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create this instance.
- 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 (!isset($this->sequence)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_customview', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->id = $db->getLastInsertID('vtiger_customview_cvid_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Creating Filter $this->name ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function save($moduleInstance = false)
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sequence = (new \App\Db\Query())->from('vtiger_customview')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'viewname' => $this->name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$displayinfo = $fieldInstance->getModuleName() . '_' . str_replace(' ', '_', $fieldInstance->label) . ':' . $tod[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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
$dataReader = (new \App\Db\Query())->from('vtiger_customview')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvIds = (new \App\Db\Query())->from('vtiger_customview')->where(['entitytype' => $moduleInstance->name])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $privileges = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $module Mixed id or name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == $this->presence) {
- 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 __getColumnValue(FieldBasic $fieldInstance)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return "$fieldInstance->table:$fieldInstance->column:$fieldInstance->name:$displayinfo";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add the field to this filer instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
$db->createCommand()->update('vtiger_cvcolumnlist', ['columnindex' => new \yii\db\Expression('columnindex + 1')], ['and', ['cvid' => $this->id], ['>=', 'columnindex', $index]])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = is_numeric($module) ? \App\Module::getModuleName($module) : $module;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Utils::isNumber($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- 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
'status' => $this->status,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module_name' => $fieldInstance->getModuleName(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'source_field_name' => $fieldInstance->sourcefieldname ?? 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
public function addRule(array $conditions)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($conditions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete filter associated for module.
- 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 $isdefault;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $sort;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete this instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->__create($moduleInstance);
- 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 mixed $module Mixed id or name of the module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param ModuleBasic $moduleInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->initialize($row, $moduleInstance->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($cvIds as $cvId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\CustomView::clearCacheById($cvId, $moduleInstance->name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $featured = 0;
- 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->module = $moduleInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->isdefault = (true === $this->isdefault || 'true' == $this->isdefault) ? 1 : 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} // Default
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'privileges' => $this->privileges,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sort' => $this->sort,
- 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
* Save this instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->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
* @param FieldBasic $fieldInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_cvcolumnlist', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'field_name' => $fieldInstance->name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvRecordModel->set('cvid', $this->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cvRecordModel->set('advfilterlistDbFormat', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($result) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instances = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instances;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'setmetrics' => $this->inmetrics,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'presence' => $this->presence,
- 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 Module Instance of the module to use
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $conditions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get instance by filterid or filtername.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- 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
$instances[] = $instance;
- 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
}
- Exclude checks
The method __update is not named in camelCase. Open
public function __update()
{
\App\Log::trace("Updating Filter $this->name ... DONE", __METHOD__);
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method __getColumnValue is not named in camelCase. Open
public function __getColumnValue(FieldBasic $fieldInstance)
{
$tod = explode('~', $fieldInstance->typeofdata);
$displayinfo = $fieldInstance->getModuleName() . '_' . str_replace(' ', '_', $fieldInstance->label) . ':' . $tod[0];
return "$fieldInstance->table:$fieldInstance->column:$fieldInstance->name:$displayinfo";
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method __create is not named in camelCase. Open
public function __create($moduleInstance)
{
$this->module = $moduleInstance;
$this->isdefault = (true === $this->isdefault || 'true' == $this->isdefault) ? 1 : 0;
$this->inmetrics = (true === $this->inmetrics || 'true' == $this->inmetrics) ? 1 : 0;
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}
Source
The method __delete is not named in camelCase. Open
public function __delete()
{
\App\Db::getInstance()->createCommand()->delete('vtiger_customview', ['cvid' => $this->id])->execute();
\App\CustomView::clearCacheById($this->id, $this->module->name);
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}