Function getEditFieldsModel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getEditFieldsModel()
{
$moduleName = $this->getModule()->getName(true);
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
$fieldModels = [];
- 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 Settings_PBX_Record_Model has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Settings_PBX_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Edit fields.
*
- 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 '156', column '16'). Open
$data = (new App\Db\Query())
- 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\Json' in method 'getInstanceById'. Open
$instance->param = \App\Json::decode($data['param']);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'getCleanInstance'. Open
$instance->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Vtiger_Field_Model' in method 'getEditFieldsModel'. Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $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 'Settings_Vtiger_Field_Model' in method 'getConnectorFieldsModel'. Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $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 'Vtiger_Link_Model' in method 'getRecordLinks'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
- 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\Integrations\Pbx' in method 'getEditFieldsModel'. Open
foreach (App\Integrations\Pbx::getConnectors() as $connectorName => $instance) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Vtiger_Module_Model' in method 'getModule'. Open
$this->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- 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\Language' in method 'getDisplayValue'. Open
return $this->get($key) ? \App\Language::translate('LBL_YES') : \App\Language::translate('LBL_NO');
- 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\Integrations\Pbx' in method 'getConnectorFieldsModel'. Open
$connector = App\Integrations\Pbx::getConnectorInstance($this->get('type'));
- 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 'getInstanceById'. Open
\App\Cache::staticSave('Settings_PBX_Record_Model', $id, $instance);
- 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\Json' in method 'parseFromRequest'. Open
$this->set('param', \App\Json::encode($params));
- 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\Integrations\Pbx' in method 'parseFromRequest'. Open
$connector = App\Integrations\Pbx::getConnectorInstance($data['type']);
- 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 'getInstanceById'. Open
if (\App\Cache::staticHas('Settings_PBX_Record_Model', $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
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 {
$seccess = $db->createCommand()->insert('s_#__pbx', $data)->execute();
if ($seccess) {
$this->set('pbxid', $db->getLastInsertID('s_#__pbx_pbxid_seq'));
}
- 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\Language' in method 'getDisplayValue'. Open
return $this->get($key) ? \App\Language::translate('LBL_YES') : \App\Language::translate('LBL_NO');
- 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\Language' in method 'getEditFieldsModel'. Open
$connectors[$connectorName] = \App\Language::translate($instance->name, $moduleName);
- 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 'save'. 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\Purifier' in method 'getDisplayValue'. Open
return \App\Purifier::encodeHtml($this->get($key));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getInstanceById'. Open
return \App\Cache::staticGet('Settings_PBX_Record_Model', $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
Define a constant instead of duplicating this literal "param" 3 times. Open
if (!empty($data['param'])) {
- 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 "isEditableReadOnly" 3 times. Open
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
- 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 "typeofdata" 3 times. Open
'default' => ['label' => 'LBL_DEFAULT', 'uitype' => 56, 'typeofdata' => 'C~O'],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "uitype" 4 times. Open
'type' => ['label' => 'LBL_TYPE', 'uitype' => 16],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "s_#__pbx" 5 times. Open
->from('s_#__pbx')
- 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 "pbxid" 6 times. Open
return $this->get('pbxid');
- 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 "Settings_PBX_Record_Model" 3 times. Open
if (\App\Cache::staticHas('Settings_PBX_Record_Model', $id)) {
- 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 "label" 3 times. Open
'name' => ['label' => 'LBL_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 "default" 4 times. Open
'default' => ['label' => 'LBL_DEFAULT', 'uitype' => 56, 'typeofdata' => 'C~O'],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused local variables such as '$value'. Open
foreach ($this->getEditFields() as $name => $value) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused local variables such as '$config'. Open
foreach ($connector->configFields as $name => $config) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Call to undeclared method \App\Db\Query::from
Open
$data = (new App\Db\Query())
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$result = $db->createCommand()->delete('s_#__pbx', ['pbxid' => $recordId])->execute();
- Exclude checks
Reference to undeclared property \Settings_PBX_Record_Model->module
Open
$this->module = $moduleModel;
- Exclude checks
Reference to undeclared property \Settings_PBX_Record_Model->module
Open
if (!$this->module) {
- Exclude checks
Returning type \Vtiger_Field_Model[]|array{}
but getConnectorFieldsModel()
is declared to return \type
Open
return $fieldModels;
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticSave()
takes string
defined at /code/app/Cache.php:156
Open
\App\Cache::staticSave('Settings_PBX_Record_Model', $id, $instance);
- Exclude checks
Return type of getCleanInstance()
is undeclared type \self
Open
public static function getCleanInstance()
- Exclude checks
Return type of getConnectorFieldsModel()
is undeclared type \type
Open
public function getConnectorFieldsModel()
- Exclude checks
Saw an @param annotation for request,
but the param list of function save() : bool
is empty Open
* @param \App\Request $request
- Exclude checks
Saw an @param annotation for name,
but it was not found in the param list of function getDisplayValue(string $key) : string
Open
* @param string $name
- Exclude checks
Saw an @param annotation for type,
but it was not found in the param list of function getInstanceById(int $id) : \Settings_PBX_Record_Model|\self
Open
* @param string $type
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticHas()
takes string
defined at /code/app/Cache.php:141
Open
if (\App\Cache::staticHas('Settings_PBX_Record_Model', $id)) {
- Exclude checks
Reference to instance property configFields
from undeclared class \App\Integrations\className
Open
foreach ($connector->configFields as $name => $params) {
- Exclude checks
Reference to undeclared property \Settings_PBX_Record_Model->module
Open
$this->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('s_#__pbx', $data, ['pbxid' => $this->getId()])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$seccess = $db->createCommand()->insert('s_#__pbx', $data)->execute();
- Exclude checks
Return type of getInstanceById()
is undeclared type \self
Open
public static function getInstanceById($id)
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticGet()
takes string
defined at /code/app/Cache.php:128
Open
return \App\Cache::staticGet('Settings_PBX_Record_Model', $id);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('s_#__pbx', ['default' => 0])->execute();
- Exclude checks
Reference to undeclared property \Settings_PBX_Record_Model->module
Open
return $this->module;
- Exclude checks
Reference to undeclared property \Settings_PBX_Record_Model->module
Open
$instance->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- Exclude checks
Reference to instance property configFields
from undeclared class \App\Integrations\className
Open
foreach ($connector->configFields as $name => $config) {
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_PBX_Record_Model extends Settings_Vtiger_Record_Model
- Exclude checks
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
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getInstanceById($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
The class Settings_PBX_Record_Model is not named in CamelCase. Open
class Settings_PBX_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Edit fields.
*
- 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
*/
- 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->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 $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEditFields()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWRECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'default' => ['label' => 'LBL_DEFAULT', 'uitype' => 56, 'typeofdata' => 'C~O'],
- 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 Settings_PBX_Module_Model $moduleModel
- 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
'linkicon' => 'yfi yfi-full-editing-view',
- 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
'type' => ['label' => 'LBL_TYPE', 'uitype' => 16],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $param;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the confog param for a given key.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getParam($key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Module 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
/** {@inheritdoc} */
- 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
[
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('pbxid');
- 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
$links = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWRECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance, given 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
Line exceeds 120 characters; contains 146 characters Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Connector configuration.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed Value for the given key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('default' === $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get($key) ? \App\Language::translate('LBL_YES') : \App\Language::translate('LBL_NO');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_DELETE_RECORD',
- 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
foreach ($this->editFields as $name => $params) {
- 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
foreach ($connector->configFields as $name => $params) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function 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
return $this->param[$key] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_PBX_Module_Model
- 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
'modalView' => 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
* @param string $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
* @return \self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function removes record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModels[$name] = $fieldModel;
- 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
$seccess = 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
$params[$name] = $data[$name] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setModule($moduleModel)
- 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
return \App\Purifier::encodeHtml($this->get($key));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticSave('Settings_PBX_Record_Model', $id, $instance);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the clean instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- 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
public function save()
- 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->set('param', \App\Json::encode($params));
- 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
* Function to set Module instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->module = $moduleModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDisplayValue(string $key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function determines fields available in edition view.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordLinks = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'index.php?module=PBX&parent=Settings&view=EditModal&record=' . $this->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn btn-sm btn-primary',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($data['param'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->setData($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordId) {
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $name]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel->set('isEditableReadOnly', 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
$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
return $links;
- 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
$recordId = $this->getId();
- 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 = $this->getModule()->getName(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $name]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($data['default']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('s_#__pbx', $data, ['pbxid' => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => ['label' => 'LBL_NAME'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Record 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
*/
- 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 string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordLinks(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($recordLinks as $recordLink) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- 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
->one();
- 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
public function getEditFieldsModel()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (App\Integrations\Pbx::getConnectors() as $connectorName => $instance) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['picklistValues'] = $connectors;
- 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 $fieldModels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('s_#__pbx', ['default' => 0])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set($name, $data[$name] ?? null);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Record 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
/**
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_EDIT_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCleanInstance()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- 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 parseFromRequest($data)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$connector = App\Integrations\Pbx::getConnectorInstance($data['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
public function getId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->editFields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'javascript:Settings_Vtiger_List_Js.deleteById(' . $this->getId() . ');',
- 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 = new self();
- 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 Settings_Vtiger_Field_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel->set('fieldvalue', $this->get($name));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\Request $request
- 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
foreach ($this->getEditFields() as $name => $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
$this->module = Settings_Vtiger_Module_Model::getInstance('Settings:PBX');
- 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
* @param string $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
if (\App\Cache::staticHas('Settings_PBX_Record_Model', $id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = self::getCleanInstance();
- 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
$connectors = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $editFields = [
- 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
*
- 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 static function getInstanceById($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = (new App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('s_#__pbx')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['pbxid' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->param = \App\Json::decode($data['param']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel->set('fieldvalue', $this->getParam($name));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($seccess) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse dana from request.
- 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
* Edit fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Display Value, for the current field type with given DB Insert 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
'linkicon' => 'fas fa-trash-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn btn-sm btn-danger',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('type' === $name && $this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get connector config fields model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save pbx instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$seccess = $db->createCommand()->insert('s_#__pbx', $data)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $db->createCommand()->delete('s_#__pbx', ['pbxid' => $recordId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return !empty($result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$connectors[$connectorName] = \App\Language::translate($instance->name, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModels[$name] = $fieldModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return 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
$data = $this->getData();
- 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
$params = [];
- 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 \App\Cache::staticGet('Settings_PBX_Record_Model', $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get edit fields model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->getModule()->getName(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('type' === $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
public function getConnectorFieldsModel()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($connector) {
- 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 $seccess;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->param = $params;
- 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 $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
Line exceeds 120 characters; contains 129 characters Open
$mainParams = ['uitype' => 1, 'displaytype' => 1, 'typeofdata' => 'V~M', 'presence' => 0, 'isEditableReadOnly' => false];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = Settings_Vtiger_Field_Model::init($moduleName, array_merge($mainParams, $params, ['column' => $name, 'name' => $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 bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('pbxid', $db->getLastInsertID('s_#__pbx_pbxid_seq'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $data
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($data['pbxid']);
- 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 $fieldModels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$connector = App\Integrations\Pbx::getConnectorInstance($this->get('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
foreach ($connector->configFields as $name => $config) {
- Exclude checks
Class name "Settings_PBX_Record_Model" is not in camel caps format Open
class Settings_PBX_Record_Model extends Settings_Vtiger_Record_Model
- Exclude checks