YetiForceCompany/YetiForceCRM

View on GitHub
modules/OSSMail/models/Module.php

Summary

Maintainability
F
3 days
Test Coverage

getDefaultMailAccount accesses the super-global variable $_SESSION.
Open

    public static function getDefaultMailAccount($accounts)
    {
        return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);
    }
Severity: Minor
Found in modules/OSSMail/models/Module.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getDefaultMailAccount accesses the super-global variable $_SESSION.
Open

    public static function getDefaultMailAccount($accounts)
    {
        return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);
    }
Severity: Minor
Found in modules/OSSMail/models/Module.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

getDefaultMailAccount accesses the super-global variable $_SESSION.
Open

    public static function getDefaultMailAccount($accounts)
    {
        return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);
    }
Severity: Minor
Found in modules/OSSMail/models/Module.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

Function getComposeParam has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getComposeParam(App\Request $request)
    {
        $moduleName = $request->getByType('crmModule');
        $record = $request->getInteger('crmRecord');
        $type = $request->getByType('type');
Severity: Minor
Found in modules/OSSMail/models/Module.php - About 1 day 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 getExternalUrlForWidget has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
    {
        if (\is_object($record)) {
            $body = $record->get('content');
            $subject = $record->get('subject');
Severity: Minor
Found in modules/OSSMail/models/Module.php - About 5 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 getComposeParam has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getComposeParam(App\Request $request)
    {
        $moduleName = $request->getByType('crmModule');
        $record = $request->getInteger('crmRecord');
        $type = $request->getByType('type');
Severity: Major
Found in modules/OSSMail/models/Module.php - About 4 hrs to fix

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

    class OSSMail_Module_Model extends Vtiger_Module_Model
    {
        public function getDefaultViewName()
        {
            return 'Index';
    Severity: Minor
    Found in modules/OSSMail/models/Module.php by phpmd

    Method getExternalUrlForWidget has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
        {
            if (\is_object($record)) {
                $body = $record->get('content');
                $subject = $record->get('subject');
    Severity: Major
    Found in modules/OSSMail/models/Module.php - About 3 hrs to fix

      File Module.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * @copyright YetiForce S.A.
       * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
      Severity: Minor
      Found in modules/OSSMail/models/Module.php - About 2 hrs to fix

        Method getExternalUrl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
            {
                $url = 'mailto:';
                $request = new App\Request([]);
                if ($moduleName) {
        Severity: Minor
        Found in modules/OSSMail/models/Module.php - About 1 hr to fix

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

              public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
              {
                  $url = 'mailto:';
                  $request = new App\Request([]);
                  if ($moduleName) {
          Severity: Minor
          Found in modules/OSSMail/models/Module.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

          Consider simplifying this complex logical expression.
          Open

                  if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
                      $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
                      $eventHandler = new App\EventHandler();
                      $eventHandler->setRecordModel($recordModel)->setModuleName($moduleName)->setParams($return);
                      $eventHandler->trigger('MailComposeParamBefore');
          Severity: Major
          Found in modules/OSSMail/models/Module.php - About 40 mins to fix

            The method getComposeParam() has an NPath complexity of 49102848. The configured NPath complexity threshold is 200.
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

            The method getExternalUrlForWidget() has an NPath complexity of 480. The configured NPath complexity threshold is 200.
            Open

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
                {
                    if (\is_object($record)) {
                        $body = $record->get('content');
                        $subject = $record->get('subject');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

            The method getComposeParam() has 112 lines of code. Current threshold is set to 100. Avoid really long methods.
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            The method getExternalUrl() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
            Open

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
                {
                    $url = 'mailto:';
                    $request = new App\Request([]);
                    if ($moduleName) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            NPathComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
                {
                    $url = 'mailto:';
                    $request = new App\Request([]);
                    if ($moduleName) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 getComposeParam() has a Cyclomatic Complexity of 42. The configured cyclomatic complexity threshold is 10.
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 getExternalUrlForWidget() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
            Open

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
                {
                    if (\is_object($record)) {
                        $body = $record->get('content');
                        $subject = $record->get('subject');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            CyclomaticComplexity

            Since: 0.1

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

            Example

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

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

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

                public static function getComposeParam(App\Request $request)
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

            See

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

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

            See

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

            class OSSMail_Module_Model extends Vtiger_Module_Model
            {
                public function getDefaultViewName()
                {
                    return 'Index';
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 '73', column '24').
            Open

                        $eventHandler = new App\EventHandler();
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                public static function getComposeUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 '209', column '18').
            Open

                    $request = new App\Request([]);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getExternalUrl has a boolean flag argument $view, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getComposeUrl has a boolean flag argument $view, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getComposeUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getComposeUrl has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getComposeUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getComposeUrl has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getComposeUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getExternalUrl has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getExternalUrl has a boolean flag argument $record, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getExternalUrl has a boolean flag argument $type, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            The method getExternalUrlForWidget has a boolean flag argument $smoduleName, which is a certain sign of a Single Responsibility Principle violation.
            Open

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $config = (new \App\Db\Query())->select(['parameter', 'value'])->from('vtiger_ossmailscanner_config')
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    $purifier = new HTMLPurifier($config);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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\EmailParser' in method 'getComposeParam'.
            Open

                                $emailParser = \App\EmailParser::getInstanceByModel($recordModel);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Purifier' in method 'getExternalUrl'.
            Open

                        $url .= 'subject=' . \App\Purifier::encodeHtml($param['subject']) . '&';
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Settings_Vtiger_MenuItem_Model' in method 'getSettingLinks'.
            Open

                    if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail')) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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\Record' in method 'getComposeParam'.
            Open

                            if (($templateId = $request->getInteger('template', 0)) && \App\Record::isExists($templateId, 'EmailTemplates')) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                public function getSettingLinks(): array
                {
                    Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
                    $settingsLinks = [];
                    if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail')) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

            Avoid using static access to class 'OSSMailView_Record_Model' in method 'getComposeParam'.
            Open

                        $recordModel_OSSMailView = OSSMailView_Record_Model::getCleanInstance('OSSMailView');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                                $templateModel = \Vtiger_Record_Model::getInstanceById($templateId, 'EmailTemplates');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 '79', column '36').
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

            Avoid using static access to class '\App\Record' in method 'getComposeParam'.
            Open

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Privilege' in method 'getComposeParam'.
            Open

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 'Users_Record_Model' in method 'getComposeParam'.
            Open

                        $currentUser = Users_Record_Model::getCurrentUserModel();
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        if (!\in_array($moduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3)))) || 'Campaigns' === $moduleName) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Fields\File' in method 'getComposeParam'.
            Open

                                    $fileName = \App\Fields\File::sanitizeUploadFileName($recordModel->getName()) . '.ics';
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        if (!\in_array($moduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3)))) || 'Campaigns' === $moduleName) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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\TextParser' in method 'getComposeParam'.
            Open

                                $textParser = \App\TextParser::getInstanceByModel($recordModel);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $moduleConfig = App\Config::module($moduleName);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\Purifier' in method 'getExternalUrl'.
            Open

                        $url .= 'body=' . \App\Purifier::encodeHtml($param['body']) . '&';
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                                $filePath = \App\Config::main('tmp_dir');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 '107', column '10').
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

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

                        $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    } else {
                        $url = 'mailto:' . $from;
                        $subject = 'Re: ' . $subject;
                    }
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

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

                    } else {
                        $content .= \App\Language::translateArgs('LBL_MAIL_REPLY_INTRO', 'OSSMailView', $date, $from) . PHP_EOL;
                        foreach (explode(PHP_EOL, $body) as $line) {
                            $line = trim($line);
                            if (!empty($line)) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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\ModuleHierarchy' in method 'getExternalUrlForWidget'.
            Open

                        if (!\in_array($smoduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3))))) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 'HTMLPurifier_Config' in method 'getExternalUrlForWidget'.
            Open

                    $config = HTMLPurifier_Config::createDefault();
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    $mailtoLimit = \App\Config::component('Mail', 'MAILTO_LIMIT');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translate('Date', 'OSSMailView') . ': ' . $date . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translate('Subject', 'OSSMailView') . ': ' . $subject . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $recordModel = Vtiger_Record_Model::getInstanceById($srecord);
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translate('From', 'OSSMailView') . ': ' . $from . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    $config->set('Core.Encoding', \App\Config::main('default_charset'));
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        if (!\in_array($smoduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3))))) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translateArgs('LBL_MAIL_REPLY_INTRO', 'OSSMailView', $date, $from) . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                    } else {
                        $body = $record['bodyRaw'];
                        $subject = $record['subjectRaw'];
                        $from = $record['fromRaw'];
                        $to = $record['toRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translate('LBL_MAIL_FORWARD_INTRO', 'OSSMailView') . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

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

                        $content .= \App\Language::translate('To', 'OSSMailView') . ': ' . $to . PHP_EOL;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Define a constant instead of duplicating this literal "mailto:" 3 times.
            Open

                    $url = 'mailto:';
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "OSSMailView" 7 times.
            Open

                        $recordModel_OSSMailView = OSSMailView_Record_Model::getCleanInstance('OSSMailView');
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "&body=" 3 times.
            Open

                                if (\strlen($url . '&body=' . rawurlencode($content . $line)) > $mailtoLimit) {
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "AutoLoginUser" 3 times.
            Open

                    return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "subject" 8 times.
            Open

                                $subject = $textParser->setContent($templateModel->get('subject'))->parse()->getContent();
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "crmView" 3 times.
            Open

                    if (!$request->isEmpty('crmView')) {
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Suspicious array access to int
            Open

                        $subject = $record['subjectRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Suspicious array access to int
            Open

                        $to = $record['toRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Assigning array|array{popup:false|true} to property but \OSSMail_Module_Model::$composeParam is false
            Open

                        self::$composeParam = $config;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Call to method createDefault from undeclared class \HTMLPurifier_Config
            Open

                    $config = HTMLPurifier_Config::createDefault();
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Suspicious array access to int
            Open

                        $from = $record['fromRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Call to method getInstanceByModel from undeclared class \App\TextParser (Did you mean class \Tests\App\TextParser)
            Open

                                $textParser = \App\TextParser::getInstanceByModel($recordModel);
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Call to undeclared method \Vtiger_Record_Model::getICal
            Open

                                if (false !== file_put_contents($filePath, $recordModel->getICal())) {
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Suspicious array access to int
            Open

                        $date = $record['date'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Call to method __construct from undeclared class \HTMLPurifier
            Open

                    $purifier = new HTMLPurifier($config);
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

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

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Default value for string $smoduleName can't be false
            Open

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Static call to undeclared method \App\EmailParser::getInstanceByModel
            Open

                                $emailParser = \App\EmailParser::getInstanceByModel($recordModel);
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Default value for int $srecord can't be false
            Open

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Parameter $queryGenerator has undeclared type \App\QueryGenerator (Did you mean class \Tests\App\QueryGenerator)
            Open

                public function getModalRecordsListSourceFields(App\QueryGenerator $queryGenerator, Vtiger_Module_Model $baseModule, $popupFields)
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Suspicious array access to int
            Open

                        $cc = $record['ccRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

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

                        $config = (new \App\Db\Query())->select(['parameter', 'value'])->from('vtiger_ossmailscanner_config')
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

            Returning type false but getComposeParameters() is declared to return array
            Open

                    return self::$composeParam;
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Suspicious array access to int
            Open

                        $body = $record['bodyRaw'];
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phan

            Call to method purify from undeclared class \HTMLPurifier
            Open

                    $body = $purifier->purify($body);
            Severity: Critical
            Found in modules/OSSMail/models/Module.php by phan

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

                        foreach (explode(PHP_EOL, $body) as $line) {
                            $line = trim($line);
                            if (!empty($line)) {
                                $line = '> ' . $line . PHP_EOL;
                                if (\strlen($url . '&body=' . rawurlencode($content . $line)) > $mailtoLimit) {
            Severity: Major
            Found in modules/OSSMail/models/Module.php and 1 other location - About 1 hr to fix
            modules/OSSMail/models/Module.php on lines 322..331

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 103.

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

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

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

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

            Refactorings

            Further Reading

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

                        foreach (explode(PHP_EOL, $body) as $line) {
                            $line = trim($line);
                            if (!empty($line)) {
                                $line = '> ' . $line . PHP_EOL;
                                if (\strlen($url . '&body=' . rawurlencode($content . $line)) > $mailtoLimit) {
            Severity: Major
            Found in modules/OSSMail/models/Module.php and 1 other location - About 1 hr to fix
            modules/OSSMail/models/Module.php on lines 310..319

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 103.

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

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

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

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

            Refactorings

            Further Reading

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

                public function getSettingLinks(): array
                {
                    Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');
                    $settingsLinks = [];
                    if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('Mail')) {
            Severity: Minor
            Found in modules/OSSMail/models/Module.php and 1 other location - About 45 mins to fix
            modules/OSSMailScanner/models/Module.php on lines 24..37

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 95.

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

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

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

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

            Refactorings

            Further Reading

            Avoid excessively long variable names like $recordModel_OSSMailView. Keep variable name length under 20.
            Open

                        $recordModel_OSSMailView = OSSMailView_Record_Model::getCleanInstance('OSSMailView');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            LongVariable

            Since: 0.2

            Detects when a field, formal or local variable is declared with a long name.

            Example

            class Something {
                protected $reallyLongIntName = -3; // VIOLATION - Field
                public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                    $otherReallyLongName = -5; // VIOLATION - Local
                    for ($interestingIntIndex = 0; // VIOLATION - For
                         $interestingIntIndex < 10;
                         $interestingIntIndex++ ) {
                    }
                }
            }

            Source https://phpmd.org/rules/naming.html#longvariable

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

            class OSSMail_Module_Model extends Vtiger_Module_Model

            The class OSSMail_Module_Model is not named in CamelCase.
            Open

            class OSSMail_Module_Model extends Vtiger_Module_Model
            {
                public function getDefaultViewName()
                {
                    return 'Index';
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 $cc. Configured minimum length is 3.
            Open

                        $cc = $record->get('cc_email');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 $to. Configured minimum length is 3.
            Open

                        $to = $record->get('to_email');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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

            Expected 0 spaces before closing bracket; 1 found
            Open

                                if ('Calendar' === $moduleName && !$recordModel->isEmpty('meeting_url') && !\array_key_exists('meetingUrl', $params) ) {

            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

                    $url = 'index.php?module=OSSMail&view=Compose';

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

                {

            Line exceeds 120 characters; contains 152 characters
            Open

                            'linkurl' => 'index.php?module=OSSMail&parent=Settings&view=Index&block=' . $menu->get('blockid') . '&fieldid=' . $menu->get('fieldid'),

            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 mixed $record

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

                            'linklabel' => 'LBL_MODULE_CONFIGURATION',

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

                    return 'Index';

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

                            'linktype' => 'LISTVIEWSETTING',

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

                    }

            Line exceeds 120 characters; contains 170 characters
            Open

                    return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);

            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 getSettingLinks(): array

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

                 * @param mixed $view

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

                            $return['to'] = $email;

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

                            if (!empty($recordNumber)) {

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

                                $textParser = \App\TextParser::getInstanceByModel($recordModel);

            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 (!$request->isEmpty('mid') && !empty($type)) {

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

                    if (!$request->isEmpty('emails')) {

            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

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

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

                public function getDefaultViewName()

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

                    if ($menu = Settings_Vtiger_MenuItem_Model::getInstance('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

                public static function getComposeUrl($moduleName = false, $record = false, $view = false, $type = false): string

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

                        $url .= '&crmModule=' . $moduleName;

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

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {

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

                            if ($content) {

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

                                if ($fromEmailDetails) {

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

                 * @return string

            Line exceeds 120 characters; contains 186 characters
            Open

                        if (!\in_array($moduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3)))) || 'Campaigns' === $moduleName) {

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

                                $return['body'] = $textParser->setContent($templateModel->get('content'))->parse()->getContent();

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

                            }

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

                        $eventHandler->trigger('MailComposeParamAfter');

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

                        $return['type'] = $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

                    if (!$request->isEmpty('subject')) {

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

                    return $settingsLinks;

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

                 * URL generation for internal mail clients.

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

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

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

                                $emailParser->emailoptout = false;

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

                                $return['title'] = $recordModel->getName();

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

                                $filePath = \App\Config::main('tmp_dir');

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

                                if (false !== file_put_contents($filePath, $recordModel->getICal())) {

            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['crmrecord'] = $record;

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

                        $moduleConfig = App\Config::module($moduleName);

            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

                    Vtiger_Loader::includeOnce('~~modules/com_vtiger_workflow/VTWorkflowUtils.php');

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

                        $url .= '&crmView=' . $view;

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

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

                    $type = $request->getByType('type');

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

                                if (isset($return[$name])) {

            Line exceeds 120 characters; contains 130 characters
            Open

                            if (($templateId = $request->getInteger('template', 0)) && \App\Record::isExists($templateId, 'EmailTemplates')) {

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

                                $params = $request->getArray('templateParams', \App\Purifier::TEXT, [], App\Purifier::ALNUM);

            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['to'] = $request->get('to');

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

                        $return['subject'] = $request->get('subject');

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

                    return self::$composeParam;

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

                public static function getDefaultMailAccount($accounts)

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

                    return (isset($_SESSION['AutoLoginUser']) && \array_key_exists($_SESSION['AutoLoginUser'], $accounts)) ? $accounts[$_SESSION['AutoLoginUser']] : reset($accounts);

            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['filePath'] = [['path' => $filePath, 'name' => $fileName]];

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

                            ->where(['conf_type' => 'email_list'])->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

                 *

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

                    $settingsLinks = [];

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

                        $settingsLinks[] = [

            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 mixed $moduleName

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

                    if ($moduleName) {

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

                    if ($record) {

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

                                $subject .= $recordModel->getName();

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

                            $recordNumber = $recordModel->getRecordNumber();

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

                                foreach ($params as $key => $value) {

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

                    if (!empty($moduleName)) {

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

                        $return['bcc'] = implode(',', $request->get('emails'));

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

                protected static $composeParam = false;

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

                 * @param mixed $moduleName

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

                            'linkurl' => 'index.php?module=OSSMail&parent=Settings&view=Index&block=' . $menu->get('blockid') . '&fieldid=' . $menu->get('fieldid'),

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

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

            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

                    $moduleName = $request->getByType('crmModule');

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

                    $record = $request->getInteger('crmRecord');

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

                        $eventHandler = new App\EventHandler();

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

                                $emailParser = \App\EmailParser::getInstanceByModel($recordModel);

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

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

                            if ('Calendar' === $moduleName && $request->getBoolean('ics')) {

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

                        $return = $eventHandler->getParams();

            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 ($moduleConfig && isset($moduleConfig['SEND_IDENTITY'][$currentUser->get('roleid')])) {

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

                    if (!$request->isEmpty('to')) {

            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

                    $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

                            if ('new' === $type || 'Campaigns' === $moduleName) {

            Line exceeds 120 characters; contains 140 characters
            Open

                                if ('Calendar' === $moduleName && !$recordModel->isEmpty('meeting_url') && !\array_key_exists('meetingUrl', $params) ) {

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

                                $tmpFileName = tempnam($filePath, 'ics');

            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::$composeParam = $config;

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

                 * @param mixed $view

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

                /** {@inheritdoc} */

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

                 * @param mixed $type

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

                        $url .= '&crmRecord=' . $record;

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

                                $subject = "[$recordNumber] $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

                                $templateModel = \Vtiger_Record_Model::getInstanceById($templateId, 'EmailTemplates');

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

                    if (!empty($record)) {

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

                        $currentUser = Users_Record_Model::getCurrentUserModel();

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

                            $return['from'] = $moduleConfig['SEND_IDENTITY'][$currentUser->get('roleid')];

            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 (!$request->isEmpty('bcc')) {

            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

                                if ('Calendar' === $moduleName && !$recordModel->isEmpty('meeting_url') && !\array_key_exists('meetingUrl', $params) ) {

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

                    if ($view) {

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

                }

            Line exceeds 120 characters; contains 238 characters
            Open

                    if (('Users' === $moduleName && $record === \App\User::getCurrentUserRealId()) || ('Users' !== $moduleName && !empty($record) && \App\Record::isExists($record) && \App\Privilege::isPermitted($moduleName, 'DetailView', $record))) {

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

                        $eventHandler->trigger('MailComposeParamBefore');

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

                            $subject = '';

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

                            if (($templateId = $request->getInteger('template', 0)) && \App\Record::isExists($templateId, 'EmailTemplates')) {

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

                            $return['subject'] = $subject;

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

                        $return['crmview'] = $request->getByType('crmView');

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

                    if (!empty($moduleName)) {

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

                                    $textParser->setParam('meetingUrl', $recordModel->get('meeting_url'));

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

                                $subject = $textParser->setContent($templateModel->get('subject'))->parse()->getContent();

            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 (!$request->isEmpty('pdf_path')) {

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

                        $return['filePath'] = $request->get('pdf_path');

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

                    if (!$request->isEmpty('cc')) {

            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

                        $recordModel = Vtiger_Record_Model::getInstanceById($record, $moduleName);

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

                        if ($request->isEmpty('to') && ($email = $recordModel_OSSMailView->findEmail($record, $moduleName))) {

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

                                    $return[substr($name, -2)] = $fromEmailDetails;

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

                                    $textParser->setParam($key, $value);

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

                                    $fileName = \App\Fields\File::sanitizeUploadFileName($recordModel->getName()) . '.ics';

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

                        $return['mailId'] = (int) $request->getInteger('mid');

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

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

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

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

                public static function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false)

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

                        $recordModel = Vtiger_Record_Model::getInstanceById($srecord);

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

                        $url .= '&type=' . $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

                        foreach (['_to', '_cc'] as $name) {

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

                                $fromEmailDetails = $emailParser->setContent($content)->parse()->getContent();

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

                                $return['html'] = true;

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

                        $eventHandler->setParams($return);

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

                        $return['crmmodule'] = $moduleName;

            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 mixed $record

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

                        $request->set('crmRecord', $record);

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

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

                        $url .= '&cc=' . $cc;

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

                    $purifier = new HTMLPurifier($config);

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

                        $content .= \App\Language::translate('Date', 'OSSMailView') . ': ' . $date . PHP_EOL;

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

                            if (!empty($line)) {

            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 getModalRecordsListSourceFields(App\QueryGenerator $queryGenerator, Vtiger_Module_Model $baseModule, $popupFields)

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

                {

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

                    $url = 'mailto:';

            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

                 * @param string $smoduleName

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

                        $to = $record->get('to_email');

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

                    if ('replyAll' == $type && !empty($cc)) {

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

                        $content .= \App\Language::translate('LBL_MAIL_FORWARD_INTRO', 'OSSMailView') . PHP_EOL;

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

                    }

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

                        $body = $record->get('content');

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

                    if (!empty($srecord) && !empty($smoduleName)) {

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

                    $url .= '?subject=' . $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

                                $line = '> ' . $line . PHP_EOL;

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

                    }

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

                        $popupFields[$item->getName()] = $item->getName();

            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 (isset($param['subject'])) {

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

                        $from = $record['fromRaw'];

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

                                if (\strlen($url . '&body=' . rawurlencode($content . $line)) > $mailtoLimit) {

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

                    }

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

                    $url .= '?';

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

                 */

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

                        $to = $record['toRaw'];

            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 ('forward' == $type) {

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

                        foreach (explode(PHP_EOL, $body) as $line) {

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

                    return $url . '&body=' . rawurlencode($content);

            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

                        $url .= 'body=' . \App\Purifier::encodeHtml($param['body']) . '&';

            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_object($record)) {

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

                    }

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

                        $subject = 'Fwd: ' . $subject;

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

                            $line = trim($line);

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

                                if (\strlen($url . '&body=' . rawurlencode($content . $line)) > $mailtoLimit) {

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

                                $content .= $line;

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

                        $request->set('crmModule', $moduleName);

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

                    if (isset($param['body'])) {

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

                    return $url;

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

                {

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

                        $subject = $record->get('subject');

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

                        if (!\in_array($smoduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3))))) {

            Line exceeds 120 characters; contains 212 characters
            Open

                    $body = str_replace(['<p> </p>', '<p></p>', '</p>', '<br />', '<p>', '<div>', '</div>', PHP_EOL . PHP_EOL, PHP_EOL . PHP_EOL], ['', '', PHP_EOL, PHP_EOL, '', '', PHP_EOL, PHP_EOL, PHP_EOL], nl2br($body));

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

                                }

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

                                $content .= $line;

            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 (isset($param['to'])) {

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

                        $subject = $record['subjectRaw'];

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

                        $moduleModel = $recordModel->getModule();

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

                        $url = 'mailto:';

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

                    $config = HTMLPurifier_Config::createDefault();

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

                    $body = str_replace(['<p> </p>', '<p></p>', '</p>', '<br />', '<p>', '<div>', '</div>', PHP_EOL . PHP_EOL, PHP_EOL . PHP_EOL], ['', '', PHP_EOL, PHP_EOL, '', '', PHP_EOL, PHP_EOL, PHP_EOL], nl2br($body));

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

                        foreach (explode(PHP_EOL, $body) as $line) {

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

                    if ($type) {

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

                public static function getComposeParam(App\Request $request)

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

                        $return = $eventHandler->getParams();

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

                                    unset($return[$name]);

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

                        if (!\in_array($moduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3)))) || 'Campaigns' === $moduleName) {

            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 (!$request->isEmpty('crmView')) {

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

                        $return['cc'] = $request->get('cc');

            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::$composeParam) {

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

                        $config['popup'] = '_blank' == $config['target'] ? true : false;

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

                 * URL generation for external mail clients.

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

                {

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

                    $request = new App\Request([]);

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

                    if ($view) {

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

                 * Get mail url for widget.

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

                        $from = $record->get('from_email');

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

                    $config->set('Core.Encoding', \App\Config::main('default_charset'));

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

                    $config->set('HTML.AllowedElements', 'div,p,br');

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

                    $body = $purifier->purify($body);

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

                    $mailtoLimit = \App\Config::component('Mail', 'MAILTO_LIMIT');

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

                    if ('forward' == $type) {

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

                        $content .= \App\Language::translate('Subject', 'OSSMailView') . ': ' . $subject . PHP_EOL;

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

                        $content .= \App\Language::translateArgs('LBL_MAIL_REPLY_INTRO', 'OSSMailView', $date, $from) . PHP_EOL;

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

                        $eventHandler->setRecordModel($recordModel)->setModuleName($moduleName)->setParams($return);

            Line exceeds 120 characters; contains 134 characters
            Open

                public function getModalRecordsListSourceFields(App\QueryGenerator $queryGenerator, Vtiger_Module_Model $baseModule, $popupFields)

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

                            $content = $request->has($name) ? $request->getRaw($name) : ($return[$name] ?? '');

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

                                $filePath .= basename($tmpFileName);

            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['bcc'] = $request->get('bcc');

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

                    }

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

                 * Function get compose parameters.

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

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

                        $subject = 'Re: ' . $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

                    include_once 'vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php';

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

                    if ($record) {

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

                    $param = self::getComposeParam($request);

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

                        }

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

                        $cc = $record->get('cc_email');

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

                        $cc = $record['ccRaw'];

            Line exceeds 120 characters; contains 156 characters
            Open

                        if (!\in_array($smoduleName, array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(0), \App\ModuleHierarchy::getModulesByLevel(3))))) {

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

                                $subject = "[$fieldName] $subject";

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

                    $config->set('CSS.AllowTricky', false);

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

                                $line = '> ' . $line . PHP_EOL;

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

                public static function getExternalUrl($moduleName = false, $record = false, $view = false, $type = false): string

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

                        $request->set('crmView', $view);

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

                            $url .= $value . '=' . str_replace(',', ';', $param[$value]) . '&';

            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

                    $config->set('Cache.SerializerPath', ROOT_DIRECTORY . '/cache/vtlib');

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

                            if (!empty($line)) {

            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

                        $request->set('type', $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

                        $url .= str_replace(',', ';', $param['to']);

            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

                            $fieldName = $moduleModel->getSequenceNumberFieldName();

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

                            }

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

                    $config->set('HTML.AllowedAttributes', '');

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

                    $content = '';

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

                    return $popupFields;

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

                    }

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

                        $date = $record->get('date');

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

                        $url = 'mailto:' . $from;

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

                        $content .= \App\Language::translate('From', 'OSSMailView') . ': ' . $from . PHP_EOL;

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

                        $content .= \App\Language::translate('To', 'OSSMailView') . ': ' . $to . PHP_EOL;

            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

                /** {@inheritdoc} */

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

                    foreach ($baseModule->getFieldsByType('email') as $item) {

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

                    if ($type) {

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

                    foreach (['cc', 'bcc'] as $value) {

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

                        if (isset($param[$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

                        $url .= 'subject=' . \App\Purifier::encodeHtml($param['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

                        $body = $record['bodyRaw'];

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

                        $date = $record['date'];

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

                            $line = trim($line);

            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

                            }

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

            class OSSMail_Module_Model extends Vtiger_Module_Model

            The variable $recordModel_OSSMailView is not named in camelCase.
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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 $recordModel_OSSMailView is not named in camelCase.
            Open

                public static function getComposeParam(App\Request $request)
                {
                    $moduleName = $request->getByType('crmModule');
                    $record = $request->getInteger('crmRecord');
                    $type = $request->getByType('type');
            Severity: Minor
            Found in modules/OSSMail/models/Module.php by phpmd

            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