YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailScanner/OSSMailScanner.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
56%

Method moduleHandler has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function moduleHandler($moduleName, $eventType)
    {
        $dbCommand = \App\Db::getInstance()->createCommand();
        if ('module.postinstall' === $eventType) {
            $this->turnOn();
Severity: Minor
Found in modules/OSSMailScanner/OSSMailScanner.php - About 1 hr to fix

    Function moduleHandler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();
    Severity: Minor
    Found in modules/OSSMailScanner/OSSMailScanner.php - About 25 mins 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

    Avoid using static access to class '\App\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_VERIFICATION');

    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\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_VERIFICATION');

    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 'Settings_Vtiger_Menu_Model' in method 'turnOff'.
    Open

            Settings_Vtiger_Menu_Model::clearCache();

    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 'Settings_Vtiger_Module_Model' in method 'turnOn'.
    Open

            Settings_Vtiger_Module_Model::addSettingsField('LBL_LOGS', [
                'name' => 'Mail Logs',
                'iconpath' => 'adminIcon-mail-download-history',
                'description' => 'LBL_MAIL_LOGS_DESCRIPTION',
                'linkto' => 'index.php?module=OSSMailScanner&parent=Settings&view=Logs',

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'vtlib\Module' in method 'moduleHandler'.
    Open

                $Module = vtlib\Module::getInstance($moduleName);

    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\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_ACTION');

    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\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_BIND');

    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\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_BIND');

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class 'vtlib\Module' in method 'moduleHandler'.
    Open

                $Module = vtlib\Module::getInstance($moduleName);

    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 'Settings_Vtiger_Module_Model' in method 'turnOn'.
    Open

            Settings_Vtiger_Module_Model::addSettingsField('LBL_MAIL_TOOLS', [
                'name' => 'Mail Scanner',
                'iconpath' => 'adminIcon-mail-scanner',
                'description' => 'LBL_MAIL_SCANNER_DESCRIPTION',
                'linkto' => 'index.php?module=OSSMailScanner&parent=Settings&view=Index',

    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\Cron' in method 'moduleHandler'.
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_ACTION');

    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 "vtiger_ossmailscanner_config" 9 times.
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    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 "conf_type" 9 times.
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    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 "parameter" 9 times.
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    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 "start_time" 3 times.
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_DisabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    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 "value" 3 times.
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'cron', 'parameter' => 'email', 'value' => ''])->execute();

    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 "vtiger_ossmails_logs" 4 times.
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_InstallModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId])->execute();

    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 "folders" 5 times.
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    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 "user_name" 4 times.
    Open

                $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');

    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 "Y-m-d H:i:s" 3 times.
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_DisabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    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 "action" 4 times.
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_InstallModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId])->execute();

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    function run() {
      prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
      execute('action1');
      release('action1');
    }
    

    Compliant Solution

    ACTION_1 = 'action1';
    
    function run() {
      prepare(ACTION_1);
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Argument 1 (ver1) is int but \version_compare() takes string
    Open

                if (version_compare($Module->version, '1.21', '>')) {

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

            $dbCommand = \App\Db::getInstance()->createCommand();
    Severity: Critical
    Found in modules/OSSMailScanner/OSSMailScanner.php by phan

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

            $dbCommand = \App\Db::getInstance()->createCommand();
    Severity: Critical
    Found in modules/OSSMailScanner/OSSMailScanner.php by phan

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (version_compare($Module->version, '1.21', '>')) {
                    $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');
                    $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_UpdateModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();
                }
    Severity: Minor
    Found in modules/OSSMailScanner/OSSMailScanner.php and 1 other location - About 30 mins to fix
    modules/OSSMail/OSSMail.php on lines 48..51

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 90.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Each class must be in a namespace of at least one level (a top-level vendor name)
    Open

    class OSSMailScanner

    Line exceeds 120 characters; contains 125 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Sent'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Trash'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $Module = vtlib\Module::getInstance($moduleName);

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ('module.disabled' === $eventType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ('module.enabled' === $eventType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'linkto' => 'index.php?module=OSSMailScanner&parent=Settings&view=Index',

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'name' => 'Mail Logs',

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

         *

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $dbCommand = \App\Db::getInstance()->createCommand();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            if ('module.postinstall' === $eventType) {

    Line exceeds 120 characters; contains 163 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'emailsearch', 'parameter' => 'changeTicketStatus', 'value' => 'false'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_BIND');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_BIND');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->turnOn();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            } elseif ('module.postupdate' === $eventType) {

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $dbCommand = \App\Db::getInstance()->createCommand();

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function moduleHandler($moduleName, $eventType)

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->update('vtiger_tab', ['customized' => 0], ['name' => 'OSSMailScanner'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Spam'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'description' => 'LBL_MAIL_SCANNER_DESCRIPTION',

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Settings_Vtiger_Module_Model::addSettingsField('LBL_LOGS', [

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function turnOff()

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->turnOn();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'emailsearch', 'parameter' => 'changeTicketStatus', 'value' => 'false'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $this->turnOff();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_VERIFICATION');

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ]);

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'emailsearch', 'parameter' => 'fields'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_ACTION');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_EnabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $dbCommand->delete('vtiger_settings_field', ['name' => 'Mail Scanner'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $eventType

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'All'])->execute();

    Line exceeds 120 characters; contains 138 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'cron', 'parameter' => 'email', 'value' => ''])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            ]);

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Module handler.

    Line exceeds 120 characters; contains 131 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'emailsearch', 'parameter' => 'fields'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_InstallModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId])->execute();

    Line exceeds 120 characters; contains 183 characters
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_EnabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                if (version_compare($Module->version, '1.21', '>')) {

    Line exceeds 120 characters; contains 124 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'All'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'cron', 'parameter' => 'time', 'value' => ''])->execute();

    Line exceeds 120 characters; contains 137 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'cron', 'parameter' => 'time', 'value' => ''])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_DisabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                }

    Line exceeds 120 characters; contains 171 characters
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_InstallModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_DISABLED, 'LBL_MAIL_SCANNER_VERIFICATION');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                    $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_UpdateModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'name' => 'Mail Scanner',

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'iconpath' => 'adminIcon-mail-download-history',

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'linkto' => 'index.php?module=OSSMailScanner&parent=Settings&view=Logs',

    Spaces must be used to indent lines; tabs are not allowed
    Open

            $dbCommand->delete('vtiger_settings_field', ['name' => 'Mail Logs'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'cron', 'parameter' => 'email', 'value' => ''])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Settings_Vtiger_Module_Model::addSettingsField('LBL_MAIL_TOOLS', [

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

            Settings_Vtiger_Menu_Model::clearCache();

    Spaces must be used to indent lines; tabs are not allowed
    Open

        }

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Sent'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                \App\Cron::updateStatus(\App\Cron::STATUS_ENABLED, 'LBL_MAIL_SCANNER_ACTION');

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'description' => 'LBL_MAIL_LOGS_DESCRIPTION',

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Spaces must be used to indent lines; tabs are not allowed
    Open

        {

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * @param string $moduleName

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $Module = vtlib\Module::getInstance($moduleName);

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Turn off.

    Line exceeds 120 characters; contains 125 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Spam'])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                $userId = Users_Record_Model::getCurrentUserModel()->get('user_name');

    Spaces must be used to indent lines; tabs are not allowed
    Open

        /**

    Spaces must be used to indent lines; tabs are not allowed
    Open

        public function turnOn()

    Spaces must be used to indent lines; tabs are not allowed
    Open

         */

    Line exceeds 120 characters; contains 184 characters
    Open

                $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_DisabledModule', 'info' => $moduleName, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

            }

    Spaces must be used to indent lines; tabs are not allowed
    Open

         * Turn on.

    Line exceeds 120 characters; contains 129 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Received'])->execute();

    Line exceeds 120 characters; contains 126 characters
    Open

                $dbCommand->insert('vtiger_ossmailscanner_config', ['conf_type' => 'folders', 'parameter' => 'Trash'])->execute();

    Line exceeds 120 characters; contains 211 characters
    Open

                    $dbCommand->insert('vtiger_ossmails_logs', ['action' => 'Action_UpdateModule', 'info' => $moduleName . ' ' . $Module->version, 'user' => $userId, 'start_time' => date('Y-m-d H:i:s')])->execute();

    Spaces must be used to indent lines; tabs are not allowed
    Open

                'iconpath' => 'adminIcon-mail-scanner',

    The variable $Module is not named in camelCase.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $Module is not named in camelCase.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $Module is not named in camelCase.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $Module is not named in camelCase.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    The variable $Module is not named in camelCase.
    Open

        public function moduleHandler($moduleName, $eventType)
        {
            $dbCommand = \App\Db::getInstance()->createCommand();
            if ('module.postinstall' === $eventType) {
                $this->turnOn();

    CamelCaseVariableName

    Since: 0.2

    It is considered best practice to use the camelCase notation to name variables.

    Example

    class ClassName {
        public function doSomething() {
            $data_module = new DataModule();
        }
    }

    Source

    There are no issues that match your filters.

    Category
    Status