Function getModules
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function getModules(): array
{
$cacheName = 'InterestsConflict::getModules';
if (\App\Cache::has($cacheName, '')) {
return \App\Cache::get($cacheName, '');
- 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 InterestsConflict has an overall complexity of 54 which is very high. The configured complexity threshold is 50. Open
class InterestsConflict
{
/** @var int */
public const CONF_STATUS_CONFLICT_NO = 0;
/** @var int */
- Exclude checks
Method getModules
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getModules(): array
{
$cacheName = 'InterestsConflict::getModules';
if (\App\Cache::has($cacheName, '')) {
return \App\Cache::get($cacheName, '');
File InterestsConflict.php
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Conflict of interest component file.
*
Function getParent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getParent(int $record, string $moduleName): ?array
{
if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
return ['id' => $record, 'moduleName' => $moduleName];
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method updateUnlockStatus
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateUnlockStatus(int $id, int $status): void
{
\App\Db::getInstance()
->createCommand()
->update('u_#__interests_conflict_unlock', [
Method getParent
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getParent(int $record, string $moduleName): ?array
{
if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
return ['id' => $record, 'moduleName' => $moduleName];
}
Function check
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function check(int $record, string $moduleName): int
{
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
return self::CHECK_STATUS_INACTIVE;
}
- 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
Avoid too many return
statements within this method. Open
return self::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;
Function getLast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getLast(int $record, ?int $userId = null): ?array
{
if (null === $userId) {
$userId = \App\User::getCurrentUserRealId();
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method getModules() has an NPath complexity of 2016. The configured NPath complexity threshold is 200. Open
public static function getModules(): array
{
$cacheName = 'InterestsConflict::getModules';
if (\App\Cache::has($cacheName, '')) {
return \App\Cache::get($cacheName, '');
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getModules() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10. Open
public static function getModules(): array
{
$cacheName = 'InterestsConflict::getModules';
if (\App\Cache::has($cacheName, '')) {
return \App\Cache::get($cacheName, '');
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Avoid using undefined variables such as '$modules' which will lead to PHP notices. Open
foreach (\Config\Components\InterestsConflict::$modules[$moduleName] ?? [] as $item) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$modules' which will lead to PHP notices. Open
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class InterestsConflict has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class InterestsConflict
{
/** @var int */
public const CONF_STATUS_CONFLICT_NO = 0;
/** @var int */
- 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 '154', column '15'). Open
$row = (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
Missing class import via use statement (line '280', column '15'). Open
$row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->where(['id' => $id])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '238', column '15'). Open
$all = (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\User' in method 'unlock'. Open
'user_id' => \App\User::getCurrentUserRealId(),
- 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 assigning values to variables in if clauses and the like (line '64', column '8'). Open
public static function check(int $record, string $moduleName): int
{
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
return self::CHECK_STATUS_INACTIVE;
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\User' in method 'setCancel'. Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- 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 'updateUnlockStatus'. Open
'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),
- 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 'confirmation'. Open
->where(['user_id' => \App\User::getCurrentUserRealId(), 'related_id' => $baseRecord])
- 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\Record' in method 'confirmation'. Open
'related_label' => \App\Record::getLabel($baseRecord),
- 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\Mailer' in method 'updateUnlockStatus'. Open
\App\Mailer::sendFromTemplate([
'template' => 'InterestsConflictAccessResponse',
'moduleName' => 'Users',
'recordId' => $row['user_id'],
'to' => $userModel->getDetail('email1'),
- 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 'getByRecord'. Open
return \App\Cache::save($cacheName, $record, $row);
- 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\Record' in method 'unlock'. Open
'record' => \App\Record::getHtmlLink($baseRecord),
- 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 assigning values to variables in if clauses and the like (line '134', column '9'). Open
public static function getParent(int $record, string $moduleName): ?array
{
if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
return ['id' => $record, 'moduleName' => $moduleName];
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\ModuleHierarchy' in method 'getParent'. Open
if (0 === \App\ModuleHierarchy::getModuleLevel($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\Record' in method 'getParent'. Open
if (($relatedModuleName = \App\Record::getType($relatedId)) && $relatedModuleName === $item['base']) {
- 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 'updateUnlockStatus'. Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- 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 assigning values to variables in if clauses and the like (line '71', column '9'). Open
public static function check(int $record, string $moduleName): int
{
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
return self::CHECK_STATUS_INACTIVE;
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\User' in method 'setCancel'. Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- 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 'getModules'. Open
return \App\Cache::get($cacheName, '');
- 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 'getModules'. Open
'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- 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 'getModules'. Open
'value' => \App\Json::encode([
'base' => $parent['base'],
'intermediate' => $targetModuleName,
'intermediateFieldName' => $parent['field']['fieldname'],
'related' => $sourceModuleName,
- 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 'getModules'. Open
'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- 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 'confirmation'. Open
\App\Cache::delete('InterestsConflict::getByRecord', $baseRecord);
- 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 'getModules'. Open
'value' => \App\Json::encode([
'related' => $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\ModuleHierarchy' in method 'check'. Open
if (0 !== \App\ModuleHierarchy::getModuleLevel($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\Record' in method 'getParent'. Open
$relatedModuleName = \App\Record::getType($recordModel->get($item['relatedFieldName']));
- 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 'updateUnlockStatus'. Open
$userModel = \App\User::getUserModel($row['user_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 'getLast'. Open
$userId = \App\User::getCurrentUserRealId();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'check'. Open
\App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getByRecord'. Open
if (\App\Cache::has($cacheName, $record)) {
- 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 'confirmation'. Open
'user_id' => \App\User::getCurrentUserRealId(),
- 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 'updateUnlockStatus'. Open
\App\Cache::delete('InterestsConflict::getByRecord', $row['related_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\Language' in method 'getModules'. Open
'map' => \App\Language::translateSingularModuleName($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
The method check uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);
return self::CHECK_STATUS_INACTIVE;
}
- 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 '\Vtiger_Record_Model' in method 'getParent'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($record, $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\Cache' in method 'getModules'. Open
if (\App\Cache::has($cacheName, '')) {
- 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 'getModules'. Open
'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- 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\Field' in method 'getModules'. Open
$relatedFields = \App\Field::getRelatedFieldForModule();
- 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 'getModules'. Open
'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- 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_Record_Model' in method 'getParent'. Open
$intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);
- 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 'getModules'. Open
'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- 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 'getModules'. Open
if (\App\Module::isModuleActive($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\Cache' in method 'getByRecord'. Open
return \App\Cache::get($cacheName, $record);
- 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 'setCancel'. Open
\App\Cache::delete('InterestsConflict::getByRecord', $record);
- 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 'updateUnlockStatus'. Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- 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\ModuleHierarchy' in method 'getModules'. Open
foreach (array_keys(\App\ModuleHierarchy::getModulesByLevel(0)) as $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\Cache' in method 'getModules'. Open
return \App\Cache::save($cacheName, '', array_merge($start, $return));
- 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\Mailer' in method 'unlock'. Open
\App\Mailer::sendFromTemplate([
'template' => 'InterestsConflictAccessRequest',
'to' => \Config\Components\InterestsConflict::$notificationsEmails,
'dateTime' => date('Y-m-d H:i:s'),
'user' => \App\User::getCurrentUserModel()->getName(),
- 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\Record' in method 'updateUnlockStatus'. Open
'record' => \App\Record::getHtmlLink($row['related_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 '\vtlib\Functions' in method 'getModules'. Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Json' in method 'getModules'. Open
'value' => \App\Json::encode([
'base' => $targetModuleName,
'related' => $sourceModuleName,
'relatedFieldName' => $field['fieldname'],
]),
- 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
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- Exclude checks
Avoid excessively long variable names like $intermediateRecordModel. Keep variable name length under 20. Open
$intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function updateUnlockStatus(int $id, int $status): void
- 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
$id = $row['id'];
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $v. Configured minimum length is 3. Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- 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
self::UNLOCK_STATUS_REJECTED => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_REJECTED',
- Exclude checks
Spaces must 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::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const CONF_STATUS_CONFLICT_YES = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const CHECK_STATUS_CONFIRMATION = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 199 characters Open
if (0 !== \Config\Components\InterestsConflict::$confirmationTimeInterval && strtotime($row['date_time']) < strtotime('-' . \Config\Components\InterestsConflict::$confirmationTimeInterval)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::UNLOCK_STATUS_NEW => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_NEW',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (self::getByRecord($record) as $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
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const CONF_STATUS_CANCELED = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 !== \Config\Components\InterestsConflict::$confirmationTimeInterval && strtotime($row['date_time']) < strtotime('-' . \Config\Components\InterestsConflict::$confirmationTimeInterval)) {
- Exclude checks
Spaces must 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 check(int $record, string $moduleName): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($parent = self::getParent($record, $moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::CHECK_STATUS_CONFIRMATION;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
return self::CONF_STATUS_CONFLICT_YES === $row['status'] ? self::CHECK_STATUS_CONFLICT : self::CHECK_STATUS_NO_CONFLICT;
- Exclude checks
Spaces must 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 (null === $userId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const CHECK_STATUS_NO_CONFLICT = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::UNLOCK_STATUS_CANCELED => 'LBL_INTERESTS_CONFLICT_CONFIRM_CANCELED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::warning("No parent record could be found |$record|$moduleName", __METHOD__);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::CHECK_STATUS_INACTIVE;
- Exclude checks
Spaces must 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 $row;
- Exclude checks
Spaces must 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 string $moduleName
- Exclude checks
Spaces must 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|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = \App\User::getCurrentUserRealId();
- 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
self::UNLOCK_STATUS_ACCEPTED => 'LBL_INTERESTS_CONFLICT_UNLOCK_STATUS_ACCEPTED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const UNLOCK_STATUS_REJECTED = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const CHECK_STATUS_INACTIVE = 0;
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!($row = self::getLast($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 const CONF_STATUS_CONFLICT_NO = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- 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
public const UNLOCK_STATUS_NEW = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const UNLOCK_STATUS_ACCEPTED = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check the conflict status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty(\Config\Components\InterestsConflict::$isActive) || empty(\Config\Components\InterestsConflict::$modules[$moduleName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getLast(int $record, ?int $userId = null): ?array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($value['user_id'] == $userId && self::CONF_STATUS_CANCELED != $value['status']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const UNLOCK_STATUS_LABELS = [
- 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
if (0 !== \App\ModuleHierarchy::getModuleLevel($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the last conflict of interests information.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::CHECK_STATUS_INACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record = $parent['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
public const UNLOCK_STATUS_CANCELED = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::CHECK_STATUS_CONFIRMATION;
- Exclude checks
Spaces must 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
$row = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var 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
*
- 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
], ['id' => $row['id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'comment' => nl2br($comment),
- Exclude checks
Spaces must 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 CHECK_STATUS_CONFLICT = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get parent record id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must 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
* Cancel user confirmation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date_time' => $row['date_time'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related_id' => $row['related_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'source_id' => $row['source_id'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'comment' => $comment,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user' => \App\User::getCurrentUserModel()->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
$execute = $logCreateCommand->insert('b_#__interests_conflict_conf', $row)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has($cacheName, $record)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::save($cacheName, $record, $row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = self::getLast($record, $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => self::CONF_STATUS_CANCELED,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userCreateCommand->insert('u_#__interests_conflict_unlock', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Mailer::sendFromTemplate([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $baseRecord
- Exclude checks
Spaces must 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 (empty($item['intermediateFieldName'])) {
- Exclude checks
Spaces must 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(['related_id' => $record])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $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
'date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related_id' => $baseRecord,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 === \App\ModuleHierarchy::getModuleLevel($moduleName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->isEmpty($item['relatedFieldName'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedModuleName = \App\Record::getType($recordModel->get($item['relatedFieldName']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->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
->insert('u_#__interests_conflict_unlock', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($execute) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => $value,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($record, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 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
'modify_user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related_id' => $baseRecord,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($row['id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related_label' => \App\Record::getLabel($baseRecord),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $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
return ['id' => $recordModel->get($item['relatedFieldName']), 'moduleName' => $relatedModuleName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['id' => $relatedId, 'moduleName' => $relatedModuleName];
- Exclude checks
Spaces must 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 $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = 'InterestsConflict::getByRecord';
- Exclude checks
Spaces must 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 $sourceRecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\Config\Components\InterestsConflict::$sendMailAccessRequest) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userCreateCommand->delete('u_#__interests_conflict_conf', ['id' => $id])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get confirmation by record.
- 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
* @param int $baseRecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\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
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('u_#__interests_conflict_conf')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$intermediateRecordModel = \Vtiger_Record_Model::getCleanInstance($relatedModuleName);
- Exclude checks
Spaces must 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 $comment
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $comment
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'dateTime' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must 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
foreach (\Config\Components\InterestsConflict::$modules[$moduleName] ?? [] as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getByRecord(int $record): array
- 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
$userCreateCommand->update('u_#__interests_conflict_conf', [
- Exclude checks
Spaces must 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(['user_id' => \App\User::getCurrentUserRealId(), 'related_id' => $baseRecord])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relatedModuleName === $item['base']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedId = $intermediateRecordModel->getValueByField($item['intermediateFieldName']);
- Exclude checks
Spaces must 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::get($cacheName, $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
$userCreateCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Unlock access request.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $sourceRecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$logCreateCommand = \App\Db::getInstance('log')->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userCreateCommand->insert('u_#__interests_conflict_conf', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'comment' => $comment,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userCreateCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getParent(int $record, string $moduleName): ?array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$intermediateRecordModel->setId($recordModel->get($item['relatedFieldName']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($relatedModuleName = \App\Record::getType($relatedId)) && $relatedModuleName === $item['base']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setCancel(int $userId, int $record, string $comment): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modify_date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => \Config\Components\InterestsConflict::$notificationsEmails,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($relatedModuleName !== $item['intermediate']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('InterestsConflict::getByRecord', $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
* User confirmation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'source_id' => $sourceRecord,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array|null
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['id' => $record, 'moduleName' => $moduleName];
- Exclude checks
Spaces must 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
'modify_date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => self::UNLOCK_STATUS_NEW,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'source_id' => $sourceRecord,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function confirmation(int $baseRecord, int $sourceRecord, int $value): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $row['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
->from('u_#__interests_conflict_conf')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => self::UNLOCK_STATUS_CANCELED,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'user_id' => $row['user_id'],
- 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 static function unlock(int $baseRecord, int $sourceRecord, string $comment): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'template' => 'InterestsConflictAccessRequest',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'record' => \App\Record::getHtmlLink($baseRecord),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$all = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($all as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getUserModel($row['user_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::get($cacheName, '');
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'key' => $key,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'map' => \App\Language::translateSingularModuleName($moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedFields = \App\Field::getRelatedFieldForModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start[$keys[$row['key']]] = $return[$keys[$row['key']]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($return[$keys[$row['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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['user_id' => $row['user_id'], 'related_id' => $row['related_id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseModules[$moduleName] = $moduleName;
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
if (isset($baseModules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'key' => $key,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'intermediate' => $targetModuleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related' => $sourceModuleName,
- Exclude checks
Spaces must 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
\App\Db::getInstance()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('u_#__interests_conflict_unlock', [
- Exclude checks
Spaces must 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 (isset($baseModules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules[$sourceModuleName][] = $return["{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$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
'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'field' => $field,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($modules[$targetModuleName] as $parent) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => \App\Json::encode([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ksort($return);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $status
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\Config\Components\InterestsConflict::$sendMailAccessResponse) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'template' => 'InterestsConflictAccessResponse',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'record' => \App\Record::getHtmlLink($row['related_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
$keys[$key] = "{$allModules[$sourceModuleName]}|{$allModules[$parent['base']]}|$key";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modify_date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must 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 (array_keys(\App\ModuleHierarchy::getModulesByLevel(0)) as $moduleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'key' => $key,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'target' => $sourceModuleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'intermediateFieldName' => $parent['field']['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => \App\Language::translate(self::UNLOCK_STATUS_LABELS[$status], '_Base', $userModel->getDetail('language')),
- Exclude checks
Spaces must 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 modules list.
- 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 getModules(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => $targetModuleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related' => $sourceModuleName,
- Exclude checks
Spaces must 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 ($forModules as $targetModuleName => $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return["{$allModules[$sourceModuleName]}|{$allModules[$parent['base']]}|$key"] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]),
- Exclude checks
Line exceeds 120 characters; contains 206 characters Open
'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update unlock status.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('u_#__interests_conflict_conf', [
- Exclude checks
Line exceeds 120 characters; contains 249 characters Open
'map' => \App\Language::translateSingularModuleName($targetModuleName) . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($modules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\Config\Components\InterestsConflict::$modules ?? [] as $rows) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->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
$excludedModules = ['ModComments'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseModules = $return = $modules = $baseModules = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = "$moduleName";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => $parent['base'],
- Exclude checks
Spaces must 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 ($rows as $row) {
- Exclude checks
Spaces must 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
'target' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = "$sourceModuleName({$field['fieldname']})|{$targetModuleName}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relatedFieldName' => $field['fieldname'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'map' => $parent['map'] . ' << ' . \App\Language::translateSingularModuleName($sourceModuleName) . ' (' . \App\Language::translate($field['fieldlabel'], $sourceModuleName) . ')',
- Exclude checks
Spaces must 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 \App\Cache::save($cacheName, '', array_merge($start, $return));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('InterestsConflict::getByRecord', $baseRecord);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => $status,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => self::CONF_STATUS_CANCELED,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has($cacheName, '')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keys = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relatedFields as $sourceModuleName => $forModules) {
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$modules[$sourceModuleName][] = $return["{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$key"] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'base' => $targetModuleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keys[$key] = "{$allModules[$sourceModuleName]}|$allModules[$targetModuleName]|$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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function updateUnlockStatus(int $id, int $status): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'recordId' => $row['user_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
'relatedFieldName' => $field['fieldname'],
- Exclude checks
Spaces must 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
'modify_date_time' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->select(['related_id', 'user_id'])->from('u_#__interests_conflict_unlock')->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
'base' => $parent['base'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($keys[$row['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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => $userModel->getDetail('email1'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => \App\Json::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
$start = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('InterestsConflict::getByRecord', $row['related_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Mailer::sendFromTemplate([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'moduleName' => 'Users',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Module::isModuleActive($moduleName)) {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
if (isset($modules[$targetModuleName]) && $sourceModuleName !== $targetModuleName && !\in_array($sourceModuleName, $excludedModules)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'target' => $sourceModuleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'modify_user_id' => \App\User::getCurrentUserRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['id' => $id])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::UNLOCK_STATUS_ACCEPTED === $status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = 'InterestsConflict::getModules';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return["0000|$key"] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'related' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($forModules as $targetModuleName => $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'value' => \App\Json::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
foreach ($relatedFields as $sourceModuleName => $forModules) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = "{$sourceModuleName}({$field['fieldname']})|{$parent['key']}";
- Exclude checks
Space before opening parenthesis of function call prohibited Open
$allModules = array_map(fn ($v) => 0 > $v ? 999 : sprintf('%03d', $v), array_column(\vtlib\Functions::getAllModules(false, true), 'tabsequence', 'name'));
- Exclude checks