Method update
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(App\Request $request): void
{
$db = \App\Db::getInstance('admin');
$requestMode = \in_array($request->getByType('type'), ['forVerification', 'toSend', 'request']);
$response = new Vtiger_Response();
Function checkExistingRbl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function checkExistingRbl(App\Request $request): string
{
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
$rblRecord->parse();
$sender = $rblRecord->getSender();
- 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 update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function update(App\Request $request): void
{
$db = \App\Db::getInstance('admin');
$requestMode = \in_array($request->getByType('type'), ['forVerification', 'toSend', 'request']);
$response = new Vtiger_Response();
- 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
Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed. Open
private function checkExistingRbl(App\Request $request): string
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '140', column '21'). Open
$configFile = new \App\ConfigFile('component', 'Mail');
- 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 '144', column '19'). Open
$response = new Vtiger_Response();
- 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 '47', column '19'). Open
$response = new Vtiger_Response();
- 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 '64', column '17'). Open
$ips = (new \App\Db\Query())->select(['ip'])->from('s_#__mail_rbl_list')->where(['id' => $request->getInteger('record')])->column($db);
- 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 update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$db->createCommand()
->update($requestMode ? 's_#__mail_rbl_request' : 's_#__mail_rbl_list', [
'status' => $request->getInteger('status')
], ['id' => $request->getInteger('record')])->execute();
- 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\Mail\Rbl' in method 'checkExistingRbl'. Open
if ($ipsList = \App\Mail\Rbl::findIp($sender['ip'])) {
- 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 '115', column '8'). Open
private function checkExistingRbl(App\Request $request): string
{
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
$rblRecord->parse();
$sender = $rblRecord->getSender();
- 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\Language' in method 'update'. Open
'title' => App\Language::translate('LBL_CHANGES_SAVED'),
- 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 'update'. Open
\App\Cache::delete('MailRblList', $ip);
- 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 updateList uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\Db::getInstance('admin')
->createCommand()
->delete('s_#__mail_rbl_list', ['request' => $request->getInteger('record')])
->execute();
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Language' in method 'checkExistingRbl'. Open
return App\Language::translateArgs('LBL_IP_EXISTING_IN_RBL', $request->getModule(false), $href, App\Language::translate($type, $request->getModule(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
The method update uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ips = (new \App\Db\Query())->select(['ip'])->from('s_#__mail_rbl_list')->where(['id' => $request->getInteger('record')])->column($db);
foreach ($ips as $ip) {
\App\Cache::delete('MailRblIpColor', $ip);
\App\Cache::delete('MailRblList', $ip);
- 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 assigning values to variables in if clauses and the like (line '48', column '101'). Open
public function update(App\Request $request): void
{
$db = \App\Db::getInstance('admin');
$requestMode = \in_array($request->getByType('type'), ['forVerification', 'toSend', 'request']);
$response = new Vtiger_Response();
- 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\Cache' in method 'update'. Open
\App\Cache::delete('MailRblIpColor', $ip);
- 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\Mail\Rbl' in method 'checkExistingRbl'. Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('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\Language' in method 'config'. Open
'title' => App\Language::translate('LBL_CHANGES_SAVED'),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'update'. Open
$db = \App\Db::getInstance('admin');
- 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\Mail\Rbl' in method 'updateList'. Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('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\Language' in method 'checkExistingRbl'. Open
return App\Language::translateArgs('LBL_IP_EXISTING_IN_RBL', $request->getModule(false), $href, App\Language::translate($type, $request->getModule(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
Define a constant instead of duplicating this literal "title" 3 times. Open
'title' => $error,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "s_#__mail_rbl_list" 3 times. Open
->update($requestMode ? 's_#__mail_rbl_request' : 's_#__mail_rbl_list', [
- 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 "status" 4 times. Open
if ('forVerification' === $request->getByType('type') && 1 === $request->getInteger('status') && ($error = $this->checkExistingRbl($request))) {
- 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.
Merge this if statement with the enclosing one. Open
if ($ipsList = \App\Mail\Rbl::findIp($sender['ip'])) {
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if (condition1) { if (condition2) { ... } }
Compliant Solution
if (condition1 && condition2) { ... }
Define a constant instead of duplicating this literal "notify" 3 times. Open
'notify' => [
- 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 "success" 5 times. Open
'success' => true,
- 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.
Rename "$rblRecord" which has the same name as the field declared at line 34. Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Rename "$rblRecord" which has the same name as the field declared at line 34. Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
- Read upRead up
- Exclude checks
Shadowing fields with a local variable is a bad practice that reduces code readability: it makes it confusing to know whether the field or the variable is being used.
Noncompliant Code Example
class Foo { public $myField; public function doSomething() { $myField = 0; ... } }
See
- CERT, DCL51-J. - Do not shadow or obscure identifiers in subscopes
Define a constant instead of duplicating this literal "record" 6 times. Open
], ['id' => $request->getInteger('record')])->execute();
- 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.
Call to undeclared method \App\Db\Query::select
Open
$ips = (new \App\Db\Query())->select(['ip'])->from('s_#__mail_rbl_list')->where(['id' => $request->getInteger('record')])->column($db);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()
- Exclude checks
Argument 1 (request)
is int
but \Settings_MailRbl_SaveAjax_Action::updateList()
takes \App\Request
defined at /code/modules/Settings/MailRbl/actions/SaveAjax.php:88
Open
$rblRecord->updateList($request->getInteger('record'));
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance('admin')
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_MailRbl_SaveAjax_Action extends Settings_Vtiger_Basic_Action
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance('admin');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Settings_MailRbl_SaveAjax_Action is not named in CamelCase. Open
class Settings_MailRbl_SaveAjax_Action extends Settings_Vtiger_Basic_Action
{
use \App\Controller\ExposeMethod;
use \App\Controller\Traits\SettingsPermission;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function update(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'error',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($ips as $ip) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$href = "<a href=\"http://yeti/index.php?parent=Settings&module=MailRbl&view=Index&tab={$tab}&ip={$sender['ip']}\" target=\"_blank\">{$sender['ip']}</a>";
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
$href = "<a href=\"http://yeti/index.php?parent=Settings&module=MailRbl&view=Index&tab={$tab}&ip={$sender['ip']}\" target=\"_blank\">{$sender['ip']}</a>";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return App\Language::translateArgs('LBL_IP_EXISTING_IN_RBL', $request->getModule(false), $href, App\Language::translate($type, $request->getModule(false)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check existing IP in RBL list.
- Exclude checks
Spaces must 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($sender['ip'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$configFile->set($name, $request->getBoolean('value'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must 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
$rblRecord->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sender = $rblRecord->getSender();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tab = $ipList['type'] ? 'whiteList' : 'blackList';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => App\Language::translate('LBL_CHANGES_SAVED'),
- Exclude checks
Spaces must 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
* Status update.
- Exclude checks
Line exceeds 120 characters; contains 180 characters Open
return App\Language::translateArgs('LBL_IP_EXISTING_IN_RBL', $request->getModule(false), $href, App\Language::translate($type, $request->getModule(false)));
- 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
\App\Cache::delete('MailRblList', $ip);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'success' => 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
\App\Db::getInstance('admin')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$configFile->create();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must 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
private function updateList(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblRecord->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($ipsList = \App\Mail\Rbl::findIp($sender['ip'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($ipsList as $ipList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($type !== (int) $ipList['type']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$configFile = new \App\ConfigFile('component', 'Mail');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $rblRecord;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update($requestMode ? 's_#__mail_rbl_request' : 's_#__mail_rbl_list', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'status' => $request->getInteger('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
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var \App\Mail\Rbl
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update.
- 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
$name = 'accept_mode' === $request->getByType('name') ? 'rcListAcceptAutomatically' : 'rcListSendReportAutomatically';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'type' => 'success',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ips = (new \App\Db\Query())->select(['ip'])->from('s_#__mail_rbl_list')->where(['id' => $request->getInteger('record')])->column($db);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => App\Language::translate('LBL_CHANGES_SAVED'),
- Exclude checks
Spaces must 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
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'notify' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('forVerification' === $request->getByType('type') && 1 === $request->getInteger('status') && ($error = $this->checkExistingRbl($request))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must 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 App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $request->getInteger('status')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = $ipList['type'] ? 'LBL_WHITE_LIST' : 'LBL_BLACK_LIST';
- Exclude checks
Spaces must 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 App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must 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 ($requestMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'notify' => [
- Exclude checks
Spaces must 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
* Config update.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function config(App\Request $request): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use \App\Controller\Traits\SettingsPermission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance('admin');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'notify' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => $error,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('MailRblIpColor', $ip);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblRecord->updateList($request->getInteger('record'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function checkExistingRbl(App\Request $request): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('update');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Rbl record instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'success' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['id' => $request->getInteger('record')])->execute();
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$ips = (new \App\Db\Query())->select(['ip'])->from('s_#__mail_rbl_list')->where(['id' => $request->getInteger('record')])->column($db);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->delete('s_#__mail_rbl_list', ['request' => $request->getInteger('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
* @param App\Request $request
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
use \App\Controller\ExposeMethod;
- Exclude checks
Spaces must 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
$requestMode = \in_array($request->getByType('type'), ['forVerification', 'toSend', 'request']);
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
if ('forVerification' === $request->getByType('type') && 1 === $request->getInteger('status') && ($error = $this->checkExistingRbl($request))) {
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblRecord = \App\Mail\Rbl::getRequestById($request->getInteger('record'));
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->exposeMethod('config');
- 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
'type' => 'success',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$name = 'accept_mode' === $request->getByType('name') ? 'rcListAcceptAutomatically' : 'rcListSendReportAutomatically';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'success' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateList($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = (int) $rblRecord->get('type');
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Class name "Settings_MailRbl_SaveAjax_Action" is not in camel caps format Open
class Settings_MailRbl_SaveAjax_Action extends Settings_Vtiger_Basic_Action
- Exclude checks