Function __create
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function __create($blockInstance)
{
$db = \App\Db::getInstance();
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
- 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 __create
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __create($blockInstance)
{
$db = \App\Db::getInstance();
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
File FieldBasic.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
The class FieldBasic has 33 fields. Consider redesigning FieldBasic to keep the number of fields under 15. Open
class FieldBasic
{
/** ID of this field instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function initialize($valuemap, $module = false, $blockInstance = false)
{
$this->id = (int) $valuemap['fieldid'];
$this->tabid = (int) $valuemap['tabid'];
$this->name = $valuemap['fieldname'];
The class FieldBasic has 49 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class FieldBasic
{
/** ID of this field instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Function __delete
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __delete()
{
Profile::deleteForField($this);
$db = \App\Db::getInstance();
$db->createCommand()->delete('vtiger_field', ['fieldid' => $this->id])->execute();
- 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 method __create() has an NPath complexity of 2304. The configured NPath complexity threshold is 200. Open
public function __create($blockInstance)
{
$db = \App\Db::getInstance();
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method __create() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. Open
public function __create($blockInstance)
{
$db = \App\Db::getInstance();
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed. Open
public function __create($blockInstance)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The method save has a boolean flag argument $blockInstance, which is a certain sign of a Single Responsibility Principle violation. Open
public function save($blockInstance = 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 '122', column '18'). Open
$maxSeq = (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
The method initialize has a boolean flag argument $blockInstance, which is a certain sign of a Single Responsibility Principle violation. Open
public function initialize($valuemap, $module = false, $blockInstance = 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
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, $blockInstance = 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 '108', column '18'). Open
$maxSeq = (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
Avoid using static access to class 'vtlib\Profile' in method '__delete'. Open
Profile::deleteForField($this);
- 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 'setMassEditable'. Open
\App\Log::trace("Updated masseditable information of $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\User' in method 'clearCache'. Open
\App\Cache::delete('App\Field::getFieldsPermissions' . \App\User::getCurrentUserId(), $this->getModuleName());
- 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\Cache' in method 'clearCache'. Open
\App\Cache::delete('AllFieldForModule', $this->getModuleId());
- 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\Cache' in method 'clearCache'. Open
\App\Cache::delete('getRelatedFieldForModule', 'all');
- 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 'setHelpInfo'. Open
\App\Log::trace("Updated help information of $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\Cache' in method 'clearCache'. Open
\App\Cache::staticDelete('ModuleFields', $this->getModuleId());
- 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 '__delete'. 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\Module' in method 'getModuleName'. Open
$moduleName = \App\Module::getModuleName($this->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\Cache' in method 'clearCache'. Open
\App\Cache::delete('FieldInfoById', $this->id);
- 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 'setSummaryField'. Open
\App\Log::trace("Updated summaryfield information of $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\Log' in method '__create'. Open
\App\Log::trace("Creating field $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\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\Log' in method '__update'. Open
\App\Log::trace("Updating Field $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
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($blockInstance);
}
- 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\Json' in method 'initialize'. Open
$this->anonymizationTarget = \App\Json::decode($valuemap['anonymization_target']);
- 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\Block' in method 'initialize'. Open
$this->block = $blockInstance ?: Block::getInstance($valuemap['block'], $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
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->quicksequence = null;
}
- 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 'vtlib\Profile' in method '__create'. Open
Profile::initForField($this);
- 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\Cache' in method 'clearCache'. Open
\App\Cache::staticDelete('module', $this->getModuleName());
- 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\Cache' in method 'clearCache'. Open
\App\Cache::delete('BlocksForModule', $this->getModuleId());
- 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\Cache' in method 'clearCache'. Open
\App\Cache::delete('ModuleFieldInfosByName', $this->getModuleName());
- 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\Cache' in method 'clearCache'. Open
\App\Cache::delete('ModuleFieldInfosByColumn', $this->getModuleName());
- 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 '__create'. Open
Utils::addColumn($this->table, $this->column, $this->columntype);
- 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 '__delete'. Open
\App\Log::trace("Deleteing Field $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\Cache' in method 'clearCache'. Open
\App\Cache::delete('App\Field::getFieldsPermissions' . \App\User::getCurrentUserId(), $this->getModuleName());
- 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 "tabid" 4 times. Open
$this->tabid = (int) $valuemap['tabid'];
- 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 "block" 3 times. Open
$this->block = $blockInstance ?: Block::getInstance($valuemap['block'], $module);
- 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 "summaryfield" 3 times. Open
$this->summaryfield = (int) $valuemap['summaryfield'];
- 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 "masseditable" 3 times. Open
$this->masseditable = (int) $valuemap['masseditable'];
- 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 "sequence" 3 times. Open
$this->sequence = (int) $valuemap['sequence'];
- 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" 7 times. Open
$maxSeq = (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 "quickcreatesequence" 3 times. Open
$this->quicksequence = (int) $valuemap['quickcreatesequence'];
- 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 "helpinfo" 3 times. Open
$this->helpinfo = $valuemap['helpinfo'];
- 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" 6 times. Open
$this->id = (int) $valuemap['fieldid'];
- 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.
Reference to undeclared property \vtlib\FieldBasic->module
Open
} elseif (!empty($this->module)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
\App\Cache::delete('App\Field::getFieldsPermissions' . \App\User::getCurrentUserId(), $this->getModuleName());
- Exclude checks
Default value for \vtlib\Block
$blockInstance
can't be false
Open
public function initialize($valuemap, $module = false, $blockInstance = false)
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$indexes = $db->getSchema()->getTableIndexes($this->table, true);
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Creating field $this->name ... DONE", __METHOD__);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->delete('vtiger_field', ['fieldid' => $this->id])->execute();
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$indexes = $db->getSchema()->getTableIndexes($this->table, true);
- Exclude checks
Assigning 'string\x28100\x29'
to property but \vtlib\FieldBasic->columntype
is false
Open
$this->columntype = 'string(100)';
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->createIndex("{$this->table}_{$this->column}_idx", $this->table, $this->column)->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Updating Field $this->name ... DONE", __METHOD__);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Argument 2 (key)
is false
but \App\Cache::delete()
takes string
defined at /code/app/Cache.php:105
Open
\App\Cache::delete('AllFieldForModule', $this->getModuleId());
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param int Summaryfield value':
after int,
did not see an element name (will guess based on comment order) Open
* @param int Summaryfield value
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Updated summaryfield information of $this->name ... DONE", __METHOD__);
- Exclude checks
Assigning int
to property but \vtlib\FieldBasic->tabid
is false
Open
$this->tabid = (int) $valuemap['tabid'];
- 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
$db->createCommand()->createIndex("{$this->table}_{$this->column}_idx", $this->table, $this->column)->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Updated masseditable information of $this->name ... DONE", __METHOD__);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param vtlib\Block Instance of the block to use':
after vtlib\Block,
did not see an element name (will guess based on comment order) Open
* @param vtlib\Block Instance of the block to use
- Exclude checks
Assigning string
to property but \vtlib\FieldBasic->column
is false
Open
$this->column = strtolower($this->name);
- Exclude checks
Argument 1 (tableName)
is false
but \vtlib\Utils::addColumn()
takes string
defined at /code/vtlib/Vtiger/Utils.php:141
Open
Utils::addColumn($this->table, $this->column, $this->columntype);
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string Help text (content)':
after string,
did not see an element name (will guess based on comment order) Open
* @param string Help text (content)
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::delete()
takes string
defined at /code/app/Cache.php:105
Open
\App\Cache::delete('FieldInfoById', $this->id);
- Exclude checks
Assigning int
to property but \vtlib\FieldBasic->sequence
is false
Open
$this->sequence = (int) $valuemap['sequence'];
- Exclude checks
Assigning int
to property but \vtlib\FieldBasic->quicksequence
is false
Open
$this->quicksequence = (int) $valuemap['quickcreatesequence'];
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->dropIndex($nameIndex, $this->table)->execute();
- Exclude checks
Argument 3 (criteria)
is false
but \vtlib\Utils::addColumn()
takes array|string
defined at /code/vtlib/Vtiger/Utils.php:141
Open
Utils::addColumn($this->table, $this->column, $this->columntype);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_field', [
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Updated help information of $this->name ... DONE", __METHOD__);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Assigning 0|float|int
to property but \vtlib\FieldBasic->quicksequence
is false
Open
$this->quicksequence = $this->__getNextQuickCreateSequence();
- Exclude checks
Argument 2 (columnName)
is false
but \vtlib\Utils::addColumn()
takes string
defined at /code/vtlib/Vtiger/Utils.php:141
Open
Utils::addColumn($this->table, $this->column, $this->columntype);
- Exclude checks
Call to undeclared method \vtlib\FieldBasic::getRangeValues
Open
$this->maximumlength = $this->getRangeValues();
- Exclude checks
Assigning null
to property but \vtlib\FieldBasic->quicksequence
is false
Open
$this->quicksequence = 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
$nameIndex = "{$this->table}_{$this->column}_idx";
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param int Masseditable value':
after int,
did not see an element name (will guess based on comment order) Open
* @param int Masseditable value
- Exclude checks
Argument 2 (key)
is false
but \App\Cache::staticDelete()
takes string
defined at /code/app/Cache.php:169
Open
\App\Cache::staticDelete('ModuleFields', $this->getModuleId());
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Deleteing Field $this->name ... DONE", __METHOD__);
- Exclude checks
Argument 1 (tabId)
is false
but \App\Module::getModuleName()
takes int
defined at /code/app/Module.php:129
Open
$moduleName = \App\Module::getModuleName($this->tabid);
- Exclude checks
Argument 2 (key)
is false
but \App\Cache::delete()
takes string
defined at /code/app/Cache.php:105
Open
\App\Cache::delete('BlocksForModule', $this->getModuleId());
- Exclude checks
Assigning 0|float|int
to property but \vtlib\FieldBasic->sequence
is false
Open
$this->sequence = $this->__getNextSequence();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->delete('vtiger_fieldmodulerel', ['fieldid' => $this->id])->execute();
- 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
$nameIndex = "{$this->table}_{$this->column}_idx";
- Exclude checks
Reference to undeclared property \vtlib\FieldBasic->module
Open
$moduleName = $this->module->getName();
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param vtlib\Block Instance of block to which this field should be added':
after vtlib\Block,
did not see an element name (will guess based on comment order) Open
* @param vtlib\Block Instance of block to which this field should be added
- Exclude checks
The property $__cacheSchemaChanges is not named in camelCase. Open
class FieldBasic
{
/** ID of this field instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
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
The property $header_field is not named in camelCase. Open
class FieldBasic
{
/** ID of this field instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $info_type is not named in camelCase. Open
class FieldBasic
{
/** ID of this field instance */
public $id;
public $name;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
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 $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
Property name "$__cacheSchemaChanges" should not be prefixed with an underscore to indicate visibility Open
public static $__cacheSchemaChanges = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $tabid = 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
$this->label = $valuemap['fieldlabel'];
- 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->header_field = $valuemap['header_field'];
- 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 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
* @param \vtlib\Block $blockInstance Instance of block to which this field belongs
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $maxSeq + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** ID of this field 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 $typeofdata = 'V~O';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $maximumlength;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $fieldparams = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $icon = '';
- 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->id = (int) $valuemap['fieldid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->generatedtype = (int) $valuemap['generatedtype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $columntype = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $tabindex = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Initialize this instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->name = $valuemap['fieldname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->visible = (int) $valuemap['visible'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->color = $valuemap['color'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $table = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $displaytype = 1;
- 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->masseditable = (int) $valuemap['masseditable'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxlengthtext = (int) $valuemap['maxlengthtext'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->fieldparams = $valuemap['fieldparams'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __getNextSequence()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $summaryfield = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $readonly = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $defaultvalue = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $quickcreate = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $info_type = 'BAS';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[] Anonymization targets form field ex. logs.
- 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
* Get next sequence id to use within a block for this instance.
- 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
return 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $maxwidthcolumn = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $visible = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $color = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->table = $valuemap['tablename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maximumlength = $valuemap['maximumlength'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->readonly = (int) $valuemap['readonly'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->summaryfield = (int) $valuemap['summaryfield'];
- 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(['tabid' => $this->getModuleId(), 'block' => $this->getBlockId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $maxSeq + 1;
- 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 $masseditable = 1; // Default: Enable massedit for field
- 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 $valuemap
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $__cacheSchemaChanges = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get next quick create sequence id for this instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param vtlib\Block Instance of the block to use
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->quicksequence = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Profile::initForField($this);
- 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
$this->clearCache();
- 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
$indexes = $db->getSchema()->getTableIndexes($this->table, true);
- 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 getModuleName()
- 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 $header_field = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $uitype = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $generatedtype = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maxwidthcolumn = (int) $valuemap['maxwidthcolumn'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->quicksequence = (int) $valuemap['quickcreatesequence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($maxSeq) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 != $this->quickcreate) { // If enabled for display
- 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
$indexes = $db->getSchema()->getTableIndexes($this->table, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->createIndex("{$this->table}_{$this->column}_idx", $this->table, $this->column)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Creating field $this->name ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete this field instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nameIndex = "{$this->table}_{$this->column}_idx";
- 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
$moduleName = $this->block->module->name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($indexObject->name === $nameIndex) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'displaytype' => $this->displaytype,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->clearCache();
- 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
* Get module id to which this field instance is associated.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module name to which this field instance is associated.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance = $this->getModuleInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->label) {
- 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
'fieldname' => $this->name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fieldlabel' => $this->label,
- 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
'helpinfo' => $this->helpinfo,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'summaryfield' => (int) $this->summaryfield,
- 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 block id to which this field instance is associated.
- 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
$moduleName = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->module->getName();
- 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
Utils::addColumn($this->table, $this->column, $this->columntype);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isCreateIndex = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->maximumlength = $this->getRangeValues();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tablename' => $this->table,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => $this->uitype,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->delete('vtiger_field', ['fieldid' => $this->id])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getBlockId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $blockInstance
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sequence = $this->__getNextSequence();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => $this->getModuleId(),
- 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
$db->createCommand()->dropIndex($nameIndex, $this->table)->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
return $this->block->tabid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $helpinfo = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $presence = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $anonymizationTarget = [];
- 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->column = $valuemap['columnname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->typeofdata = $valuemap['typeofdata'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->displaytype = (int) $valuemap['displaytype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->quickcreate = (int) $valuemap['quickcreate'];
- 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->quicksequence = $this->__getNextQuickCreateSequence();
- 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
$isCreateIndex = true;
- 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()->insert('vtiger_field', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Profile::deleteForField($this);
- 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
$db->createCommand()->delete('vtiger_fieldmodulerel', ['fieldid' => $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
* Create this field 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 ($isCreateIndex) {
- 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
} elseif (!empty($this->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 function __create($blockInstance)
- 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
'typeofdata' => $this->typeofdata,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'quickcreate' => (int) $this->quickcreate,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->id = (int) $db->getLastInsertID('vtiger_field_fieldid_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModuleId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->block)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = \App\Module::getModuleName($this->tabid);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $column = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->anonymizationTarget = \App\Json::decode($valuemap['anonymization_target']);
- 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
->max('quickcreatesequence');
- 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 (!$this->table) {
- 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
'masseditable' => $this->masseditable,
- 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
public function __delete()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->tabid) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $label = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $maxlengthtext = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $sequence = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $quicksequence = 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
$this->tabindex = (int) $valuemap['tabindex'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->presence = (int) $valuemap['presence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sequence = (int) $valuemap['sequence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($maxSeq) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
- 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
$this->column = strtolower($this->name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->columntype)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($this->uitype, [10, 318])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $indexObject) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->clearCache();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->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
$this->columntype = 'string(100)';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nameIndex = "{$this->table}_{$this->column}_idx";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => $this->maximumlength,
- 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 false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|string
- 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 $block;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function initialize($valuemap, $module = false, $blockInstance = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->tabid = (int) $valuemap['tabid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->helpinfo = $valuemap['helpinfo'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** Cache (Record) the schema changes to improve performance */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __getNextQuickCreateSequence()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['tabid' => $this->getModuleId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->block = $blockInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->table = $moduleInstance->basetable;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->label = $this->name;
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$db->createCommand()->createIndex("{$this->table}_{$this->column}_idx", $this->table, $this->column)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->maximumlength && method_exists($this, 'getRangeValues')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'generatedtype' => (int) $this->generatedtype,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fieldparams' => $this->fieldparams,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'icon' => $this->icon,
- 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 ($indexObject->name === $nameIndex) {
- 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 ($this->tabid) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->uitype = (int) $valuemap['uitype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultvalue = $valuemap['defaultvalue'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->icon = $valuemap['icon'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->block = $blockInstance ?: Block::getInstance($valuemap['block'], $module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($valuemap['anonymization_target'])) {
- 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
if (!$this->quicksequence) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Initialize other variables which are not done
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'readonly' => $this->readonly,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultvalue' => $this->defaultvalue,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'block' => $this->getBlockId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'quickcreatesequence' => (int) $this->quicksequence,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'info_type' => $this->info_type,
- 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
} elseif (!empty($this->block) && \is_object($this->block)) {
- 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
if (!$this->sequence) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->columntype) {
- 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
'columnname' => $this->column,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'visible' => $this->visible,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Updating Field $this->name ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (10 === $this->uitype) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $indexObject) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Deleteing Field $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
return $this->block->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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save this field 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
$this->__create($blockInstance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Updated help information of $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
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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get block name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('ModuleFieldInfosByName', $this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get module instance to which this field instance is associated.
- 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 save($blockInstance = 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
return $this->id;
- 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
\App\Log::trace("Updated masseditable information of $this->name ... DONE", __METHOD__);
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getBlockName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->block->label;
- 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\Cache::delete('App\Field::getFieldsPermissions' . \App\User::getCurrentUserId(), $this->getModuleName());
- 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 setMassEditable($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('ModuleFieldInfosByColumn', $this->getModuleName());
- 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
}
- 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 mixed
- 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 setSummaryField($value)
- 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
* Clear cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $helptext
- 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
->update('vtiger_field', ['summaryfield' => $value], ['fieldid' => $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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->block) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticDelete('module', $this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('BlocksForModule', $this->getModuleId());
- 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
public function setHelpInfo($helptext)
- 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 $blockInstance
- 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
* Set Help Information for 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
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int Summaryfield value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Updated summaryfield information of $this->name ... DONE", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- 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
* Set Masseditable information for this instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int Masseditable value
- 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\Db::getInstance()->createCommand()
- 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
\App\Db::getInstance()->createCommand()
- 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\Cache::delete('FieldInfoById', $this->id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('getRelatedFieldForModule', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param vtlib\Block Instance of block to which this field should be added
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete this field instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set Summaryfield information for 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
\Vtiger_Module_Model::getInstance($this->getModuleName())->clearCache();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->block->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
* @param string Help text (content)
- 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
->update('vtiger_field', ['masseditable' => $value], ['fieldid' => $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
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function clearCache(): void
- 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
* @param mixed $value
- 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 getModuleInstance()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Make sure to initialize the core tables first
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('vtiger_field', ['helpinfo' => $helptext], ['fieldid' => $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
\App\Cache::staticDelete('ModuleFields', $this->getModuleId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('AllFieldForModule', $this->getModuleId());
- Exclude checks
The method __create is not named in camelCase. Open
public function __create($blockInstance)
{
$db = \App\Db::getInstance();
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
- 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 __getNextSequence is not named in camelCase. Open
public function __getNextSequence()
{
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
->where(['tabid' => $this->getModuleId(), 'block' => $this->getBlockId()])
->max('sequence');
- 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()
{
Profile::deleteForField($this);
$db = \App\Db::getInstance();
$db->createCommand()->delete('vtiger_field', ['fieldid' => $this->id])->execute();
- 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 __getNextQuickCreateSequence is not named in camelCase. Open
public function __getNextQuickCreateSequence()
{
$maxSeq = (new \App\Db\Query())->from('vtiger_field')
->where(['tabid' => $this->getModuleId()])
->max('quickcreatesequence');
- 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 __update is not named in camelCase. Open
public function __update()
{
$this->clearCache();
\App\Log::trace("Updating Field $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() {
}
}