The class AutoAssign has an overall complexity of 60 which is very high. The configured complexity threshold is 50. Open
class AutoAssign extends Base
{
/** @var string Basic table name */
public const TABLE_NAME = 's_#__auto_assign';
/** @var array Members tables */
- Exclude checks
Method getAvailableUsersQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAvailableUsersQuery(): QueryGenerator
{
$queryGenerator = (new QueryGenerator('Users'))
->setFields(['id'])
->addCondition('status', 'Active', 'e')
Function getAvailableUsersQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableUsersQuery(): QueryGenerator
{
$queryGenerator = (new QueryGenerator('Users'))
->setFields(['id'])
->addCondition('status', 'Active', 'e')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getMembers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getMembers(): array
{
if (!$this->has('members')) {
$queryAll = null;
foreach (self::MEMBERS_TABLES as $tableName => $index) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function isActive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isActive(int $mode): bool
{
switch ($mode) {
case self::MODE_MANUAL:
$result = !$this->isEmpty('gui');
- 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 AutoAssign has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class AutoAssign extends Base
{
/** @var string Basic table name */
public const TABLE_NAME = 's_#__auto_assign';
/** @var array Members tables */
- 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 '285', column '63'). Open
return $this->getQuery()->orderBy(['count' => SORT_ASC, new \yii\db\Expression('RAND()')]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '329', column '63'). Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => new \yii\db\Expression($recordLimit)]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '424', column '32'). Open
$params['datetime'] = (new \DateTime())->format('Y-m-d H:i:s.u');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '393', column '32'). Open
->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '422', column '69'). Open
$dbCommand->update(self::ROUND_ROBIN_TABLE, ['datetime' => (new \DateTime())->format('Y-m-d H:i:s.u')], $params)->execute();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getName has a boolean flag argument $encode, which is a certain sign of a Single Responsibility Principle violation. Open
public function getName(bool $encode = true): string
- 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 '319', column '38'). Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '335', column '47'). Open
$query->andHaving(['or', ['<', 'count', new \yii\db\Expression('temp_limit')], ['temp_limit' => 0], ['count' => null]]);
- 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 'getQuery'. Open
$conditions = Json::isEmpty($this->get('record_limit_conditions')) ? [] : Json::decode($this->get('record_limit_conditions'));
- 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\PrivilegeUtil' in method 'getAvailableUsersQuery'. Open
$condition[] = [$columnName => (new Db\Query())->select(['userid'])->from(["condition_{$type}_{$id}_" . Layout::getUniqueId() => PrivilegeUtil::getQueryToUsersByGroup((int) $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\YetiForce\Shop' in method 'getAutoAssignForRecord'. Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- 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\Condition' in method 'checkConditionForRecord'. Open
return Condition::checkConditions($conditions, $recordModel);
- 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 getQuery uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$queryGeneratorUsers->setCustomColumn(['temp_limit' => new \yii\db\Expression($recordLimit)]);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Module' in method 'getByModule'. Open
->where(['tabid' => Module::getModuleId($moduleName), 'state' => $state]);
- 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 'checkConditionForRecord'. Open
$conditions = Json::isEmpty($this->get('conditions')) ? [] : Json::decode($this->get('conditions'));
- 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 'getName'. Open
return Language::translate($this->get('subject'), 'Settings:AutomaticAssignment', false, $encode);
- 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\Fields\Owner' in method 'getDefaultOwner'. Open
$type = $defaultOwner ? Fields\Owner::getType($defaultOwner) : null;
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Json' in method 'getQuery'. Open
$conditions = Json::isEmpty($this->get('record_limit_conditions')) ? [] : Json::decode($this->get('record_limit_conditions'));
- 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\PrivilegeUtil' in method 'getAvailableUsersQuery'. Open
$condition[] = [$columnName => PrivilegeUtil::getQueryToUsersByRole($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\Layout' in method 'getAvailableUsersQuery'. Open
$condition[] = [$columnName => (new Db\Query())->select(['userid'])->from(["condition_{$type}_{$id}_" . Layout::getUniqueId() => PrivilegeUtil::getQueryToUsersByGroup((int) $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 getMembers uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$queryAll = $query;
}
- 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 'getAutoAssignForRecord'. Open
$conditions = Json::isEmpty($autoAssignData['conditions']) ? [] : Json::decode($autoAssignData['conditions']);
- 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\PrivilegeUtil' in method 'getAvailableUsersQuery'. Open
$condition[] = [$columnName => PrivilegeUtil::getQueryToUsersByRoleAndSubordinate($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\User' in method 'postProcess'. Open
} elseif (\App\User::isExists($userId, false)) {
- 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\Fields\Owner' in method 'getDefaultOwner'. Open
$ownerModel = Fields\Owner::getInstance($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\Json' in method 'checkConditionForRecord'. Open
$conditions = Json::isEmpty($this->get('conditions')) ? [] : Json::decode($this->get('conditions'));
- 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\Condition' in method 'getAutoAssignForRecord'. Open
if (Condition::checkConditions($conditions, $recordModel)) {
- 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 'getDefaultOwner'. Open
$owner = User::isExists($defaultOwner) ? $defaultOwner : $owner;
- 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
return Module::getModuleName($this->get('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\Json' in method 'getAutoAssignForRecord'. Open
$conditions = Json::isEmpty($autoAssignData['conditions']) ? [] : Json::decode($autoAssignData['conditions']);
- 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 "conditions" 4 times. Open
$conditions = Json::isEmpty($autoAssignData['conditions']) ? [] : Json::decode($autoAssignData['conditions']);
- 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 "temp_limit" 5 times. Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => $queryGeneratorUsers->getColumnName('records_limit')]);
- 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 "method" 3 times. Open
switch ($this->get('method')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "members" 3 times. Open
if (!$this->has('members')) {
- 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 "count" 5 times. Open
return $this->getQuery()->orderBy(['count' => SORT_ASC, new \yii\db\Expression('RAND()')]);
- 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.
Argument 3 (language)
is false
but \App\Language::translate()
takes null|string
defined at /code/app/Language.php:161
Open
return Language::translate($this->get('subject'), 'Settings:AutomaticAssignment', false, $encode);
- Exclude checks
Call to undeclared method \App\Db\Query::all
Open
$owner = $this->getQueryByLoadBalance()->all();
- Exclude checks
Call to undeclared method \App\Db\Query::all
Open
$owner = $this->getQueryByRoundRobin()->all();
- Exclude checks
Doc-block of getDefaultOwner
has declared return type int
which is not a permitted replacement of the nullable return type ?int
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @return int
- Exclude checks
Returning type string
but getOwner()
is declared to return ?int|int
Open
return $owner ? $owner : $this->getDefaultOwner();
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$ownerModel = Fields\Owner::getInstance($this->getModuleName());
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new Db\Query())->from(self::TABLE_NAME)
- Exclude checks
Doc-block of getOwner
has declared return type int
which is not a permitted replacement of the nullable return type ?int
declared in the signature ('?T' should be documented as 'T|null' or '?T') Open
* @return int
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$data = (new Db\Query())->from(self::TABLE_NAME)->where(['id' => $id])->one();
- Exclude checks
Call to method check
from undeclared class \App\YetiForce\Shop
Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Exclude checks
Call to undeclared method \App\Db\Query::orderBy
Open
return $this->getQuery()->orderBy(['count' => SORT_ASC, new \yii\db\Expression('RAND()')]);
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => new \yii\db\Expression($recordLimit)]);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExists = (new Db\Query())->from(self::ROUND_ROBIN_TABLE)->where($params)->exists();
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
return $this->getQuery()->orderBy(['count' => SORT_ASC, new \yii\db\Expression('RAND()')]);
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
->addNativeCondition([$queryGenerator->getColumnName($ownerFieldName) => $queryGeneratorUsers->createQuery()]);
- Exclude checks
Call to method setGroup
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGeneratorUsers->setGroup('id')->setCustomGroup(['temp_limit', 'count']);
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query = $queryGeneratorUsers->createQuery(true);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$condition[] = [$columnName => (new Db\Query())->select(['userid'])->from(["condition_{$type}_{$id}_" . Layout::getUniqueId() => PrivilegeUtil::getQueryToUsersByGroup((int) $id)])];
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator->setFields([$ownerFieldName])
- Exclude checks
Call to method getColumnName
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => $queryGeneratorUsers->getColumnName('records_limit')]);
- Exclude checks
Call to method setCustomColumn
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => new \yii\db\Expression($recordLimit)]);
- Exclude checks
Call to method isExists
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$owner = User::isExists($defaultOwner) ? $defaultOwner : $owner;
- Exclude checks
Call to method setCustomColumn
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => $queryGeneratorUsers->getColumnName('records_limit')]);
- Exclude checks
Call to undeclared method \App\Db\Query::leftJoin
Open
return $this->getQuery()->leftJoin($robinTable, "vtiger_users.id = {$robinTable}.user AND {$robinTable}.id={$id}")
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new Db\Query())
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = Db::getInstance()->createCommand();
- Exclude checks
Call to method getType
from undeclared class \App\Fields\Owner
Open
$type = $defaultOwner ? Fields\Owner::getType($defaultOwner) : null;
- Exclude checks
Call to method getColumnName
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query->leftJoin(['crm_data_temp_table' => $subQuery], "crm_data_temp_table.{$ownerFieldName}={$queryGeneratorUsers->getColumnName('id')}");
- Exclude checks
Call to method isExists
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
} elseif (\App\User::isExists($userId, false)) {
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = (new QueryGenerator($this->getModuleName()));
- Exclude checks
Call to method getColumnName
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
->addNativeCondition([$queryGenerator->getColumnName($ownerFieldName) => $queryGeneratorUsers->createQuery()]);
- Exclude checks
Call to method __construct
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = (new QueryGenerator('Users'))
- Exclude checks
Call to method setFields
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$queryGenerator = (new QueryGenerator('Users'))
- Exclude checks
Return type of getAvailableUsersQuery()
is undeclared type \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
public function getAvailableUsersQuery(): QueryGenerator
- Exclude checks
Reference to instance property permissions
from undeclared class \App\QueryGenerator
Open
$queryGenerator->permissions = false;
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])
- Exclude checks
Call to method createQuery
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$subQuery = $queryGenerator->createQuery();
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
$query->andHaving(['or', ['<', 'count', new \yii\db\Expression('temp_limit')], ['temp_limit' => 0], ['count' => null]]);
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $this->getId();
- 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(int $id): ?self
- 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
[$type, $id] = explode(':', $member);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Handler mode */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mods = ['or'];
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$conditions = Json::isEmpty($autoAssignData['conditions']) ? [] : Json::decode($autoAssignData['conditions']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceById(int $id): ?self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = (new Db\Query())->from(self::TABLE_NAME)->where(['id' => $id])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check conditions for record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::MODE_HANDLER:
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const MEMBERS_TABLES = ['s_#__auto_assign_users' => 'id', 's_#__auto_assign_groups' => 'id', 's_#__auto_assign_roles' => '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
public static function getAutoAssignForRecord(\Vtiger_Record_Model $recordModel, int $mode = null): ?self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $autoAssignInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return self|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = !$this->isEmpty('gui');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get auto assign instance for 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance(array $data): ?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
/** @var string Round robin table name */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
foreach ([self::MODE_MANUAL => 'gui', self::MODE_HANDLER => 'handler', self::MODE_WORKFLOW => 'workflow'] as $key => $column) {
- Exclude checks
Spaces must 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 $this->get('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 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
break;
- 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
public const TABLE_NAME = 's_#__auto_assign';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Manual mode */
- Exclude checks
Spaces must 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 string Basic table name */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const ROUND_ROBIN_TABLE = 'u_#__auto_assign_rr';
- Exclude checks
Spaces must 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 $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getByModule(string $moduleName, int $mode = self::MODE_HANDLER | self::MODE_WORKFLOW | self::MODE_MANUAL, int $state = self::STATUS_ACTIVE): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $mode A bitmask of one or more of the mode flags
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = Json::isEmpty($autoAssignData['conditions']) ? [] : Json::decode($autoAssignData['conditions']);
- Exclude checks
Spaces must 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 Condition::checkConditions($conditions, $recordModel);
- 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
case self::MODE_WORKFLOW:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var array Members tables */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $mode A bitmask of one or more of the mode flags
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instances[$autoAssignData['id']] = self::getInstance($autoAssignData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\YetiForce\Shop::check('YetiForceAutoAssignment')) {
- Exclude checks
Spaces must 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 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
* Get module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::MODE_MANUAL:
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addGroupBy($columnName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Query generator object of available users.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition[] = [$columnName => (new Db\Query())->select(['userid'])->from(["condition_{$type}_{$id}_" . Layout::getUniqueId() => PrivilegeUtil::getQueryToUsersByGroup((int) $id)])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case PrivilegeUtil::MEMBER_TYPE_ROLES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const STATUS_INACTIVE = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const STATUS_ACTIVE = 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
$query = (new Db\Query())->from(self::TABLE_NAME)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ([self::MODE_MANUAL => 'gui', self::MODE_HANDLER => 'handler', self::MODE_WORKFLOW => 'workflow'] as $key => $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mods[] = [$column => 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
break;
- Exclude checks
Spaces must 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
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Round robin method */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $state
- Exclude checks
Spaces must 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
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getOwner(): ?int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $this->getQueryByLoadBalance()->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get default owner.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* it is always the first one in the results who will be assigned to new entry.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const MODE_WORKFLOW = 4;
- Exclude checks
Spaces must 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 const METHOD_ROUND_ROBIN = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getQueryByRoundRobin(): Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all auto assign entries for module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['tabid' => Module::getModuleId($moduleName), 'state' => $state]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query->all();
- Exclude checks
Spaces must 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|null $mode A bitmask of one or more of the mode flags
- Exclude checks
Spaces must 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 bool $encode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instances = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return self|null
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get name of auto assign instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getName(bool $encode = true): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = Json::isEmpty($this->get('conditions')) ? [] : Json::decode($this->get('conditions'));
- Exclude checks
Spaces must 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
$owner = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* In order to correctly balance the entries attribution
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->permissions = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setConditions($conditions)
- Exclude checks
Spaces must 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 getAvailableUsersQuery(): QueryGenerator
- 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
/** @var int Status inactive */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Load balance method */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($mode & $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
$query->andWhere($mods);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get all auto assign instances for module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must 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 self|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $mode
- Exclude checks
Spaces must 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 $result && self::STATUS_ACTIVE === (int) $this->get('state');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const MODE_HANDLER = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$autoAssignInstance = self::getInstance($autoAssignData);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $data ? (new self())->setData($data) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isActive(int $mode): bool
- Exclude checks
Spaces must 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
case self::METHOD_LOAD_BALANCE:
- 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
public function getDefaultOwner(): ?int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerModel = Fields\Owner::getInstance($this->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = \array_key_exists($defaultOwner, $ownerModel->getAccessibleGroupForModule()) ? $defaultOwner : $owner;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->orderBy([$columnName => SORT_ASC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Query object for users allowed for assignment.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getQuery(): Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordLimit = (int) $this->get('record_limit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->leftJoin(['crm_data_temp_table' => $subQuery], "crm_data_temp_table.{$ownerFieldName}={$queryGeneratorUsers->getColumnName('id')}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnName = $queryGenerator->getColumnName('id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition = ['or'];
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
public const MEMBERS_TABLES = ['s_#__auto_assign_users' => 'id', 's_#__auto_assign_groups' => 'id', 's_#__auto_assign_roles' => 'id'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Workflow mode */
- Exclude checks
Spaces must 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 $instances;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get auto assign instance by 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 $data ? (new self())->setData($data) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Language::translate($this->get('subject'), 'Settings:AutomaticAssignment', false, $encode);
- Exclude checks
Spaces must 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(): 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
* Check if the instance is active in a given mode.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = !$this->isEmpty('handler');
- Exclude checks
Spaces must 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 int
- 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
*
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case PrivilegeUtil::MEMBER_TYPE_ROLE_AND_SUBORDINATES:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Status active */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const METHOD_LOAD_BALANCE = 0;
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
public static function getByModule(string $moduleName, int $mode = self::MODE_HANDLER | self::MODE_WORKFLOW | self::MODE_MANUAL, int $state = self::STATUS_ACTIVE): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::getByModule($moduleName, $mode) as $autoAssignData) {
- Exclude checks
Spaces must 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 $autoAssignInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Condition::checkConditions($conditions, $recordModel)) {
- 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
/**
- Exclude checks
Spaces must 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 Module::getModuleName($this->get('tabid'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkConditionForRecord(\Vtiger_Record_Model $recordModel): bool
- Exclude checks
Spaces must 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
$query = $queryGeneratorUsers->createQuery(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const MODE_MANUAL = 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstancesByModule(string $moduleName, int $mode = null): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::getByModule($recordModel->getModuleName(), $mode) as $autoAssignData) {
- Exclude checks
Spaces must 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 auto assign instance by data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must 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
$result = !$this->isEmpty('workflow');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get an automatic selected user ID.
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Otherwise, when multiple users have the same amount of entries
- Exclude checks
Spaces must 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
->setFields(['id'])
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
$condition[] = [$columnName => (new Db\Query())->select(['userid'])->from(["condition_{$type}_{$id}_" . Layout::getUniqueId() => PrivilegeUtil::getQueryToUsersByGroup((int) $id)])];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$owner = \array_key_exists($defaultOwner, $ownerModel->getAccessibleGroupForModule()) ? $defaultOwner : $owner;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
return $this->getQuery()->leftJoin($robinTable, "vtiger_users.id = {$robinTable}.user AND {$robinTable}.id={$id}")
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGeneratorUsers->setGroup('id')->setCustomGroup(['temp_limit', 'count']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andHaving(['or', ['<', 'count', new \yii\db\Expression('temp_limit')], ['temp_limit' => 0], ['count' => null]]);
- 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
public function postProcess(int $userId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update(self::ROUND_ROBIN_TABLE, ['datetime' => (new \DateTime())->format('Y-m-d H:i:s.u')], $params)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::METHOD_ROUND_ROBIN:
- Exclude checks
Spaces must 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 ('Users' === $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* we need ot randomize the order in which they are returned.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addSelect([$columnName])
- Exclude checks
Spaces must 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 (0 === $recordLimit) {
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$query->andHaving(['or', ['<', 'count', new \yii\db\Expression('temp_limit')], ['temp_limit' => 0], ['count' => null]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === \count($condition)) {
- Exclude checks
Spaces must 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 (self::MEMBERS_TABLES as $tableName => $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$members = $queryAll->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getMembers(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->has('members')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['member' => new \yii\db\Expression('CONCAT(type,\':\', member)')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->addNativeCondition($condition);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isExists) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $owner;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = $defaultOwner ? Fields\Owner::getType($defaultOwner) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = User::isExists($defaultOwner) ? $defaultOwner : $owner;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Query object for users allowed to be assigned by load balanced method.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => new \yii\db\Expression($recordLimit)]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator = (new QueryGenerator('Users'))
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert(self::ROUND_ROBIN_TABLE, $params)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $this->getQueryByRoundRobin()->scalar() ?: null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $this->getQueryByRoundRobin()->all();
- 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
$columnName = "{$robinTable}.datetime";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->addSelect(['crm_data_temp_table.count']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($type) {
- 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
$condition[] = [$columnName => PrivilegeUtil::getQueryToUsersByRole($id)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition[] = [$columnName => PrivilegeUtil::getQueryToUsersByRoleAndSubordinate($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
$queryAll = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = $this->getQueryByLoadBalance()->scalar() ?: null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultOwner = (int) $this->get('default_assign');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $this->getId();
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$query->leftJoin(['crm_data_temp_table' => $subQuery], "crm_data_temp_table.{$ownerFieldName}={$queryGeneratorUsers->getColumnName('id')}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$type, $id] = explode(':', $member);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case PrivilegeUtil::MEMBER_TYPE_USERS:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition = [$columnName => 0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Post process action.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userId && self::METHOD_ROUND_ROBIN === (int) $this->get('method')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = ['id' => $this->getId(), 'user' => $userId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $owner ? $owner : $this->getDefaultOwner();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $owner;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ownerFieldName = 'assigned_user_id';
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
->addNativeCondition([$queryGenerator->getColumnName($ownerFieldName) => $queryGeneratorUsers->createQuery()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subQuery = $queryGenerator->createQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $queryGenerator;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryAll = $query;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('members');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::METHOD_LOAD_BALANCE:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case self::METHOD_ROUND_ROBIN:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($this->get('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
$queryGenerator = (new QueryGenerator($this->getModuleName()));
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$conditions = Json::isEmpty($this->get('record_limit_conditions')) ? [] : Json::decode($this->get('record_limit_conditions'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setCustomColumn(['count' => new \yii\db\Expression('COUNT(*)')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->setGroup($ownerFieldName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addCondition('auto_assign', 1, 'e');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getMembers() as $member) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($tableName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($this->get('method')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryAll->union($query, 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
$this->set('members', $members);
- 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
* Get automatic selected users.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getOwners(): array
- 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
}
- Exclude checks
Spaces must 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->getQuery()->leftJoin($robinTable, "vtiger_users.id = {$robinTable}.user AND {$robinTable}.id={$id}")
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGenerator->setFields([$ownerFieldName])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addNativeCondition([$queryGenerator->getColumnName($ownerFieldName) => $queryGeneratorUsers->createQuery()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => $queryGeneratorUsers->getColumnName('records_limit')]);
- 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
->addCondition('available', 1, 'e')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$condition[$type][$columnName][] = (int) $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case PrivilegeUtil::MEMBER_TYPE_GROUPS:
- Exclude checks
Spaces must 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 members.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- 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
} elseif (\App\User::isExists($userId, false)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must 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 getQueryByLoadBalance(): Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getQuery()->orderBy(['count' => SORT_ASC, new \yii\db\Expression('RAND()')]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Query object for users allowed to be assigned by round robin.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Db\Query
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$robinTable = self::ROUND_ROBIN_TABLE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryGeneratorUsers = $this->getAvailableUsersQuery();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = Json::isEmpty($this->get('record_limit_conditions')) ? [] : Json::decode($this->get('record_limit_conditions'));
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$queryGeneratorUsers->setCustomColumn(['temp_limit' => $queryGeneratorUsers->getColumnName('records_limit')]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return QueryGenerator
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->addCondition('status', 'Active', 'e')
- 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
}
- Exclude checks
Spaces must 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(["{$tableName}.{$index}" => $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
if ($queryAll) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isExists = (new Db\Query())->from(self::ROUND_ROBIN_TABLE)->where($params)->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['datetime'] = (new \DateTime())->format('Y-m-d H:i:s.u');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
$dbCommand->update(self::ROUND_ROBIN_TABLE, ['datetime' => (new \DateTime())->format('Y-m-d H:i:s.u')], $params)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks