YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/MailRbl/actions/UploadList.php

Summary

Maintainability
B
4 hrs
Test Coverage
F
0%

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'])) {

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'])) {

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');
Severity: Minor
Found in modules/Settings/MailRbl/actions/UploadList.php - About 1 hr to fix

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');
Severity: Minor
Found in modules/Settings/MailRbl/actions/UploadList.php - About 1 hr to fix

    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'])) {
    Severity: Minor
    Found in modules/Settings/MailRbl/actions/UploadList.php - About 1 hr to fix

    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();

    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);

    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))];
                        }

    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);

    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/>';

    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/>';

    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/>';

    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))];

    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');

    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'];
                        }

    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))];

    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);

    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;
                    }

    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)) {

    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']);

    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);

    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()) {

    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/>';

    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'])) {

    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))];

    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())) {

    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/>';

    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/>';

    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))];

    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/>';

    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/>';

    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)) {

    Call to undeclared method \App\Db::createCommand
    Open

                            $db->createCommand()->insert('s_#__mail_rbl_list', [

    Call to undeclared method \App\Db\Query::from
    Open

                    $isExists = (new \App\Db\Query())->from('s_#__mail_rbl_list')->where(['ip' => $clearIp])->exists($db);

    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

    Avoid variables with short names like $db. Configured minimum length is 3.
    Open

            $db = \App\Db::getInstance('admin');

    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.
         *

    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;

    Spaces must be used for alignment; tabs are not allowed
    Open

            $report = [

    Spaces must be used for alignment; tabs are not allowed
    Open

                $clearIp = trim($elementToSave);

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

            $response->setResult($result);

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

                    try {

    Spaces must be used for alignment; tabs are not allowed
    Open

                                'ip' => $clearIp,

    Spaces must be used for alignment; tabs are not allowed
    Open

                        } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        ++$report['errors'];

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

        /** {@inheritdoc} */

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $message = \App\Language::translate('LBL_UPLOAD_SUCCESS', $request->getModule(false)) . '<br/>';

    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/>';

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param int    $type

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function saveToDb(string $source, int $type, string $content): array

    Spaces must be used for alignment; tabs are not allowed
    Open

            $db = \App\Db::getInstance('admin');

    Spaces must be used for alignment; tabs are not allowed
    Open

                'saved' => 0,

    Spaces must be used for alignment; tabs are not allowed
    Open

                                'source' => $source,

    Spaces must be used for alignment; tabs are not allowed
    Open

            return $report;

    Spaces must be used for alignment; tabs are not allowed
    Open

        /**

    Spaces must be used for alignment; tabs are not allowed
    Open

                        if (!empty($importResult)) {

    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/>';

    Spaces must be used for alignment; tabs are not allowed
    Open

         *

    Spaces must be used for alignment; tabs are not allowed
    Open

                'errors' => 0,

    Spaces must be used for alignment; tabs are not allowed
    Open

            ];

    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);

    Spaces must be used for alignment; tabs are not allowed
    Open

                                'status' => 0,

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $importResult = $this->saveToDb($request->getByType('source', 'Alnum'), $request->getByType('type', 'Integer'), $fileContent);

    Spaces must be used for alignment; tabs are not allowed
    Open

                        } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

                }

    Spaces must be used for alignment; tabs are not allowed
    Open

            $source = \App\TextUtils::textTruncate($source, 10);

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (!empty($_FILES['imported_list'])) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param string $content

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

        }

    Spaces must be used for alignment; tabs are not allowed
    Open

            $explodedElements = explode($this->delimiter, $content);

    Spaces must be used for alignment; tabs are not allowed
    Open

                                'request' => 0,

    Spaces must be used for alignment; tabs are not allowed
    Open

                    } catch (\Throwable $e) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                        break;

    Spaces must be used for alignment; tabs are not allowed
    Open

         * File delimiter string.

    Spaces must be used for alignment; tabs are not allowed
    Open

                $fileInstance = \App\Fields\File::loadFromRequest($_FILES['imported_list']);

    Spaces must be used for alignment; tabs are not allowed
    Open

            }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @return array

    Spaces must be used for alignment; tabs are not allowed
    Open

                if (\App\Validator::ip($clearIp)) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $db->createCommand()->insert('s_#__mail_rbl_list', [

    Spaces must be used for alignment; tabs are not allowed
    Open

                        }

    Spaces must be used for alignment; tabs are not allowed
    Open

                        $report = [];

    Spaces must be used for alignment; tabs are not allowed
    Open

        public function process(App\Request $request)

    Spaces must be used for alignment; tabs are not allowed
    Open

                        }

    Spaces must be used for alignment; tabs are not allowed
    Open

            $response->emit();

    Spaces must be used for alignment; tabs are not allowed
    Open

                            ])->execute();

    Spaces must be used for alignment; tabs are not allowed
    Open

                    ++$report['errors'];

    Spaces must be used for alignment; tabs are not allowed
    Open

            $result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];

    Spaces must be used for alignment; tabs are not allowed
    Open

                            ++$report['saved'];

    Spaces must be used for alignment; tabs are not allowed
    Open

                } else {

    Spaces must be used for alignment; tabs are not allowed
    Open

         */

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

                'duplicates' => 0,

    Spaces must be used for alignment; tabs are not allowed
    Open

                        \App\Cache::delete('MailRblList', $clearIp);

    Spaces must be used for alignment; tabs are not allowed
    Open

                }

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @var string

    Spaces must be used for alignment; tabs are not allowed
    Open

        public $delimiter = "\n";

    Spaces must be used for alignment; tabs are not allowed
    Open

        {

    Spaces must be used for alignment; tabs are not allowed
    Open

                if ($fileInstance->validateAndSecure('text') && $fileInstance->getSize() < \App\Config::getMaxUploadSize()) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                            $result = ['success' => true, 'message' => $message];

    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))];

    Spaces must be used for alignment; tabs are not allowed
    Open

                        if (!$isExists) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    }

    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/>';

    Spaces must be used for alignment; tabs are not allowed
    Open

                                'type' => $type,

    Spaces must be used for alignment; tabs are not allowed
    Open

                            ++$report['duplicates'];

    Spaces must be used for alignment; tabs are not allowed
    Open

                        \App\Cache::delete('MailRblIpColor', $clearIp);

    Spaces must be used for alignment; tabs are not allowed
    Open

            $response = new Vtiger_Response();

    Spaces must be used for alignment; tabs are not allowed
    Open

         * Save to DB imported record.

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param string $source

    Spaces must be used for alignment; tabs are not allowed
    Open

                    if ($firstLine) {

    Spaces must be used for alignment; tabs are not allowed
    Open

     * @license      YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)

    Spaces must be used for alignment; tabs are not allowed
    Open

                    if (!empty($fileContent = $fileInstance->getContents())) {

    Spaces must be used for alignment; tabs are not allowed
    Open

            foreach ($explodedElements as $elementToSave) {

    Spaces must be used for alignment; tabs are not allowed
    Open

                    }

    Line exceeds 120 characters; contains 158 characters
    Open

                            $message .= \App\Language::translate('LBL_LIST_RECORD_ERRORS', $request->getModule(false)) . ': ' . $importResult['errors'] . '<br/>';

    Line exceeds 120 characters; contains 146 characters
    Open

                        $importResult = $this->saveToDb($request->getByType('source', 'Alnum'), $request->getByType('type', 'Integer'), $fileContent);

    Line exceeds 120 characters; contains 156 characters
    Open

                            $message .= \App\Language::translate('LBL_LIST_RECORD_SAVED', $request->getModule(false)) . ': ' . $importResult['saved'] . '<br/>';

    Line exceeds 120 characters; contains 166 characters
    Open

                            $message .= \App\Language::translate('LBL_LIST_RECORD_DUPLICATES', $request->getModule(false)) . ': ' . $importResult['duplicates'] . '<br/>';

    Line exceeds 120 characters; contains 126 characters
    Open

            $result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_ERROR', $request->getModule(false))];

    Line exceeds 120 characters; contains 147 characters
    Open

                            $result = ['success' => false, 'message' => \App\Language::translate('LBL_UPLOAD_WRONG_FILE', $request->getModule(false))];

    Line exceeds 120 characters; contains 121 characters
    Open

                if ($fileInstance->validateAndSecure('text') && $fileInstance->getSize() < \App\Config::getMaxUploadSize()) {

    Class name "Settings_MailRbl_UploadList_Action" is not in camel caps format
    Open

    class Settings_MailRbl_UploadList_Action extends Settings_Vtiger_Basic_Action

    There are no issues that match your filters.

    Category
    Status