process accesses the super-global variable $_FILES. Open
public function process(App\Request $request)
{
$response = new Vtiger_Response();
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
if (!empty($_FILES['imported_list'])) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
process accesses the super-global variable $_FILES. Open
public function process(App\Request $request)
{
$response = new Vtiger_Response();
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
if (!empty($_FILES['imported_list'])) {
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function saveToDb
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function saveToDb(string $source, int $type, string $content): array
{
$firstLine = true;
$explodedElements = explode($this->delimiter, $content);
$db = \App\Db::getInstance('admin');
- 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 saveToDb
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveToDb(string $source, int $type, string $content): array
{
$firstLine = true;
$explodedElements = explode($this->delimiter, $content);
$db = \App\Db::getInstance('admin');
Function process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$response = new Vtiger_Response();
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
if (!empty($_FILES['imported_list'])) {
- 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
Missing class import via use statement (line '28', 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 '74', column '22'). Open
$isExists = (new \App\Db\Query())->from('s_#__mail_rbl_list')->where(['ip' => $clearIp])->exists($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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_WRONG_FILE', $request->getModule(false))];
}
- 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\TextUtils' in method 'saveToDb'. Open
$source = \App\TextUtils::textTruncate($source, 10);
- 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 'process'. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_SAVED', $request->getModule(false)) . ': ' . $importResult['saved'] . '<br/>';
- 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 'process'. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_ERRORS', $request->getModule(false)) . ': ' . $importResult['errors'] . '<br/>';
- 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 'process'. Open
$message = \App\Language::translate('LBL_UPLOAD_SUCCESS', $request->getModule(false)) . '<br/>';
- 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 'process'. Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_WRONG_FILE', $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
Avoid using static access to class '\App\Db' in method 'saveToDb'. 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
The method saveToDb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
++$report['duplicates'];
}
- 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 'process'. Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $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
Avoid using static access to class '\App\Cache' in method 'saveToDb'. Open
\App\Cache::delete('MailRblList', $clearIp);
- 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 saveToDb uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($firstLine) {
$report = [];
break;
}
- 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\Validator' in method 'saveToDb'. Open
if (\App\Validator::ip($clearIp)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\File' in method 'process'. Open
$fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_list']);
- 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 'saveToDb'. Open
\App\Cache::delete('MailRblIpColor', $clearIp);
- 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\Config' in method 'process'. Open
if ($fileInstance->validateAndSecure('text') && $fileInstance->getSize() < \App\Config::getMaxUploadSize()) {
- 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 'process'. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_DUPLICATES', $request->getModule(false)) . ': ' . $importResult['duplicates'] . '<br/>';
- 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 '33', column '16'). Open
public function process(App\Request $request)
{
$response = new Vtiger_Response();
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
if (!empty($_FILES['imported_list'])) {
- 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
Define a constant instead of duplicating this literal "message" 3 times. Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Merge this if statement with the enclosing one. Open
if (!empty($fileContent = $fileInstance->getContents())) {
- 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 "saved" 3 times. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_SAVED', $request->getModule(false)) . ': ' . $importResult['saved'] . '<br/>';
- 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 "<br>" 4 times. Open
$message = \App\Language::translate('LBL_UPLOAD_SUCCESS', $request->getModule(false)) . '<br/>';
- 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" 3 times. Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "errors" 4 times. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_ERRORS', $request->getModule(false)) . ': ' . $importResult['errors'] . '<br/>';
- 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 "duplicates" 3 times. Open
$message .= \App\Language::translate('LBL_LIST_RECORD_DUPLICATES', $request->getModule(false)) . ': ' . $importResult['duplicates'] . '<br/>';
- 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 method ip
from undeclared class \App\Validator
(Did you mean class \Tests\App\Validator) Open
if (\App\Validator::ip($clearIp)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('s_#__mail_rbl_list', [
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExists = (new \App\Db\Query())->from('s_#__mail_rbl_list')->where(['ip' => $clearIp])->exists($db);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_MailRbl_UploadList_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_UploadList_Action is not named in CamelCase. Open
class Settings_MailRbl_UploadList_Action extends Settings_Vtiger_Basic_Action
{
/**
* File delimiter string.
*
- 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 for alignment; tabs are not allowed Open
$firstLine = true;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$report = [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$clearIp = trim($elementToSave);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response->setResult($result);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'ip' => $clearIp,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
++$report['errors'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$message = \App\Language::translate('LBL_UPLOAD_SUCCESS', $request->getModule(false)) . '<br/>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$message .= \App\Language::translate('LBL_LIST_RECORD_ERRORS', $request->getModule(false)) . ': ' . $importResult['errors'] . '<br/>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param int $type
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function saveToDb(string $source, int $type, string $content): array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$db = \App\Db::getInstance('admin');
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'saved' => 0,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'source' => $source,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
return $report;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!empty($importResult)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$message .= \App\Language::translate('LBL_LIST_RECORD_DUPLICATES', $request->getModule(false)) . ': ' . $importResult['duplicates'] . '<br/>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'errors' => 0,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$isExists = (new \App\Db\Query())->from('s_#__mail_rbl_list')->where(['ip' => $clearIp])->exists($db);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'status' => 0,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$importResult = $this->saveToDb($request->getByType('source', 'Alnum'), $request->getByType('type', 'Integer'), $fileContent);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$source = \App\TextUtils::textTruncate($source, 10);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!empty($_FILES['imported_list'])) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $content
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$explodedElements = explode($this->delimiter, $content);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'request' => 0,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* File delimiter string.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_list']);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (\App\Validator::ip($clearIp)) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$db->createCommand()->insert('s_#__mail_rbl_list', [
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$report = [];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public function process(App\Request $request)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response->emit();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
++$report['errors'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
++$report['saved'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'duplicates' => 0,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\App\Cache::delete('MailRblList', $clearIp);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
public $delimiter = "\n";
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
{
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($fileInstance->validateAndSecure('text') && $fileInstance->getSize() < \App\Config::getMaxUploadSize()) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$result = ['success' => true, 'message' => $message];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_WRONG_FILE', $request->getModule(false))];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!$isExists) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$message .= \App\Language::translate('LBL_LIST_RECORD_SAVED', $request->getModule(false)) . ': ' . $importResult['saved'] . '<br/>';
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
'type' => $type,
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
++$report['duplicates'];
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
\App\Cache::delete('MailRblIpColor', $clearIp);
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* Save to DB imported record.
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @param string $source
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if ($firstLine) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
* @license YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
if (!empty($fileContent = $fileInstance->getContents())) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
foreach ($explodedElements as $elementToSave) {
- Exclude checks
Spaces must be used for alignment; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$message .= \App\Language::translate('LBL_LIST_RECORD_ERRORS', $request->getModule(false)) . ': ' . $importResult['errors'] . '<br/>';
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$importResult = $this->saveToDb($request->getByType('source', 'Alnum'), $request->getByType('type', 'Integer'), $fileContent);
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
$message .= \App\Language::translate('LBL_LIST_RECORD_SAVED', $request->getModule(false)) . ': ' . $importResult['saved'] . '<br/>';
- Exclude checks
Line exceeds 120 characters; contains 166 characters Open
$message .= \App\Language::translate('LBL_LIST_RECORD_DUPLICATES', $request->getModule(false)) . ': ' . $importResult['duplicates'] . '<br/>';
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
$result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_WRONG_FILE', $request->getModule(false))];
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
if ($fileInstance->validateAndSecure('text') && $fileInstance->getSize() < \App\Config::getMaxUploadSize()) {
- Exclude checks
Class name "Settings_MailRbl_UploadList_Action" is not in camel caps format Open
class Settings_MailRbl_UploadList_Action extends Settings_Vtiger_Basic_Action
- Exclude checks