YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Mail/models/Record.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
0%

Function getDisplayValue has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDisplayValue(string $key)
    {
        $value = $this->get($key);
        switch ($key) {
            case 'smtp_id':
Severity: Minor
Found in modules/Settings/Mail/models/Record.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method getDisplayValue has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getDisplayValue(string $key)
    {
        $value = $this->get($key);
        switch ($key) {
            case 'smtp_id':
Severity: Major
Found in modules/Settings/Mail/models/Record.php - About 2 hrs to fix

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

        public function getDisplayValueForEmail($emails)
        {
            $value = '';
            if ($emails) {
                foreach (\App\Json::decode($emails) as $email => $name) {
    Severity: Minor
    Found in modules/Settings/Mail/models/Record.php - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        public function getDisplayValue(string $key)
        {
            $value = $this->get($key);
            switch ($key) {
                case 'smtp_id':

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public function getDisplayValue(string $key)

    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

    Avoid using undefined variables such as '$statuses' which will lead to PHP notices.
    Open

                        $value = \App\Language::translate(\App\Mailer::$statuses[$value], 'Settings::Mail');

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

    Avoid using undefined variables such as '$statuses' which will lead to PHP notices.
    Open

                    if (isset(\App\Mailer::$statuses[$value])) {

    UndefinedVariable

    Since: 2.8.0

    Detects when a variable is used that has not been defined before.

    Example

    class Foo
    {
        private function bar()
        {
            // $message is undefined
            echo $message;
        }
    }

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

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

    class Settings_Mail_Record_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Function to get the Id.
         *

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

            $query = (new \App\Db\Query())->from('s_#__mail_queue')->where(['id' => $id]);

    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\Db' in method 'getInstance'.
    Open

            $row = $query->createCommand(\App\Db::getInstance('admin'))->queryOne();

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

                    } else {
                        $value .= $name . ' &lt;' . $email . '&gt;, ';
                    }

    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\Layout' in method 'getDisplayValue'.
    Open

                     $value = \App\Layout::truncateHtml($value, 'mini', 30);

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

                    $value = \App\Purifier::encodeHtml($value);

    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\Mail' in method 'getDisplayValue'.
    Open

                            $attachments = array_merge($attachments, \App\Mail::getAttachmentsFromDocument($attachments['ids']));

    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\Mail' in method 'getDisplayValue'.
    Open

    }

    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 'DateTimeField' in method 'getDisplayValue'.
    Open

                    $value = DateTimeField::convertToUserFormat($value);

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

                                $name = \App\Language::translate('LBL_FILE');

    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_Link_Model' in method 'getRecordLinks'.
    Open

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

    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\Json' in method 'getDisplayValueForEmail'.
    Open

                foreach (\App\Json::decode($emails) as $email => $name) {

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class 'vtlib\Functions' in method 'getDisplayValue'.
    Open

                    $value = \App\Layout::truncateHtml(vtlib\Functions::getHtmlOrPlainText($value), 'full');

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

                        $value = \App\Language::translate(\App\Mailer::$statuses[$value], 'Settings::Mail');

    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\Owner' in method 'getDisplayValue'.
    Open

                    $value = \App\Fields\Owner::getUserLabel($value);

    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\Layout' in method 'getDisplayValue'.
    Open

                    $value = \App\Layout::truncateHtml(vtlib\Functions::getHtmlOrPlainText($value), 'full');

    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\Json' in method 'getDisplayValue'.
    Open

                        $attachments = \App\Json::decode($value);

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

            $menu = Settings_Vtiger_MenuItem_Model::getInstance('LBL_EMAILS_TO_SEND');

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

                case 'status':

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

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

    Noncompliant Code Example

    With the default threshold of 3:

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

    Compliant Solution

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

    Exceptions

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

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

            $query = (new \App\Db\Query())->from('s_#__mail_queue')->where(['id' => $id]);
    Severity: Critical
    Found in modules/Settings/Mail/models/Record.php by phan

    Return type of getInstance() is undeclared type \self
    Open

        public static function getInstance($id)

    Variable $recordLinks was undeclared, but array fields are being added to it.
    Open

                $recordLinks[] = [

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

            return \App\Db::getInstance('admin')->createCommand()
    Severity: Critical
    Found in modules/Settings/Mail/models/Record.php by phan

    Argument 1 (encodedValue) is array but \App\Json::decode() takes string defined at /code/app/Json.php:37
    Open

                foreach (\App\Json::decode($emails) as $email => $name) {

    Call to method getUserLabel from undeclared class \App\Fields\Owner
    Open

                    $value = \App\Fields\Owner::getUserLabel($value);
    Severity: Critical
    Found in modules/Settings/Mail/models/Record.php by phan

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

        public static function getInstance($id)
        {
            $query = (new \App\Db\Query())->from('s_#__mail_queue')->where(['id' => $id]);
            $row = $query->createCommand(\App\Db::getInstance('admin'))->queryOne();
            $instance = false;
    Severity: Major
    Found in modules/Settings/Mail/models/Record.php and 1 other location - About 1 hr to fix
    app/Mail/Rbl.php on lines 220..230

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

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

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

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

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

    Refactorings

    Further Reading

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

    class Settings_Mail_Record_Model extends Settings_Vtiger_Record_Model

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

        public static function getInstance($id)

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    The class Settings_Mail_Record_Model is not named in CamelCase.
    Open

    class Settings_Mail_Record_Model extends Settings_Vtiger_Record_Model
    {
        /**
         * Function to get the Id.
         *

    CamelCaseClassName

    Since: 0.2

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

    Example

    class class_name {
    }

    Source

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

         *

    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 to get the Id.

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

        /**

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

         * Function to get the Name.

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

        {

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

        {

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

    Line exceeds 120 characters; contains 182 characters
    Open

                            $value = '<span class="fas fa-exclamation-triangle js-popover-tooltip color-red-a200" data-content="' . $this->get('error') . '">&nbsp;' . $value . '</span>';

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

                        }

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

                case 'bcc':

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

                            ++$fileCounter;

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

                ];

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

         * @return int Id

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

         */

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

                    $smtpName = \App\Mail::getSmtpById($value)['name'] ?? '';

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

                    if (isset(\App\Mailer::$statuses[$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

                    if ($value) {

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

                        foreach ($attachments as $path => $name) {

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

                     $value = \App\Layout::truncateHtml($value, 'mini', 30);

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

        /**

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

                }

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

        public function getRecordLinks(): array

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

                    'linkicon' => 'fas fa-check',

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

        /**

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

         *

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

        public function getId()

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

            return $this->get('id');

    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

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

         *

    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

                        if (2 === (int) $this->get('status')) {

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

                case 'from':

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

                            $attachments = array_merge($attachments, \App\Mail::getAttachmentsFromDocument($attachments['ids']));

    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

            $links = [];

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

                'linklabel' => 'LBL_DELETE_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

            $menu = Settings_Vtiger_MenuItem_Model::getInstance('LBL_EMAILS_TO_SEND');

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

                case 'cc':

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

                        $attachments = \App\Json::decode($value);

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

                default:

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

                        $email = $name;

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

         *

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

         */

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

        public function getDisplayValue(string $key)

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

                case 'owner':

    Line exceeds 120 characters; contains 125 characters
    Open

                            $attachments = array_merge($attachments, \App\Mail::getAttachmentsFromDocument($attachments['ids']));

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

                    if (is_numeric($email)) {

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

            }

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

         *

    Line exceeds 120 characters; contains 133 characters
    Open

                    $value = '<a href=index.php?module=MailSmtp&parent=Settings&view=Detail&record=' . $value . '>' . $smtpName . '</a>';

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

                    break;

    Line exceeds 120 characters; contains 145 characters
    Open

                            $actionPath = "?module=Mail&parent=Settings&action=DownloadAttachment&record={$this->getId()}&selectedFile=$fileCounter";

    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 string

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

                        $value .= $name . ' &lt;' . $email . '&gt;, ';

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

        public function delete(): bool

    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

                'linkurl' => "javascript:Settings_Vtiger_List_Js.deleteById('{$this->getId()}')",

    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

                    $value = DateTimeField::convertToUserFormat($value);

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

                        $fileCounter = 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

                        $name = '';

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

        }

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

                $recordLinks[] = [

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

                    'linktype' => 'LISTVIEWRECORD',

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

            $recordLinks[] = [

    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 URL

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

            return 'index.php?module=Mail&parent=Settings&action=SaveAjax&mode=acceptanceRecord&record=' . $this->getId();

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

                                $path = $name;

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

                                $name = \App\Language::translate('LBL_FILE');

    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 rtrim($value, ', ');

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

         * Function to delete the current Record Model.

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

        {

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

            if (0 === $this->get('status')) {

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

            $row = $query->createCommand(\App\Db::getInstance('admin'))->queryOne();

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

        public function getDetailViewUrl()

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

                    $value = '<a href=index.php?module=MailSmtp&parent=Settings&view=Detail&record=' . $value . '>' . $smtpName . '</a>';

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

                case 'to':

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

                case 'attachments':

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

                            if (is_numeric($path)) {

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

                            $value .= '<form action="' . $actionPath . '"

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

        public function getDisplayValueForEmail($emails)

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

         * @param int $id

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

        {

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

            return $instance;

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

         * Function to get the Acceptance Action 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

         * @return string URL

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

         */

    Line exceeds 120 characters; contains 130 characters
    Open

            return 'index.php?module=Mail&parent=Settings&view=Detail&record=' . $this->getId() . '&fieldid=' . $menu->get('fieldid');

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

            $value = $this->get($key);

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

                case 'smtp_id':

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

                    $value = $this->getDisplayValueForEmail($value);

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

         * @param array $emails

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

         * @return bool

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

                ->execute();

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

        }

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

                    'linkclass' => 'btn btn-xs btn-success acceptanceRecord',

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

            return $links;

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

         *

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

                case 'status':

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

                        $value = \App\Language::translate(\App\Mailer::$statuses[$value], 'Settings::Mail');

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

                        if (isset($attachments['ids'])) {

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

                            unset($attachments['ids']);

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

         * Function to get the display value for emails.

    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

                    'linkurl' => '#',

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

            }

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

        /**

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

         */

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

        {

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

        /**

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

         * Function to get the Display Value, for the current field type with given DB Insert Value.

    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

                        $value = '';

    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

                foreach (\App\Json::decode($emails) as $email => $name) {

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

                'linkclass' => 'btn btn-xs btn-danger text-white',

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

            foreach ($recordLinks as &$recordLink) {

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

         * Function to get the instance of advanced permission record model.

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

                            $value = '<span class="fas fa-exclamation-triangle js-popover-tooltip color-red-a200" data-content="' . $this->get('error') . '">&nbsp;' . $value . '</span>';

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

                case 'content':

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

                    $value = \App\Layout::truncateHtml(vtlib\Functions::getHtmlOrPlainText($value), 'full');

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

                    break;

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

                        }

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

                    $value = \App\Purifier::encodeHtml($value);

    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

                ->delete('s_#__mail_queue', ['id' => $this->getId()])

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

         *

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

                $instance = new self();

    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

         * Function to get the Detail Url.

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

            return 'index.php?module=Mail&parent=Settings&view=Detail&record=' . $this->getId() . '&fieldid=' . $menu->get('fieldid');

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

         * @param string $key

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

                    break;

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

                case 'error':

    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

                'linktype' => 'LISTVIEWRECORD',

    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 (false !== $row) {

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

            $query = (new \App\Db\Query())->from('s_#__mail_queue')->where(['id' => $id]);

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

            return $this->get('name');

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

        {

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

                    break;

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

                case 'date':

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

                    break;

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

                        }

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

                    }

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

            return \App\Db::getInstance('admin')->createCommand()

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

        }

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

            switch ($key) {

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

                    $value = \App\Fields\Owner::getUserLabel($value);

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

                            $actionPath = "?module=Mail&parent=Settings&action=DownloadAttachment&record={$this->getId()}&selectedFile=$fileCounter";

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

                    break;

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

            return $value;

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

            $value = '';

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

            if ($emails) {

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

                        $value .= $email . ', ';

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

        {

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

                    'linklabel' => 'LBL_ACCEPTANCE_RECORD',

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

                'linkicon' => 'fas fa-trash-alt',

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

            ];

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

                $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);

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

                $instance->setData($row);

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

         * @return \self instance, if exists

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

            $instance = false;

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

        public static function getInstance($id)

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

    class Settings_Mail_Record_Model extends Settings_Vtiger_Record_Model

    There are no issues that match your filters.

    Category
    Status