modules/Vtiger/inventoryfields/Integer.php
Missing class import via use statement (line '39', column '14'). Open
Open
throw new \App\Exceptions\Security("ERR_VALUE_IS_TOO_LONG||$columnName||$value < $this->maximumLength", 406);
- 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 getDisplayValue has a boolean flag argument $rawText, which is a certain sign of a Single Responsibility Principle violation. Open
Open
public function getDisplayValue($value, array $rowData = [], bool $rawText = 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 '36', column '14'). Open
Open
throw new \App\Exceptions\Security("ERR_ILLEGAL_FIELD_VALUE||$columnName||$value", 406);
- 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\Fields\Integer' in method 'getDisplayValue'. Open
Open
return \App\Fields\Integer::formatToDisplay($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
Reference to constant TYPE_INTEGER
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
Open
protected $dbType = [\yii\db\Schema::TYPE_INTEGER, 11];
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Vtiger_Integer_InventoryField extends Vtiger_Basic_InventoryField
- Exclude checks
The class Vtiger_Integer_InventoryField is not named in CamelCase. Open
Open
class Vtiger_Integer_InventoryField extends Vtiger_Basic_InventoryField
{
protected $type = 'Integer';
protected $defaultLabel = 'LBL_INTEGER';
protected $columnName = 'int';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
Open
return (int) $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
throw new \App\Exceptions\Security("ERR_ILLEGAL_FIELD_VALUE||$columnName||$value", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $defaultLabel = 'LBL_INTEGER';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDBValue($value, ?string $name = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (false === filter_var($value, FILTER_VALIDATE_INT)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $onlyOne = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (empty($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $purifyType = \App\Purifier::INTEGER;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $type = 'Integer';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $columnName = 'int';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $maximumLength = '99999999999999999999';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $dbType = [\yii\db\Schema::TYPE_INTEGER, 11];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($value > $this->maximumLength || $value < -$this->maximumLength) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
throw new \App\Exceptions\Security("ERR_VALUE_IS_TOO_LONG||$columnName||$value < $this->maximumLength", 406);
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
Open
throw new \App\Exceptions\Security("ERR_VALUE_IS_TOO_LONG||$columnName||$value < $this->maximumLength", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return \App\Fields\Integer::formatToDisplay($value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDisplayValue($value, array $rowData = [], bool $rawText = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Class name "Vtiger_Integer_InventoryField" is not in camel caps format Open
Open
class Vtiger_Integer_InventoryField extends Vtiger_Basic_InventoryField
- Exclude checks