YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMail/views/MailActionBar.php

Summary

Maintainability
B
4 hrs
Test Coverage

Method process has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $uid = $request->getInteger('uid');
        $params = null;
Severity: Major
Found in modules/OSSMail/views/MailActionBar.php - About 2 hrs to fix

    Function process has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $uid = $request->getInteger('uid');
            $params = null;
    Severity: Minor
    Found in modules/OSSMail/views/MailActionBar.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

    The method process() has an NPath complexity of 252. The configured NPath complexity threshold is 200.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $uid = $request->getInteger('uid');
            $params = null;

    NPathComplexity

    Since: 0.1

    The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

    Example

    class Foo {
        function bar() {
            // lots of complicated code
        }
    }

    Source https://phpmd.org/rules/codesize.html#npathcomplexity

    The method process() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $uid = $request->getInteger('uid');
            $params = null;

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
    Open

        public function process(App\Request $request)

    Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

    See

    The class OSSMail_MailActionBar_View has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13.
    Open

    class OSSMail_MailActionBar_View extends Vtiger_Index_View
    {
        use App\Controller\ClearProcess;
    
        /** {@inheritdoc} */

    CouplingBetweenObjects

    Since: 1.1.0

    A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

    Example

    class Foo {
        /**
         * @var \foo\bar\X
         */
        private $x = null;
    
        /**
         * @var \foo\bar\Y
         */
        private $y = null;
    
        /**
         * @var \foo\bar\Z
         */
        private $z = null;
    
        public function setFoo(\Foo $foo) {}
        public function setBar(\Bar $bar) {}
        public function setBaz(\Baz $baz) {}
    
        /**
         * @return \SplObjectStorage
         * @throws \OutOfRangeException
         * @throws \InvalidArgumentException
         * @throws \ErrorException
         */
        public function process(\Iterator $it) {}
    
        // ...
    }

    Source https://phpmd.org/rules/design.html#couplingbetweenobjects

    Missing class import via use statement (line '23', column '14').
    Open

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

    Source http://phpmd.org/rules/cleancode.html#MissingImport

    Avoid using static access to class 'OSSMail_Record_Model' in method 'process'.
    Open

            $account = OSSMail_Record_Model::getAccountByHash($request->getForSql('rcId'));

    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 '\OSSMail_Record_Model' in method 'process'.
    Open

                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, true, [], $account);

    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\Utils' in method 'process'.
    Open

                $folderDecode = \App\Utils::convertCharacterEncoding($request->getRaw('folder'), 'UTF7-IMAP', 'UTF-8');

    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 '46', column '9').
    Open

        public function process(App\Request $request)
        {
            $moduleName = $request->getModule();
            $uid = $request->getInteger('uid');
            $params = null;

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

    Avoid using static access to class 'OSSMail_Record_Model' in method 'process'.
    Open

                OSSMail_Record_Model::setAccountUserData($rcId, ['crm_status' => OSSMail_Record_Model::MAIL_BOX_STATUS_ACTIVE]);

    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 'OSSMailView_Record_Model' in method 'process'.
    Open

                $mailViewModel = OSSMailView_Record_Model::getCleanInstance('OSSMailView');

    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 'OSSMail_Record_Model' in method 'process'.
    Open

                    if ($mail = OSSMail_Record_Model::getMail($mbox, $uid)) {

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Record_Model' in method 'process'.
    Open

                    $recordModel = Vtiger_Record_Model::getInstanceById($record, $mailViewModel->getModule());

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'App\Log' in method 'process'.
    Open

                        App\Log::warning("Email not found. username: {$account['username']}, folder: $folder, uid: $uid ", __METHOD__);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'Vtiger_Record_Model' in method 'process'.
    Open

                $modelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');

    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\Utils' in method 'process'.
    Open

                $folder = \App\Utils::convertCharacterEncoding($folderDecode, 'UTF-8', 'UTF7-IMAP');

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Log' in method 'process'.
    Open

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString(), 'OSSMail');

    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\Purifier' in method 'process'.
    Open

                $folderDecode = \App\Purifier::decodeHtml($folderDecode);

    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 'OSSMailScanner_Record_Model' in method 'process'.
    Open

                        $return = OSSMailScanner_Record_Model::executeActions($account, $mail, $folderDecode, $params);

    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\Privilege' in method 'process'.
    Open

                } elseif ($record && !\App\Privilege::isPermitted('OSSMailView', 'DetailView', $record)) {

    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\Purifier' in method 'process'.
    Open

                $folderDecode = \App\Purifier::purifyByType($folderDecode, 'Text');

    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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                    } else {
                        App\Log::warning("Email not found. username: {$account['username']}, folder: $folder, uid: $uid ", __METHOD__);
                    }

    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\User' in method 'process'.
    Open

                    $sharedOwner[] = \App\User::getCurrentUserId();

    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

                $viewer->assign('URL', App\Config::main('site_URL'));

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\ModuleHierarchy' in method 'process'.
    Open

                \App\ModuleHierarchy::getModulesByLevel(0);

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

                    $sharedOwner = $recordModel->isEmpty('shownerid') ? [] : explode(',', $recordModel->get('shownerid'));

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

                $folderDecode = \App\Utils::convertCharacterEncoding($request->getRaw('folder'), 'UTF7-IMAP', 'UTF-8');

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

            if (OSSMail_Record_Model::MAIL_BOX_STATUS_DISABLED == $account['crm_status']) {

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

                if (!($record) && !empty($account['actions']) && false !== strpos($account['actions'], 'CreatedEmail')

    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 executeActions from undeclared class \OSSMailScanner_Record_Model
    Open

                        $return = OSSMailScanner_Record_Model::executeActions($account, $mail, $folderDecode, $params);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Argument 1 (mbox) is \IMAP\Connection|false but \OSSMail_Record_Model::getMail() takes resource defined at /code/modules/OSSMail/models/Record.php:297
    Open

                    if ($mail = OSSMail_Record_Model::getMail($mbox, $uid)) {

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RECORD', $record);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                    $viewer->assign('RELATED_RECORDS', $relatedRecords);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('MODULE_NAME', $moduleName);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('URL', App\Config::main('site_URL'));
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
    Open

                    $sharedOwner[] = \App\User::getCurrentUserId();
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to method error from undeclared class \App\Log
    Open

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString(), 'OSSMail');
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to undeclared method \Vtiger_Record_Model::getFolders
    Open

            && isset(array_column($modelMailScanner->getFolders($rcId), 'folder', 'folder')[$folderDecode])
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Argument 2 (module) is \Vtiger_Module_Model|\vtlib\Module|\vtlib\ModuleBasic but \Vtiger_Record_Model::getInstanceById() takes string defined at /code/modules/Vtiger/models/Record.php:763
    Open

                    $recordModel = Vtiger_Record_Model::getInstanceById($record, $mailViewModel->getModule());

    Call to method warning from undeclared class \App\Log
    Open

                        App\Log::warning("Email not found. username: {$account['username']}, folder: $folder, uid: $uid ", __METHOD__);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

    Call to method getInstance from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
    Open

                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, true, [], $account);
    Severity: Critical
    Found in modules/OSSMail/views/MailActionBar.php by phan

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

    class OSSMail_MailActionBar_View extends Vtiger_Index_View

    The class OSSMail_MailActionBar_View is not named in CamelCase.
    Open

    class OSSMail_MailActionBar_View extends Vtiger_Index_View
    {
        use App\Controller\ClearProcess;
    
        /** {@inheritdoc} */

    CamelCaseClassName

    Since: 0.2

    It is considered best practice to use the CamelCase notation to name classes.

    Example

    class class_name {
    }

    Source

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

            }

    Line exceeds 120 characters; contains 124 characters
    Open

                OSSMail_Record_Model::setAccountUserData($rcId, ['crm_status' => OSSMail_Record_Model::MAIL_BOX_STATUS_ACTIVE]);

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

        use App\Controller\ClearProcess;

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

            $rcId = $account['user_id'];

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

        /** {@inheritdoc} */

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

                $folderDecode = \App\Purifier::purifyByType($folderDecode, 'Text');

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

                $folderDecode = \App\Purifier::decodeHtml($folderDecode);

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

            $moduleName = $request->getModule();

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

            $uid = $request->getInteger('uid');

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

                $mailViewModel = OSSMailView_Record_Model::getCleanInstance('OSSMailView');

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

            if (OSSMail_Record_Model::MAIL_BOX_STATUS_BLOCKED_TEMP == $account['crm_status'] || OSSMail_Record_Model::MAIL_BOX_STATUS_BLOCKED_PERM == $account['crm_status']) {

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

                return;

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

            try {

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

                $folderDecode = \App\Utils::convertCharacterEncoding($request->getRaw('folder'), 'UTF7-IMAP', 'UTF-8');

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

            if (!$account) {

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

        {

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

            $account = OSSMail_Record_Model::getAccountByHash($request->getForSql('rcId'));

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

            if (OSSMail_Record_Model::MAIL_BOX_STATUS_DISABLED == $account['crm_status']) {

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

                OSSMail_Record_Model::setAccountUserData($rcId, ['crm_status' => OSSMail_Record_Model::MAIL_BOX_STATUS_ACTIVE]);

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

                    }

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

                    $recordModel->set('shownerid', implode(',', $sharedOwner))->save();

    Line exceeds 120 characters; contains 131 characters
    Open

                        App\Log::warning("Email not found. username: {$account['username']}, folder: $folder, uid: $uid ", __METHOD__);

    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

            }

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

                $modelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');

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

                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, true, [], $account);

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

        public function process(App\Request $request)

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

            $params = null;

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

                $account['crm_status'] = OSSMail_Record_Model::MAIL_BOX_STATUS_ACTIVE;

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

                $viewer->assign('RECORD', $record);

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

                $record = $mailViewModel->checkMailExist($uid, $folderDecode, $rcId, $mbox);

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

                if ($record) {

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

                    $relatedRecords = $mailViewModel->getRelatedRecords($record);

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);

    Line exceeds 120 characters; contains 171 characters
    Open

            if (OSSMail_Record_Model::MAIL_BOX_STATUS_BLOCKED_TEMP == $account['crm_status'] || OSSMail_Record_Model::MAIL_BOX_STATUS_BLOCKED_PERM == $account['crm_status']) {

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

                        if (!empty($return['CreatedEmail'])) {

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

                    $viewer->assign('RELATED_RECORDS', $relatedRecords);

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

                $viewer->assign('MODULE_NAME', $moduleName);

    Line exceeds 120 characters; contains 192 characters
    Open

                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, true, [], $account);

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

                        }

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

                \App\ModuleHierarchy::getModulesByLevel(0);

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

                }

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

            && isset(array_column($modelMailScanner->getFolders($rcId), 'folder', 'folder')[$folderDecode])

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

                    $sharedOwner = $recordModel->isEmpty('shownerid') ? [] : explode(',', $recordModel->get('shownerid'));

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

                }

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

                $viewer->view('MailActionBar.tpl', $moduleName);

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

                    } else {

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

        }

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

                            $record = $return['CreatedEmail']['mailViewId'];

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

                    $recordModel = Vtiger_Record_Model::getInstanceById($record, $mailViewModel->getModule());

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

                    $sharedOwner[] = \App\User::getCurrentUserId();

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

            } catch (\Throwable $e) {

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

                $folder = \App\Utils::convertCharacterEncoding($folderDecode, 'UTF-8', 'UTF7-IMAP');

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

                if (!($record) && !empty($account['actions']) && false !== strpos($account['actions'], 'CreatedEmail')

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

                    if ($mail = OSSMail_Record_Model::getMail($mbox, $uid)) {

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

        ) {

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

                        $return = OSSMailScanner_Record_Model::executeActions($account, $mail, $folderDecode, $params);

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

                $viewer = $this->getViewer($request);

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

                $viewer->assign('URL', App\Config::main('site_URL'));

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

                \App\Log::error($e->getMessage() . PHP_EOL . $e->__toString(), 'OSSMail');

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

                        App\Log::warning("Email not found. username: {$account['username']}, folder: $folder, uid: $uid ", __METHOD__);

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

                } elseif ($record && !\App\Privilege::isPermitted('OSSMailView', 'DetailView', $record)) {

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

    class OSSMail_MailActionBar_View extends Vtiger_Index_View

    Line indented incorrectly; expected at least 12 spaces, found 4
    Open

        ) {

    Line indented incorrectly; expected at least 12 spaces, found 8
    Open

            && isset(array_column($modelMailScanner->getFolders($rcId), 'folder', 'folder')[$folderDecode])

    There are no issues that match your filters.

    Category
    Status