YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMailScanner/models/Record.php

Summary

Maintainability
F
3 days
Test Coverage
F
3%

File Record.php has 540 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * OSSMailScanner Record model class.
 *
Severity: Major
Found in modules/OSSMailScanner/models/Record.php - About 1 day to fix

    OSSMailScanner_Record_Model has 35 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OSSMailScanner_Record_Model extends Vtiger_Record_Model
    {
        /**
         * Main folders array.
         *
    Severity: Minor
    Found in modules/OSSMailScanner/models/Record.php - About 4 hrs to fix

      The class OSSMailScanner_Record_Model has an overall complexity of 123 which is very high. The configured complexity threshold is 50.
      Open

      class OSSMailScanner_Record_Model extends Vtiger_Record_Model
      {
          /**
           * Main folders array.
           *

      The class OSSMailScanner_Record_Model has 11 public methods. Consider refactoring OSSMailScanner_Record_Model to keep number of public methods under 10.
      Open

      class OSSMailScanner_Record_Model extends Vtiger_Record_Model
      {
          /**
           * Main folders array.
           *

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

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

      Function mailScan has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
          {
              $break = false;
              $lastScanUid = self::getUidFolder($account['user_id'], $folder);
              \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
      Severity: Minor
      Found in modules/OSSMailScanner/models/Record.php - About 3 hrs 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

      Function executeCron has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function executeCron($whoTrigger)
          {
              \App\Log::trace('Start executeCron');
              if (!self::isPermissionToScan($whoTrigger)) {
                  \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));
      Severity: Minor
      Found in modules/OSSMailScanner/models/Record.php - About 2 hrs 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 mailScan has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
          {
              $break = false;
              $lastScanUid = self::getUidFolder($account['user_id'], $folder);
              \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
      Severity: Minor
      Found in modules/OSSMailScanner/models/Record.php - About 1 hr to fix

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

            public function executeCron($whoTrigger)
            {
                \App\Log::trace('Start executeCron');
                if (!self::isPermissionToScan($whoTrigger)) {
                    \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));
        Severity: Minor
        Found in modules/OSSMailScanner/models/Record.php - About 1 hr to fix

          Function executeActions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function executeActions($account, OSSMail_Mail_Model $mail, $folder, $params = false)
              {
                  \App\Log::trace('Start execute actions: ' . $account['username'], 'MailScanner');
          
                  $actions = [];
          Severity: Minor
          Found in modules/OSSMailScanner/models/Record.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 executeActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function executeActions($account, OSSMail_Mail_Model $mail, $folder, $params = false)
              {
                  \App\Log::trace('Start execute actions: ' . $account['username'], 'MailScanner');
          
                  $actions = [];
          Severity: Minor
          Found in modules/OSSMailScanner/models/Record.php - About 1 hr to fix

            Method bindMail has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function bindMail($row)
                {
                    if (empty($row['actions'])) {
                        return false;
                    }
            Severity: Minor
            Found in modules/OSSMailScanner/models/Record.php - About 1 hr to fix

              Function setFolderList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function setFolderList($user, $foldersByType)
                  {
                      $dbCommand = \App\Db::getInstance()->createCommand();
                      $oldFoldersByType = (new \App\Db\Query())->select(['type', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $user])->createCommand()->queryAllByGroup(2);
                      foreach (self::$mainFolders as $type) {
              Severity: Minor
              Found in modules/OSSMailScanner/models/Record.php - About 55 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

              Function manualScanMail has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function manualScanMail(int $uid, string $folder, array $account)
                  {
                      $imapFolder = \App\Utils::convertCharacterEncoding($folder, 'UTF-8', 'UTF7-IMAP');
                      $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $imapFolder);
                      $mail = OSSMail_Record_Model::getMail($mbox, $uid);
              Severity: Minor
              Found in modules/OSSMailScanner/models/Record.php - About 45 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

              Method mailScan has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
              Severity: Minor
              Found in modules/OSSMailScanner/models/Record.php - About 35 mins to fix

                Function getActionsList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getActionsList()
                    {
                        $accountsPriority = ['CreatedEmail', 'CreatedHelpDesk', 'BindAccounts', 'BindContacts', 'BindLeads', 'BindHelpDesk', 'BindSSalesProcesses'];
                        $moduleModel = Vtiger_Module_Model::getInstance('OSSMailScanner');
                        $iterator = new DirectoryIterator($moduleModel->actionsDir);
                Severity: Minor
                Found in modules/OSSMailScanner/models/Record.php - About 35 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

                Function getEmailActionsListName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getEmailActionsListName($data)
                    {
                        $return = [];
                        foreach ($data as $row) {
                            if ('files' == $row[0]) {
                Severity: Minor
                Found in modules/OSSMailScanner/models/Record.php - About 35 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

                Function getTypeFolder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getTypeFolder($folder)
                    {
                        switch ($folder) {
                            case 'Received':
                                $return = 0;
                Severity: Minor
                Found in modules/OSSMailScanner/models/Record.php - About 35 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

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

                    public static function setEmailSearchList($value)
                    {
                        $dbCommand = App\Db::getInstance()->createCommand();
                        if (null === $value || 'null' == $value) {
                            $dbCommand->update('vtiger_ossmailscanner_config', ['value' => ''], ['conf_type' => 'emailsearch', 'parameter' => 'fields'])->execute();
                Severity: Minor
                Found in modules/OSSMailScanner/models/Record.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

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

                    public function executeCron($whoTrigger)
                    {
                        \App\Log::trace('Start executeCron');
                        if (!self::isPermissionToScan($whoTrigger)) {
                            \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));

                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

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

                    public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
                    {
                        $break = false;
                        $lastScanUid = self::getUidFolder($account['user_id'], $folder);
                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

                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

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

                class OSSMailScanner_Record_Model extends Vtiger_Record_Model
                {
                    /**
                     * Main folders array.
                     *

                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 '527', column '15').
                Open

                        return (new App\Db\Query())->select(['name', 'status', 'frequency'])->from('vtiger_cron_task')->where(['module' => 'OSSMailScanner'])->createCommand()->queryAll();

                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 '634', column '21').
                Open

                            $startTime = new DateTimeField($row['start_time']);

                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 '802', column '30').
                Open

                        return $this->group = (new \App\Db\Query())->select(['groupid', 'groupname'])->from('vtiger_groups')->all();

                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 executeActions has a boolean flag argument $params, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public static function executeActions($account, OSSMail_Mail_Model $mail, $folder, $params = false)

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

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

                Missing class import via use statement (line '465', column '17').
                Open

                        $value = (new \App\Db\Query())->select(['value'])->from('vtiger_ossmailscanner_config')

                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 '158', column '16').
                Open

                            return (new \App\Db\Query())->select(['parameter'])->from('vtiger_ossmailscanner_config')->where(['and', ['conf_type' => 'folders'], ['like', 'value', $folder]])->orderBy('parameter')->scalar();

                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 '822', column '15').
                Open

                        $mail = new OSSMail_Mail_Model();

                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 '716', column '15').
                Open

                        return (new App\Db\Query())->select(['id'])->from('vtiger_ossmails_logs')->where($where)->exists();

                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 '780', column '22').
                Open

                        $this->user = (new \App\Db\Query())->select(['id', 'user_name', 'first_name', 'last_name'])->from('vtiger_users')->where(['status' => 'Active'])->createCommand()->queryAll();

                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 '123', column '28').
                Open

                        $oldFoldersByType = (new \App\Db\Query())->select(['type', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $user])->createCommand()->queryAllByGroup(2);

                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 getConfigFolderList has a boolean flag argument $folder, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public static function getConfigFolderList($folder = false)

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

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

                Missing class import via use statement (line '29', column '19').
                Open

                        $iterator = new DirectoryIterator($moduleModel->actionsDir);

                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 '58', column '17').
                Open

                        $query = (new \App\Db\Query())->select(['name', 'email', 'identity_id'])->from('roundcube_identities');

                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 '269', column '15').
                Open

                        return (new \App\Db\Query())->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId])->createCommand()->queryAll();

                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 getEmailSearch has a boolean flag argument $onlyMailUitype, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public static function getEmailSearch($module = false, $onlyMailUitype = true)

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

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

                Missing class import via use statement (line '172', column '17').
                Open

                        $query = (new \App\Db\Query())->from('vtiger_ossmailscanner_config');

                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 getEmailSearch has a boolean flag argument $module, which is a certain sign of a Single Responsibility Principle violation.
                Open

                    public static function getEmailSearch($module = false, $onlyMailUitype = true)

                BooleanArgumentFlag

                Since: 1.4.0

                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                Example

                class Foo {
                    public function bar($flag = true) {
                    }
                }

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

                Missing class import via use statement (line '486', column '21').
                Open

                            $isExists = (new App\Db\Query())->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'emailsearch', 'parameter' => 'fields'])->exists();

                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 '631', column '22').
                Open

                        $dataReader = (new App\Db\Query())->from('vtiger_ossmails_logs')->orderBy(['id' => SORT_DESC])->limit($endNumber)->offset($startNumber)->createCommand()->query();

                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 '635', column '19').
                Open

                            $endTime = new DateTimeField($row['end_time']);

                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 '160', column '15').
                Open

                        return (new \App\Db\Query())->select(['parameter', 'value'])->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'folders'])->orderBy(['parameter' => SORT_DESC])->createCommand()->queryAllByGroup(0);

                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 '251', column '16').
                Open

                        $rows = (new \App\Db\Query())->select(['uid', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId, 'folder' => $folder])->createCommand()->query();

                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 '428', column '17').
                Open

                        $query = (new App\Db\Query())->from('vtiger_field')

                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 'App\Cache' in method 'getIdentities'.
                Open

                        App\Cache::staticSave('OSSMailScanner_Record_Model::getIdentities', $id, $rows);

                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 'mailScan'.
                Open

                        \App\Log::beginProfile(__METHOD__ . '|imap_num_msg', 'Mail|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 'mailScan'.
                Open

                        \App\Log::endProfile(__METHOD__ . '|imap_num_msg', 'Mail|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\Utils' in method 'executeCron'.
                Open

                                $folder = \App\Utils::convertCharacterEncoding($folderRow['folder'], '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 'Vtiger_Loader' in method 'executeActions'.
                Open

                            $handlerClass = Vtiger_Loader::getComponentClassName('ScannerAction', $action, '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\Log' in method 'executeActions'.
                Open

                        \App\Log::trace('End execute actions', 'MailScanner');

                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 'getEmailSearchList'.
                Open

                            return \App\Cache::staticGet($cacheKey, $cacheValue);

                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 'isConnection'.
                Open

                        $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], '', false, [], $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 'OSSMail_Record_Model' in method 'mailScan'.
                Open

                                $mail = OSSMail_Record_Model::getMail($mbox, $uid, $i);

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

                                } else {
                                    \App\Log::error("Incorrect mail access data, username: {$account['username']} , folder: $folder , type: {$folderRow['type']} ,  Error: " . imap_last_error());
                                }

                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 'Vtiger_Loader' in method 'bindMail'.
                Open

                            $handlerClass = Vtiger_Loader::getComponentClassName('ScannerAction', $action, '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\Cache' in method 'getIdentities'.
                Open

                            return App\Cache::staticGet('OSSMailScanner_Record_Model::getIdentities', $id);

                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 'manualScanMail'.
                Open

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

                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_Module_Model' in method 'getActionsList'.
                Open

                        $moduleModel = Vtiger_Module_Model::getInstance('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\Log' in method 'mailScan'.
                Open

                                \App\Log::endProfile(__METHOD__ . '|imap_uid', 'Mail|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\Language' in method 'executeCron'.
                Open

                            \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', '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\Db' in method 'addScanHistory'.
                Open

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

                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 'runRestartCron'.
                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

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

                                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|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 assigning values to variables in if clauses and the like (line '554', column '78').
                Open

                    public function executeCron($whoTrigger)
                    {
                        \App\Log::trace('Start executeCron');
                        if (!self::isPermissionToScan($whoTrigger)) {
                            \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));

                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

                The method getEmailActionsListName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                            } else {
                                foreach ($row[2] as $row_dir) {
                                    $return[] = [$row_dir[1], $row[1] . '|' . $row_dir[1]];
                                }
                            }

                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\Log' in method 'mailScan'.
                Open

                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|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\Cache' in method 'getEmailSearchList'.
                Open

                        if (\App\Cache::staticHas($cacheKey, $cacheValue)) {

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

                        } else {
                            $isExists = (new App\Db\Query())->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'emailsearch', 'parameter' => 'fields'])->exists();
                            if (!$isExists) {
                                $dbCommand->insert('vtiger_ossmailscanner_config', [
                                    'conf_type' => 'emailsearch',

                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\Log' in method 'executeActions'.
                Open

                                \App\Log::trace('Start action: ' . $action, 'MailScanner');

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

                            } else {
                                $dbCommand->update('vtiger_ossmailscanner_config', ['value' => $value], ['conf_type' => 'emailsearch', 'parameter' => 'fields'])->execute();
                            }

                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 'executeCron'.
                Open

                            return \App\Language::translate('ERROR_ACTIVE_CRON', '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 '\OSSMail_Record_Model' in method 'executeCron'.
                Open

                                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, false, [], $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

                The method executeActions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                Open

                        } else {
                            $actions = $account['actions'];
                        }

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

                        $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 'App\Cache' in method 'getIdentities'.
                Open

                        if (App\Cache::staticHas('OSSMailScanner_Record_Model::getIdentities', $id)) {

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

                            } else {
                                $actions = $account['actions'];
                            }

                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\Log' in method 'mailScan'.
                Open

                        \App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|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 'mailScan'.
                Open

                                        \App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|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\Language' in method 'setConfigWidget'.
                Open

                        return App\Language::translate('LBL_SAVE', '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\Config' in method 'mailScan'.
                Open

                                    || $countEmails >= \App\Config::performance('NUMBERS_EMAILS_DOWNLOADED_DURING_ONE_SCANNING')) {

                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 'executeCron'.
                Open

                        \App\Log::trace('Start executeCron');

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

                        } else {
                            if (\is_string($account['actions'])) {
                                $actions = explode(',', $account['actions']);
                            } else {
                                $actions = $account['actions'];

                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\Log' in method 'executeCron'.
                Open

                            \App\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', '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\Log' in method 'executeCron'.
                Open

                                    \App\Log::error("Incorrect mail access data, username: {$account['username']} , folder: $folder , type: {$folderRow['type']} ,  Error: " . imap_last_error());

                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 'executeCron'.
                Open

                        \App\Log::trace('End executeCron');

                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 'accountDelete'.
                Open

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

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

                            } else {
                                $return[$row['conf_type']][$row['parameter']] = $row['value'];
                            }

                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\Log' in method 'executeActions'.
                Open

                        \App\Log::trace('Start execute actions: ' . $account['username'], 'MailScanner');

                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 'executeActions'.
                Open

                                \App\Log::trace('End action', 'MailScanner');

                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 'manualScanMail'.
                Open

                        $imapFolder = \App\Utils::convertCharacterEncoding($folder, '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\Cache' in method 'getEmailSearchList'.
                Open

                        \App\Cache::staticSave($cacheKey, $cacheValue, $return);

                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 'executeCron'.
                Open

                        $scannerModel = 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\Log' in method 'executeCron'.
                Open

                            \App\Log::trace('Start checking account: ' . $account['username']);

                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 'executeActions'.
                Open

                                    App\Log::error("Action: $action  Folder: $folder ID:" . $mail->get('id') . PHP_EOL . $e->__toString(), 'MailScanner');

                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 'mailScan'.
                Open

                                \App\Log::beginProfile(__METHOD__ . '|imap_uid', 'Mail|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 'OSSMail_Record_Model' in method 'executeCron'.
                Open

                        $accounts = OSSMail_Record_Model::getAccountsList();

                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 'executeCron'.
                Open

                            \App\Log::info('There are no accounts to be scanned');

                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 'executeCron'.
                Open

                                \App\Log::trace('Start checking folder: ' . $folder);

                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 'executeCron'.
                Open

                                        \App\Log::info('Reached the maximum number of scanned mails');

                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

                syntax error, unexpected ')'
                Open

                                array_unshift($actions, 'CreatedEmail', );
                Severity: Critical
                Found in modules/OSSMailScanner/models/Record.php by phan

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

                class OSSMailScanner_Record_Model extends Vtiger_Record_Model

                The parameter $scan_id is not named in camelCase.
                Open

                    public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
                    {
                        $break = false;
                        $lastScanUid = self::getUidFolder($account['user_id'], $folder);
                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

                CamelCaseParameterName

                Since: 0.2

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

                Example

                class ClassName {
                    public function doSomething($user_name) {
                    }
                }

                Source

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

                    public static function getIdentities($id = 0)

                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

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

                    public function deleteIdentities($id)

                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

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

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

                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

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

                    public static function accountDelete($id)

                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

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

                    public function getHistoryStatus($id)

                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

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

                    public static function updateScanHistory($id, $array): bool

                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 OSSMailScanner_Record_Model is not named in CamelCase.
                Open

                class OSSMailScanner_Record_Model extends Vtiger_Record_Model
                {
                    /**
                     * Main folders array.
                     *

                CamelCaseClassName

                Since: 0.2

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

                Example

                class class_name {
                }

                Source

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

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

                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

                Only one argument is allowed per line in a multi-line function call
                Open

                        $result = $dbCommand->update('vtiger_ossmails_logs', ['end_time' => date('Y-m-d H:i:s'), 'status' => $array['status'], 'count' => $array['count'], 'action' => $array['action']],

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

                                $key = array_search($action, $accountsPriority);

                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

                     */

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

                     * @return array

                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 array $data

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

                     * @param string $value

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

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

                            }

                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 (new \App\Db\Query())->select(['parameter'])->from('vtiger_ossmailscanner_config')->where(['and', ['conf_type' => 'folders'], ['like', 'value', $folder]])->orderBy('parameter')->scalar();

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

                     * Return mailscanner config.

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

                     *

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

                                $action = trim($fileInfo->getBasename('.php'));

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

                                $actions[$key] = $action;

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

                        ksort($actions);

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

                    public static function getIdentities($id = 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

                        $rows = $query->all();

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

                     * Delete identity by id.

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

                                foreach ($row[2] as $row_dir) {

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

                     */

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

                     * Update folder list for user.

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

                                    'folder' => html_entity_decode($folder),

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

                     * @return array|string

                Line exceeds 120 characters; contains 206 characters
                Open

                            return (new \App\Db\Query())->select(['parameter'])->from('vtiger_ossmailscanner_config')->where(['and', ['conf_type' => 'folders'], ['like', 'value', $folder]])->orderBy('parameter')->scalar();

                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

                        $iterator = new DirectoryIterator($moduleModel->actionsDir);

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

                        $actions = [];

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

                        foreach ($iterator as $i => $fileInfo) {

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

                        if ($id) {

                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 bool|string $folder

                Line exceeds 120 characters; contains 148 characters
                Open

                        $accountsPriority = ['CreatedEmail', 'CreatedHelpDesk', 'BindAccounts', 'BindContacts', 'BindLeads', 'BindHelpDesk', 'BindSSalesProcesses'];

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

                     * Return user identities.

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

                        App\Cache::staticSave('OSSMailScanner_Record_Model::getIdentities', $id, $rows);

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

                     * @param int $id

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

                    /**

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

                            $toRemove = $toAdd = $oldFolders = $folders = [];

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

                            if (isset($foldersByType[$type])) {

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

                     * @param bool|string $confType

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

                    public static function getActionsList()

                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 array

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

                     *

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

                            } else {

                Line exceeds 120 characters; contains 187 characters
                Open

                        $oldFoldersByType = (new \App\Db\Query())->select(['type', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $user])->createCommand()->queryAllByGroup(2);

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

                                $oldFolders = $oldFoldersByType[$type];

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

                            $toRemove = array_diff_assoc($oldFolders, $folders);

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

                                $dbCommand->insert('vtiger_ossmailscanner_folders_uid', [

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

                                    'type' => $type,

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

                     * @return array

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

                                if (false === $key) {

                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

                     * @return array

                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

                    /**

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

                     * @var array

                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 App\Cache::staticGet('OSSMailScanner_Record_Model::getIdentities', $id);

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

                                $dbCommand->delete('vtiger_ossmailscanner_folders_uid', ['user_id' => $user, 'type' => $type, 'folder' => html_entity_decode($folder)])->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

                    {

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

                    public static function getConfig($confType)

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

                        return $actions;

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

                     *

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

                        $query = (new \App\Db\Query())->select(['name', 'email', 'identity_id'])->from('roundcube_identities');

                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 deleteIdentities($id)

                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

                            ], ['user_id' => $userid])

                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

                        $oldFoldersByType = (new \App\Db\Query())->select(['type', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $user])->createCommand()->queryAllByGroup(2);

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

                        if ($folder) {

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

                     * Main folders array.

                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 int    $userid

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

                    public static function setActions($userid, $value)

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

                            ->update('roundcube_users', [

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

                     */

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

                            foreach ($toAdd as $folder) {

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

                    public static function getConfigFolderList($folder = false)

                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

                    /**

                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 = [];

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

                                }

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

                     * Update user actions.

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

                     * @param int   $user

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

                                $folders = $foldersByType[$type];

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

                            $toAdd = array_diff_assoc($folders, $oldFolders);

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

                        $accountsPriority = ['CreatedEmail', 'CreatedHelpDesk', 'BindAccounts', 'BindContacts', 'BindLeads', 'BindHelpDesk', 'BindSSalesProcesses'];

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

                                    $key = $i + 100;

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

                     * @param int $id

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

                        return $rows;

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

                        \App\Db::getInstance()->createCommand()->delete('roundcube_identities', ['identity_id' => $id])->execute();

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

                                $return[] = [$row[1], $row[1]];

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

                                    $return[] = [$row_dir[1], $row[1] . '|' . $row_dir[1]];

                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 $return;

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

                            if (isset($oldFoldersByType[$type])) {

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

                            }

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

                        }

                Line exceeds 120 characters; contains 216 characters
                Open

                        return (new \App\Db\Query())->select(['parameter', 'value'])->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'folders'])->orderBy(['parameter' => SORT_DESC])->createCommand()->queryAllByGroup(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

                     * Return email  actions name list.

                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 static function getEmailActionsListName($data)

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

                        foreach ($data as $row) {

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

                        foreach (self::$mainFolders as $type) {

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

                     *

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

                     * Returns array list of actions.

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

                            if (!$fileInfo->isDot() && 'php' === $fileInfo->getExtension()) {

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

                        }

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

                            $query = $query->where(['user_id' => $id]);

                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

                                    'user_id' => $user,

                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 (new \App\Db\Query())->select(['parameter', 'value'])->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'folders'])->orderBy(['parameter' => SORT_DESC])->createCommand()->queryAllByGroup(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

                     * Update config widget param.

                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 App\Language::translate('LBL_SAVE', 'OSSMailScanner');

                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

                        $actions = [];

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

                     * @param int    $uid

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

                    public static $mainFolders = ['Received', 'Sent', 'Spam', 'Trash', 'All'];

                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

                        $moduleModel = Vtiger_Module_Model::getInstance('OSSMailScanner');

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

                        }

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

                            if ('files' == $row[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

                     * @param array $foldersByType

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

                            foreach ($toRemove as $folder) {

                Line exceeds 120 characters; contains 163 characters
                Open

                                $dbCommand->delete('vtiger_ossmailscanner_folders_uid', ['user_id' => $user, 'type' => $type, 'folder' => html_entity_decode($folder)])->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

                    /**

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

                     * Return folders config.

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

                     *

                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

                        App\Db::getInstance()->createCommand()->update('vtiger_ossmailscanner_config', ['value' => $value], ['conf_type' => $confType, 'parameter' => $type])->execute();

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

                     * @param string $folder

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

                                $return = 3;

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

                                $return = 4;

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

                        while ($row = $rows->read()) {

                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 $folder

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

                     * @throws \App\Exceptions\AppException

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

                            }

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

                        if (App\Cache::staticHas('OSSMailScanner_Record_Model::getIdentities', $id)) {

                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

                        \App\Db::getInstance()->createCommand()

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

                                'actions' => $value,

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

                    public static function setFolderList($user, $foldersByType)

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

                                ])->execute();

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

                            case 'Trash':

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

                                break;

                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 int    $accountId

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

                     * Return user folders.

                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

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

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

                            case 'Spam':

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

                                break;

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

                            default:

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

                        $rows = (new \App\Db\Query())->select(['uid', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId, 'folder' => $folder])->createCommand()->query();

                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 int                $account

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

                                \App\Log::trace('End action', 'MailScanner');

                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 = [];

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

                    {

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

                                break;

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

                     */

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

                            $actions = $params['actions'];

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

                        return $return;

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

                    public function setConfigWidget($confType, $type, $value)

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

                                $return = 1;

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

                     * @return int

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

                    {

                Line exceeds 120 characters; contains 189 characters
                Open

                        $rows = (new \App\Db\Query())->select(['uid', 'folder'])->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId, 'folder' => $folder])->createCommand()->query();

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

                     * @param OSSMail_Mail_Model $mail

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

                        $mail->setAccount($account);

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

                                    App\Log::error("Action: $action  Folder: $folder ID:" . $mail->get('id') . PHP_EOL . $e->__toString(), 'MailScanner');

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

                            }

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

                        $dataReader->close();

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

                     *

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

                            case 'Received':

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

                            case 'Sent':

                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             $folder

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

                     * @return array

                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

                            $query->where(['conf_type' => $confType]);

                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 = 2;

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

                    public function getFolders($accountId)

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

                        foreach ($actions as &$action) {

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

                                $return[$row['parameter']] = $row['value'];

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

                     * @param string $value

                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 static function getTypeFolder($folder)

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

                     * @param string $folder

                Line exceeds 120 characters; contains 143 characters
                Open

                        return (new \App\Db\Query())->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId])->createCommand()->queryAll();

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

                                try {

                Line exceeds 120 characters; contains 138 characters
                Open

                                    App\Log::error("Action: $action  Folder: $folder ID:" . $mail->get('id') . PHP_EOL . $e->__toString(), 'MailScanner');

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

                    public function manualScanMail(int $uid, string $folder, array $account)

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

                     * @param string $confType

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

                        if (null === $value || 'null' === $value) {

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

                            $value = null;

                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

                     */

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

                        \App\Log::trace('Start execute actions: ' . $account['username'], 'MailScanner');

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

                            $actions = explode(',', $account['actions']);

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

                                \App\Log::trace('Start action: ' . $action, 'MailScanner');

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

                        if (false !== $confType) {

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

                        $dataReader = $query->createCommand()->query();

                Line exceeds 120 characters; contains 169 characters
                Open

                        App\Db::getInstance()->createCommand()->update('vtiger_ossmailscanner_config', ['value' => $value], ['conf_type' => $confType, 'parameter' => $type])->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

                            }

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

                                    $mail->addActionResult($action, $handler->process($mail));

                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 array

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

                        $query = (new \App\Db\Query())->from('vtiger_ossmailscanner_config');

                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 int

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

                        switch ($folder) {

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

                     * Return folder UID.

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

                        return 0;

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

                            $actions = $account['actions'];

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

                        return $mail->getActionResult();

                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

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

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

                        $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

                     *

                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

                                $uid = imap_uid($mbox, $i);

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

                    }

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

                            ->where(['and', ['uitype' => ($onlyMailUitype ? 13 : [13, 319])], ['<>', 'vtiger_field.presence', 1], ['<>', 'vtiger_tab.name', 'Users']]);

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

                        }

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

                        while ($row = $dataReader->read()) {

                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 = 0;

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

                                break;

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

                            case 'All':

                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 int $accountId

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

                        return (new \App\Db\Query())->from('vtiger_ossmailscanner_folders_uid')->where(['user_id' => $accountId])->createCommand()->queryAll();

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

                        if ($params && \array_key_exists('actions', $params)) {

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

                        } elseif (\is_string($account['actions'])) {

                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 array  $account

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

                        $params = [];

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

                        unset($mail);

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

                     * @param resource $mbox

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

                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

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

                        $msgno = $lastScanUid ? imap_msgno($mbox, $lastScanUid) : 0;

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

                        $numMsg = imap_num_msg($mbox);

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

                     */

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

                                    if ($uid > $lastScanUid) {

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

                     * Returns folder type.

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

                            for ($i = $msgno; $i <= $numMsg; ++$i) {

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

                     * @param mixed  $onlyMailUitype

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

                     *

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

                                'key' => "{$row['fieldname']}={$row['name']}={$row['uitype']}",

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

                                return $row['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

                    /**

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

                     * @param array              $params

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

                                } catch (Exception $e) {

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

                        \App\Log::trace('End execute actions', 'MailScanner');

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

                    /**

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

                     * Manually scan mail.

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

                        if (empty($account['actions'])) {

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

                        \App\Log::beginProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');

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

                                        \App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

                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 array

                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 = [];

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

                        $query = (new App\Db\Query())->from('vtiger_field')

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

                        $dataReader->close();

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

                     * Return email search list.

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

                                $return[$row['conf_type']][$row['parameter']] = $row['value'];

                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 $type

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

                    public static function getUidFolder($accountId, $folder)

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

                            if ($folder === $row['folder']) {

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

                     * @return array

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

                    public static function executeActions($account, OSSMail_Mail_Model $mail, $folder, $params = false)

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

                        $mail->setFolder($folder);

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

                    }

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

                            if (!\in_array('CreatedEmail', $actions)) {

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

                                foreach (imap_search($mbox, 'ALL', SE_UID) as $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

                                    break;

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

                        return ['count' => $countEmails, 'break' => $break];

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

                                'name' => $row['name'],

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

                            $return = explode(',', $value);

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

                        $query->orderBy(['parameter' => SORT_DESC]);

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

                            if (false !== $confType) {

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

                     * @return string

                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

                                break;

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

                                break;

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

                        return $return;

                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

                            $handlerClass = Vtiger_Loader::getComponentClassName('ScannerAction', $action, 'OSSMailScanner');

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

                            $handler = new $handlerClass();

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

                            if ($handler) {

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

                        $mail->postProcess();

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

                     * @param int      $scan_id

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

                     *

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

                        $break = false;

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

                                \App\Log::endProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');

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

                    {

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

                            ->leftJoin('vtiger_tab', 'vtiger_tab.tabid = vtiger_field.tabid')

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

                        }

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

                        $dataReader = $query->createCommand()->query();

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

                                'tablename' => $row['tablename'],

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

                                'tabid' => $row['tabid'],

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

                        $value = (new \App\Db\Query())->select(['value'])->from('vtiger_ossmailscanner_config')

                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

                        } else {

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

                                $actions = explode(',', $account['actions']);

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

                     * Scan mailbox for emails.

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

                     * @throws \ReflectionException

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

                            if (0 === $lastScanUid) {

                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_ossmailscanner_folders_uid', ['uid' => $uid], ['user_id' => $account['user_id'], 'folder' => $folder])->execute();

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

                                    || $countEmails >= \App\Config::performance('NUMBERS_EMAILS_DOWNLOADED_DURING_ONE_SCANNING')) {

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

                     * @param string $module

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

                        return $return;

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

                            $params['actions'] = $actions;

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

                        $getEmails = false;

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

                                    $break = true;

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

                                'fieldlabel' => $row['fieldlabel'],

                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 = [];

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

                        return $return;

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

                     * @throws \yii\db\Exception

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

                                ++$countEmails;

                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[] = [

                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

                        $cacheKey = 'Mail';

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

                            ->scalar();

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

                        $return = self::executeActions($account, $mail, $folder, $params);

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

                     * @return array

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

                                        break;

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

                        } elseif ($msgno < $numMsg) {

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

                     * Return email search results.

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

                        if ($module) {

                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

                        if (null === $value || 'null' == $value) {

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

                            $return = $tab1;

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

                            }

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

                                if (\is_resource($mbox)) {

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

                        self::updateScanHistory($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);

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

                        $result = false;

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

                        if (!$mail) {

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

                            if (\is_string($account['actions'])) {

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

                                array_unshift($actions, 'CreatedEmail', );

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

                                        $msgno = imap_msgno($mbox, $uid);

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

                                        $getEmails = true;

                Line exceeds 120 characters; contains 157 characters
                Open

                                $dbCommand->update('vtiger_ossmailscanner_folders_uid', ['uid' => $uid], ['user_id' => $account['user_id'], 'folder' => $folder])->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

                    public static function getEmailSearch($module = false, $onlyMailUitype = true)

                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 static function setEmailSearchList($value)

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

                        return $return;

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

                        $scanId = $scannerModel->addScanHistory(['user' => $whoTrigger]);

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

                        }

                Line exceeds 120 characters; contains 123 characters
                Open

                        self::updateScanHistory($scanId, ['status' => '0', 'count' => $countEmails, 'action' => 'Action_CronMailScanner']);

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

                            $result = true;

                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 array    $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

                        $lastScanUid = self::getUidFolder($account['user_id'], $folder);

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

                        \App\Log::endProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');

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

                                $getEmails = true;

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

                            } elseif (imap_uid($mbox, $numMsg) > $lastScanUid) {

                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

                        }

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

                     *

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

                                'columnname' => $row['columnname'],

                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_ossmailscanner_config', ['value' => $value], ['conf_type' => 'emailsearch', 'parameter' => 'fields'])->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

                     *

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

                                        break 2;

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

                     * Function checks connection to mailbox.

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

                                $msgno = 1;

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

                            }

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

                        while ($row = $dataReader->read()) {

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

                                'fieldname' => $row['fieldname'],

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

                     * @return array

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

                        if (\App\Cache::staticHas($cacheKey, $cacheValue)) {

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

                            return \App\Cache::staticGet($cacheKey, $cacheValue);

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

                        if (!empty($value)) {

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

                    }

                Line exceeds 120 characters; contains 157 characters
                Open

                            $isExists = (new App\Db\Query())->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'emailsearch', 'parameter' => 'fields'])->exists();

                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 = $tab2;

                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 int $whoTrigger

                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\Log::info('There are no accounts to be scanned');

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

                                \App\Log::trace('Start checking folder: ' . $folder);

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

                     *

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

                                break;

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

                                break;

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

                    }

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

                                $actions = $account['actions'];

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

                    public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)

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

                        if ($getEmails) {

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

                                self::executeActions($account, $mail, $folder);

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

                                'value' => "{$row['fieldname']}={$row['name']}", // item to delete in next version

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

                        \App\Cache::staticSave($cacheKey, $cacheValue, $return);

                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

                    public static function getCron()

                Line exceeds 120 characters; contains 171 characters
                Open

                        return (new App\Db\Query())->select(['name', 'status', 'frequency'])->from('vtiger_cron_task')->where(['module' => 'OSSMailScanner'])->createCommand()->queryAll();

                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

                        return 'ok';

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

                            default:

                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 static function mergeArray($tab1, $tab2)

                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 bool|string

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

                        \App\Log::trace('Start executeCron');

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

                     * @param array $account

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

                    public function isConnection(array $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

                            $params['actions'] = ['CreatedEmail', 'BindAccounts', 'BindContacts', 'BindLeads'];

                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

                            $getEmails = true;

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

                                $mail = OSSMail_Record_Model::getMail($mbox, $uid, $i);

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

                        $query->orderBy('name');

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

                        return $return;

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

                    public static function getEmailSearchList()

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

                        $cacheValue = 'EmailSearchList';

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

                     * Set email search list.

                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

                            $return = array_unique(array_merge($tab1, $tab2));

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

                        $accounts = OSSMail_Record_Model::getAccountsList();

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

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

                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, false, [], $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

                     * @return bool

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

                    /**

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

                                break;

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

                        return $return;

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

                                $dbCommand->insert('vtiger_ossmailscanner_config', [

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

                                    'parameter' => 'fields',

                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

                        if (!self::isPermissionToScan($whoTrigger)) {

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

                        if (!$accounts) {

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

                            return false;

                Line exceeds 120 characters; contains 197 characters
                Open

                                $mbox = \OSSMail_Record_Model::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], $folder, false, [], $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

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

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

                            case 1:

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

                                $return = 'Manually stopped';

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

                     * Return scan history.

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

                     * @param array $tab1

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

                     * @param array $tab2

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

                        if (0 != \count($tab1) && 0 != \count($tab2)) {

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

                        } elseif (0 != \count($tab1)) {

                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

                            if (empty($account['actions']) || !$this->isConnection($account) || empty($folders = $scannerModel->getFolders($account['user_id']))) {

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

                                break;

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

                            case 2:

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

                            $isExists = (new App\Db\Query())->from('vtiger_ossmailscanner_config')->where(['conf_type' => 'emailsearch', 'parameter' => 'fields'])->exists();

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

                            } else {

                Line exceeds 120 characters; contains 156 characters
                Open

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

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

                        $countEmails = 0;

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

                            \App\Log::trace('Start checking account: ' . $account['username']);

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

                                    $scanSummary = $scannerModel->mailScan($mbox, $account, $folderRow['folder'], $scanId, $countEmails);

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

                                    $countEmails = $scanSummary['count'];

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

                        \App\Log::trace('End executeCron');

                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

                     * Return history status label.

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

                     * @return string

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

                     * @param int      $countEmails

                Line exceeds 120 characters; contains 151 characters
                Open

                            ->where(['and', ['uitype' => ($onlyMailUitype ? 13 : [13, 319])], ['<>', 'vtiger_field.presence', 1], ['<>', 'vtiger_tab.name', 'Users']]);

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

                            $query->andWhere(['vtiger_tab.name' => $module]);

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

                            ->where(['conf_type' => 'emailsearch', 'parameter' => 'fields'])

                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

                        } elseif (0 != \count($tab2)) {

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

                     */

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

                        }

                Line exceeds 120 characters; contains 172 characters
                Open

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

                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

                     * @param string   $folder      Character encoding UTF-8

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

                        \App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

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

                        if (0 === $msgno && 0 !== $numMsg) {

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

                                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

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

                            ++$msgno;

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

                                \App\Log::beginProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');

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

                                unset($mail);

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

                                if (!self::updateScanHistory($scan_id, ['status' => '1', 'count' => $countEmails, 'action' => 'Action_CronMailScanner'])

                Line exceeds 120 characters; contains 136 characters
                Open

                                if (!self::updateScanHistory($scan_id, ['status' => '1', 'count' => $countEmails, 'action' => 'Action_CronMailScanner'])

                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

                     */

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

                            if (!$isExists) {

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

                     * Merge arrays.

                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\Log::warning(\App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner'));

                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

                        if (\is_resource($mbox)) {

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

                     * @param int $id

                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

                                $return = 'OK';

                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

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

                Line exceeds 120 characters; contains 148 characters
                Open

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

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

                                    'conf_type' => 'emailsearch',

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

                     * The function returns information about OSSMailScanner Crons.

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

                     * @return array

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

                    public function executeCron($whoTrigger)

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

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

                Line exceeds 120 characters; contains 147 characters
                Open

                            if (empty($account['actions']) || !$this->isConnection($account) || empty($folders = $scannerModel->getFolders($account['user_id']))) {

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

                                continue;

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

                            foreach ($folders as $folderRow) {

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

                                    if ($scanSummary['break']) {

                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 getHistoryStatus($id)

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

                            case 0:

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

                                $return = 'In progress';

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

                     * @param string $value

                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

                     *

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

                            return \App\Language::translate('ERROR_ACTIVE_CRON', 'OSSMailScanner');

                Line exceeds 120 characters; contains 121 characters
                Open

                                    $scanSummary = $scannerModel->mailScan($mbox, $account, $folderRow['folder'], $scanId, $countEmails);

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

                                        \App\Log::info('Reached the maximum number of scanned mails');

                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

                        switch ($id) {

                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 !$result;

                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

                                    'value' => $value,

                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 (new App\Db\Query())->select(['name', 'status', 'frequency'])->from('vtiger_cron_task')->where(['module' => 'OSSMailScanner'])->createCommand()->queryAll();

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

                     * Execute cron task.

                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

                            }

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

                                'action' => $row['count'],

                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

                    public static function isActiveScan(?int $scanId = null): bool

                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 array

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

                    {

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

                            $output[] = [

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

                                'status' => self::getHistoryStatus($row['status']),

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

                                'count' => $row['count'],

                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

                     * Update scan history row.

                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

                     *

                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 array

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

                     */

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

                        $endNumber = $startNumber + $limit;

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

                        }

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

                     * @throws \yii\db\Exception

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

                     *

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

                        $db->createCommand()->insert('vtiger_ossmails_logs', ['status' => 1, 'user' => $array['user'], '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

                        if (!$result) {

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

                     * @param int|null $scanId

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

                     * @return bool

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

                    {

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

                        $where = ['status' => 1];

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

                        return (bool) \App\Db::getInstance()->createCommand()

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

                        return \vtlib\Cron::getInstance('LBL_MAIL_SCANNER_ACTION')->refreshData();

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

                        $output = [];

                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

                    public static function setActiveScan(string $whoTrigger, ?int $scanId = null): bool

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

                     * @param int $scanId

                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 int   $id

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

                    public static function updateScanHistory($id, $array): bool

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

                        return (bool) $result;

                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

                            $where['id'] = $scanId;

                Line exceeds 120 characters; contains 144 characters
                Open

                            ->update('vtiger_ossmails_logs', ['status' => 2, 'stop_user' => $whoTrigger, 'end_time' => date('Y-m-d H:i:s')], $where)->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

                    /**

                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 getScanHistory($startNumber = 0)

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

                        $limit = 30;

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

                            $startTime = new DateTimeField($row['start_time']);

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

                     * @return bool

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

                     */

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

                            $where['id'] = $scanId;

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

                     * @param string   $whoTrigger

                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

                     * @var array|bool

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

                    public function getUserList()

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

                                'stop_user' => $row['stop_user'],

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

                     * @param array $array

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

                        $result = $dbCommand->update('vtiger_ossmails_logs', ['end_time' => date('Y-m-d H:i:s'), 'status' => $array['status'], 'count' => $array['count'], 'action' => $array['action']],

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

                     */

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

                            $result = static::setActiveScan($whoTrigger);

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

                        $dataReader->close();

                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

                    public static function isPermissionToScan($whoTrigger = ''): bool

                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

                     * @param int $startNumber

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

                        while ($row = $dataReader->read()) {

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

                                'id' => $row['id'],

                Line exceeds 120 characters; contains 152 characters
                Open

                        $db->createCommand()->insert('vtiger_ossmails_logs', ['status' => 1, 'user' => $array['user'], 'start_time' => date('Y-m-d H:i:s')])->execute();

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

                            ['and', ['id' => $id], ['<>', 'status', 2]])->execute();

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

                     * @param mixed $whoTrigger

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

                    }

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

                            self::setActiveScan(\App\User::getCurrentUserModel()->getDetail('user_name'), $scanId);

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

                        $dataReader = (new App\Db\Query())->from('vtiger_ossmails_logs')->orderBy(['id' => SORT_DESC])->limit($endNumber)->offset($startNumber)->createCommand()->query();

                Line exceeds 120 characters; contains 170 characters
                Open

                        $dataReader = (new App\Db\Query())->from('vtiger_ossmails_logs')->orderBy(['id' => SORT_DESC])->limit($endNumber)->offset($startNumber)->createCommand()->query();

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

                     * Insert new scan history row.

                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 ($result && self::getCronTask()->hadTimeout()) {

                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

                     * Return active users list.

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

                                ])->execute();

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

                     * @return array

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

                     */

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

                        foreach ($accounts as $account) {

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

                                    \App\Log::error("Incorrect mail access data, username: {$account['username']} , folder: $folder , type: {$folderRow['type']} ,  Error: " . imap_last_error());

                Line exceeds 120 characters; contains 178 characters
                Open

                                    \App\Log::error("Incorrect mail access data, username: {$account['username']} , folder: $folder , type: {$folderRow['type']} ,  Error: " . imap_last_error());

                Line exceeds 120 characters; contains 184 characters
                Open

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

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

                        return $result;

                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

                            $endTime = new DateTimeField($row['end_time']);

                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 addScanHistory($array): int

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

                            $dbCommand->update('vtiger_ossmails_logs', ['count' => $array['count']], ['id' => $id])->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

                     * @param int|null $scanId

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

                        $where = ['status' => 1];

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

                        if ($scanId) {

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

                        return (new App\Db\Query())->select(['id'])->from('vtiger_ossmails_logs')->where($where)->exists();

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

                            ->update('vtiger_ossmails_logs', ['status' => 2, 'stop_user' => $whoTrigger, 'end_time' => date('Y-m-d H:i:s')], $where)->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

                                'user' => $row['user'],

                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

                     * State of scan action.

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

                    public static function runRestartCron(int $scanId)

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

                        if (self::isActiveScan($scanId)) {

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

                    protected $user = false;

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

                                'start_time' => $startTime->getDisplayDateTimeValue(),

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

                        return $output;

                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 array $array

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

                     * @return int

                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 $db->getLastInsertID('vtiger_ossmails_logs_id_seq');

                Line exceeds 120 characters; contains 185 characters
                Open

                        $result = $dbCommand->update('vtiger_ossmails_logs', ['end_time' => date('Y-m-d H:i:s'), 'status' => $array['status'], 'count' => $array['count'], 'action' => $array['action']],

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

                     * State of scan action.

                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

                     * Activate scan.

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

                    }

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

                     * Cron data.

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

                            if (self::getCronTask()->hadTimeout()) {

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

                            }

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

                     * Active users list.

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

                                'end_time' => $endTime->getDisplayDateTimeValue(),

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

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

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

                     *

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

                        $result = self::isActiveScan();

                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 bool

                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 \vtlib\Cron

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

                    public static function getCronTask()

                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

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

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

                                'info' => $row['info'],

                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

                        if ($scanId) {

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

                     * Restart cron.

                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

                                $handler->process($mail);

                Line exceeds 120 characters; contains 182 characters
                Open

                        $this->user = (new \App\Db\Query())->select(['id', 'user_name', 'first_name', 'last_name'])->from('vtiger_users')->where(['status' => 'Active'])->createCommand()->queryAll();

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

                     * @param int $id

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

                        $db->createCommand()->delete('roundcube_users', ['user_id' => $id])->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

                    /**

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

                            if ($handler) {

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

                     * Delete user email accounts.

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

                        $db->createCommand()->delete('vtiger_ossmailscanner_folders_uid', ['user_id' => $id])->execute();

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

                        $mail->set('to_email', $row['to_email']);

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

                        $mail->set('from_email', $row['from_email']);

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

                     * Groups list.

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

                        $actions = array_diff(explode(',', $row['actions']), ['CreatedEmail', 'CreatedHelpDesk']);

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

                            return false;

                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

                    protected $group = false;

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

                    public function getGroupList()

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

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

                     *

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

                        if ($this->user) {

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

                     * @param array $row

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

                     * @return bool

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

                            $handlerClass = Vtiger_Loader::getComponentClassName('ScannerAction', $action, 'OSSMailScanner');

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

                            $handler = new $handlerClass();

                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 static function accountDelete($id)

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

                        $mail->setFolder($row['mbox']);

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

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

                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

                        $mail->set('cc_email', $row['cc_email']);

                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

                    public function bindMail($row)

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

                        if (empty($row['actions'])) {

                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

                     * @var array

                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 groups list.

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

                        $mail->set('date', $row['date']);

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

                        foreach ($actions as $action) {

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

                     * @return array

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

                     * Assign data to model.

                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->user = (new \App\Db\Query())->select(['id', 'user_name', 'first_name', 'last_name'])->from('vtiger_users')->where(['status' => 'Active'])->createCommand()->queryAll();

                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

                        if (empty($actions)) {

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

                        $mail = new OSSMail_Mail_Model();

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

                        $mail->set('subject', $row['subject']);

                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 $this->group;

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

                            return false;

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

                        $mail->set('bcc_email', $row['bcc_email']);

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

                            return $this->user;

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

                        return $this->group = (new \App\Db\Query())->select(['groupid', 'groupname'])->from('vtiger_groups')->all();

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

                        $mail->setMailCrmId($row['ossmailviewid']);

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

                        $mail->set('reply_to_email', $row['reply_to_email']);

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

                        return $this->user;

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

                     *

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

                        if ($this->group) {

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

                        }

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

                        $mail->set('message_id', $row['uid']);

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

                        $mail->set('body', $row['content']);

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

                        }

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

                class OSSMailScanner_Record_Model extends Vtiger_Record_Model

                Expected 0 spaces before closing bracket; 1 found
                Open

                                array_unshift($actions, 'CreatedEmail', );

                Closing parenthesis of a multi-line function call must be on a line by itself
                Open

                            ['and', ['id' => $id], ['<>', 'status', 2]])->execute();

                Multi-line function call not indented correctly; expected 8 spaces but found 12
                Open

                            ['and', ['id' => $id], ['<>', 'status', 2]])->execute();

                Opening parenthesis of a multi-line function call must be the last content on the line
                Open

                        $result = $dbCommand->update('vtiger_ossmails_logs', ['end_time' => date('Y-m-d H:i:s'), 'status' => $array['status'], 'count' => $array['count'], 'action' => $array['action']],

                The variable $row_dir is not named in camelCase.
                Open

                    public static function getEmailActionsListName($data)
                    {
                        $return = [];
                        foreach ($data as $row) {
                            if ('files' == $row[0]) {

                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 $row_dir is not named in camelCase.
                Open

                    public static function getEmailActionsListName($data)
                    {
                        $return = [];
                        foreach ($data as $row) {
                            if ('files' == $row[0]) {

                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 $row_dir is not named in camelCase.
                Open

                    public static function getEmailActionsListName($data)
                    {
                        $return = [];
                        foreach ($data as $row) {
                            if ('files' == $row[0]) {

                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 $scan_id is not named in camelCase.
                Open

                    public static function mailScan($mbox, array $account, string $folder, int $scan_id, int $countEmails)
                    {
                        $break = false;
                        $lastScanUid = self::getUidFolder($account['user_id'], $folder);
                        \App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');

                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