YetiForceCompany/YetiForceCRM

View on GitHub
app/Layout.php

Summary

Maintainability
A
3 hrs
Test Coverage
D
68%

Method truncateHtml has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
    {
        if (empty($html)) {
            return '';
        }
Severity: Minor
Found in app/Layout.php - About 1 hr to fix

    Function truncateHtml has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
        {
            if (empty($html)) {
                return '';
            }
    Severity: Minor
    Found in app/Layout.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
        {
            if (empty($html)) {
                return '';
            }
    Severity: Minor
    Found in app/Layout.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

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

            $layoutsPath[''] = '';
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

                $layoutsPath['custom/'] = 'custom/';
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

                $layoutsPath["custom/{$basePrefix}"] = "custom/{$basePrefix}";
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

            return $layoutsPath;
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

            $layoutsPath[$defaultPrefix] = $defaultPrefix;
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

            $layoutsPath[$basePrefix] = $basePrefix;
    Severity: Minor
    Found in app/Layout.php by phpmd

    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 '$layoutsPath' which will lead to PHP notices.
    Open

                $layoutsPath["custom/{$defaultPrefix}"] = "custom/{$defaultPrefix}";
    Severity: Minor
    Found in app/Layout.php by phpmd

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

        public static function truncateText(string $text, int $length, bool $showIcon = false, bool $nl2br = false): string
    Severity: Minor
    Found in app/Layout.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 '84', column '15').
    Open

            $all = (new \App\Db\Query())->select(['name', 'label'])->from('vtiger_layout')->all();
    Severity: Minor
    Found in app/Layout.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 truncateHtml has a boolean flag argument $showBtn, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
    Severity: Minor
    Found in app/Layout.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 getPublicUrl has a boolean flag argument $full, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getPublicUrl($name, $full = false)
    Severity: Minor
    Found in app/Layout.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 truncateText has a boolean flag argument $showIcon, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function truncateText(string $text, int $length, bool $showIcon = false, bool $nl2br = false): string
    Severity: Minor
    Found in app/Layout.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

    Avoid using static access to class 'App\Language' in method 'truncateText'.
    Open

                $btn = Language::translate('LBL_MORE_BTN');
    Severity: Minor
    Found in app/Layout.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\TextUtils' in method 'truncateHtml'.
    Open

                    $teaser = TextUtils::textTruncate(trim(strip_tags($html)), $length);
    Severity: Minor
    Found in app/Layout.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\TextUtils' in method 'truncateHtml'.
    Open

                    $teaser = TextUtils::htmlTruncateByWords(str_replace('<br>', '', $teaserBefore), $length);
    Severity: Minor
    Found in app/Layout.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\Session' in method 'getActiveLayout'.
    Open

                return Session::get('layout');
    Severity: Minor
    Found in app/Layout.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 'getAllLayouts'.
    Open

                $folders[$row['name']] = Language::translate($row['label']);
    Severity: Minor
    Found in app/Layout.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 'getActiveLayout'.
    Open

            return \App\Config::main('defaultLayout');
    Severity: Minor
    Found in app/Layout.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_Viewer' in method 'getLayoutFile'.
    Open

            $basePath = 'layouts' . '/' . \Vtiger_Viewer::getDefaultLayoutName() . '/';
    Severity: Minor
    Found in app/Layout.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 'getLayoutPaths'.
    Open

            if (\App\Config::performance('LOAD_CUSTOM_FILES')) {
    Severity: Minor
    Found in app/Layout.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 truncateText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $btn = Language::translate('LBL_MORE_BTN');
            }
    Severity: Minor
    Found in app/Layout.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\Session' in method 'getActiveLayout'.
    Open

            if (Session::has('layout')) {
    Severity: Minor
    Found in app/Layout.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 'getPublicUrl'.
    Open

                $basePath .= \App\Config::main('site_URL');
    Severity: Minor
    Found in app/Layout.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 'truncateText'.
    Open

            $teaser = Purifier::encodeHtml(TextUtils::textTruncate($text, $length));
    Severity: Minor
    Found in app/Layout.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\TextUtils' in method 'truncateText'.
    Open

            $teaser = Purifier::encodeHtml(TextUtils::textTruncate($text, $length));
    Severity: Minor
    Found in app/Layout.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 'truncateText'.
    Open

            $text = Purifier::encodeHtml($text);
    Severity: Minor
    Found in app/Layout.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 'truncateHtml'.
    Open

                $popoverText = \App\Language::translate($popoverText);
    Severity: Minor
    Found in app/Layout.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 truncateHtml uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $content = "<div class=\"js-more-content\">{$teaser}<div class=\"w-100 {$iframeClass} fullContent\" style=\"{$css}\">{$html}</div>";
            }
    Severity: Minor
    Found in app/Layout.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 'getAllLayouts'.
    Open

                'basic' => Language::translate('LBL_DEFAULT'),
    Severity: Minor
    Found in app/Layout.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_Viewer' in method 'getLayoutPaths'.
    Open

            $defaultPrefix = 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . \DIRECTORY_SEPARATOR;
    Severity: Minor
    Found in app/Layout.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 'truncateHtml'.
    Open

                $html = Purifier::encodeHtml($html);
    Severity: Minor
    Found in app/Layout.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 'getLayoutFile'.
    Open

            $basePath = 'layouts' . '/' . \App\Config::main('defaultLayout') . '/';
    Severity: Minor
    Found in app/Layout.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_Theme' in method 'getImagePath'.
    Open

            return \Vtiger_Theme::getImagePath($imageName);
    Severity: Minor
    Found in app/Layout.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 'getLayoutFile'.
    Open

            $filePath = \Vtiger_Loader::resolveNameToPath('~' . $basePath . $name);
    Severity: Minor
    Found in app/Layout.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 "public_html/" 3 times.
    Open

                    $basePath = 'public_html/' . $basePath;
    Severity: Critical
    Found in app/Layout.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.

    Returning type false|string but getImagePath() is declared to return array
    Open

            return \Vtiger_Theme::getImagePath($imageName);
    Severity: Minor
    Found in app/Layout.php by phan

    Argument 2 (length) is ?int but \App\TextUtils::textTruncate() takes bool|false|int defined at /code/app/TextUtils.php:40
    Open

                    $teaser = TextUtils::textTruncate(trim(strip_tags($html)), $length);
    Severity: Minor
    Found in app/Layout.php by phan

    Doc-block of $html in truncateHtml is phpdoc param type string which is not a permitted replacement of the nullable param type ?string declared in the signature ('?T' should be documented as 'T|null' or '?T')
    Open

         * @param string $html
    Severity: Minor
    Found in app/Layout.php by phan

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

            $all = (new \App\Db\Query())->select(['name', 'label'])->from('vtiger_layout')->all();
    Severity: Critical
    Found in app/Layout.php by phan

    Doc-block of $size in truncateHtml is phpdoc param type string which is not a permitted replacement of the nullable param type ?string declared in the signature ('?T' should be documented as 'T|null' or '?T')
    Open

         * @param string $size
    Severity: Minor
    Found in app/Layout.php by phan

    Doc-block of $length in truncateHtml is phpdoc param type int which is not a permitted replacement of the nullable param type ?int declared in the signature ('?T' should be documented as 'T|null' or '?T')
    Open

         * @param int    $length
    Severity: Minor
    Found in app/Layout.php by phan

    Argument 2 (length) is ?int but \App\TextUtils::htmlTruncateByWords() takes int defined at /code/app/TextUtils.php:67
    Open

                    $teaser = TextUtils::htmlTruncateByWords(str_replace('<br>', '', $teaserBefore), $length);
    Severity: Minor
    Found in app/Layout.php by phan

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

                $layoutsPath['custom/'] = 'custom/';
    Severity: Info
    Found in app/Layout.php by phan

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $layoutsPath[$basePrefix] = $basePrefix;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getAllLayouts()
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $all = (new \App\Db\Query())->select(['name', 'label'])->from('vtiger_layout')->all();
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            foreach ($all as $row) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return $folders;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (!IS_PUBLIC_DIR) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Gets layout paths.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $basePrefix = 'layouts/' . self::getActiveLayout() . \DIRECTORY_SEPARATOR;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $filePath = \Vtiger_Loader::resolveNameToPath('~' . $basePath . $name);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (\App\Config::performance('LOAD_CUSTOM_FILES')) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string[]
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                return $basePath . $name;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            ];
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param bool   $full
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (Session::has('layout')) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getLayoutFile($name)
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (is_file($filePath)) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $defaultPrefix = 'layouts/' . \Vtiger_Viewer::getDefaultLayoutName() . \DIRECTORY_SEPARATOR;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $layoutsPath["custom/{$basePrefix}"] = "custom/{$basePrefix}";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getPublicUrl($name, $full = false)
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $basePath = '';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $basePath .= \App\Config::main('site_URL');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $basePath .= 'public_html/';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getLayoutPaths(): array
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Get all layouts list.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Get file from layout.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                if (!IS_PUBLIC_DIR) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $basePath = 'public_html/' . $basePath;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $name
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if ($full) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * The function get path  to the image.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (!IS_PUBLIC_DIR) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getActiveLayout()
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $basePath = 'layouts' . '/' . \App\Config::main('defaultLayout') . '/';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $basePath = 'public_html/' . $basePath;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $imageName
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                return Session::get('layout');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $name
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $layoutsPath[$defaultPrefix] = $defaultPrefix;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return $layoutsPath;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                'basic' => Language::translate('LBL_DEFAULT'),
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $layoutsPath[''] = '';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Get active layout name.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $layoutsPath['custom/'] = 'custom/';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Get public url from file.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return $basePath . $name;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $folders = [
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $folders[$row['name']] = Language::translate($row['label']);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return $basePath . $name;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return \App\Config::main('defaultLayout');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $basePath = 'layouts' . '/' . \Vtiger_Viewer::getDefaultLayoutName() . '/';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return array
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $layoutsPath["custom/{$defaultPrefix}"] = "custom/{$defaultPrefix}";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return file_exists(\Vtiger_Viewer::$completeTemplatePath);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $btn = Language::translate('LBL_MORE_BTN');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $css = 'display: none;';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                default:
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Truncating plain text and adding a button showing all the text.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param bool   $showIcon
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $btnTemplate = function (string $popoverText = '', ?string $btnClass = '', string $data = 'data-iframe="true"'): string {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                case 'full':
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if ($iframe) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $moduleName
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $teaser = $css = $btn = '';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    if (false === $showBtn && $teaserBefore == $teaser) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                        $html = $btn = '';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 144 characters
    Open

                $content = "<div class=\"js-more-content\">{$teaser}<div class=\"w-100 {$iframeClass} fullContent\" style=\"{$css}\">{$html}</div>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $btn = '<span class="mdi mdi-overscan"></span>';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $popoverText = \App\Language::translate($popoverText);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            switch ($size) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $btn = $btnTemplate('LBL_FULLSCREEN', 'c-btn-floating-right-bottom btn btn-primary');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Function takes a template path.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getTemplatePath(string $templateName, string $moduleName = ''): string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function truncateText(string $text, int $length, bool $showIcon = false, bool $nl2br = false): string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                return "<a href=\"#\" class=\"js-more noLinkBtn font-weight-lighter js-popover-tooltip ml-2 {$btnClass}\" {$data} data-content=\"{$popoverText}\"><span class=\"mdi mdi-overscan\"></span></a>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $btn = $btnTemplate('LBL_SHOW_ORIGINAL_CONTENT');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $teaser = TextUtils::htmlTruncateByWords(str_replace('<br>', '', $teaserBefore), $length);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return bool
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return "<div class=\"js-more-content c-text-divider\"><pre class=\"teaserContent u-pre\">$teaser</pre><span class=\"fullContent d-none\"><pre class=\"u-pre\">$text</pre></span><span class=\"text-right\"><button type=\"button\" class=\"btn btn-link btn-sm p-0 js-more\">{$btn}</button></span></div>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $iframe = false;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function checkTemplatePath(string $templateName, string $moduleName = ''): bool
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (\mb_strlen($text) < $length) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $html
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return \Vtiger_Theme::getImagePath($imageName);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return \Vtiger_Viewer::getInstance()->getTemplatePath($templateName, $moduleName);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Get unique id for HTML ids.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getUniqueId($name = '')
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param int    $length
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $loadData = false;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 283 characters
    Open

                $content = "<div class=\"js-iframe-content\">{$teaser}<iframe sandbox=\"allow-same-origin allow-popups allow-popups-to-escape-sandbox\" class=\"w-100 {$iframeClass}\" frameborder=\"0\" style=\"{$css}\" " . ($loadData ? 'srcdoc' : 'srcdoctemp') . "=\"{$html}\"></iframe>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $templateName
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $size
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param int    $length
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 126 characters
    Open

        public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            };
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                case 'mini':
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $css = 'display: none;';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $html = Purifier::encodeHtml($html);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $content = "<div class=\"js-iframe-content\">{$teaser}<iframe sandbox=\"allow-same-origin allow-popups allow-popups-to-escape-sandbox\" class=\"w-100 {$iframeClass}\" frameborder=\"0\" style=\"{$css}\" " . ($loadData ? 'srcdoc' : 'srcdoctemp') . "=\"{$html}\"></iframe>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Check if template exists.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         */
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                case 'medium':
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                $content = "<div class=\"js-more-content\">{$teaser}<div class=\"w-100 {$iframeClass} fullContent\" style=\"{$css}\">{$html}</div>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        /**
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            self::getTemplatePath($templateName, $moduleName);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                return '';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $loadData = $iframe = true;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $teaser = TextUtils::textTruncate(trim(strip_tags($html)), $length);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                case 'miniHtml':
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $btn = $btnTemplate('LBL_SHOW_ORIGINAL_CONTENT', '', 'data-modal-size="modal-md"');
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $templateName
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return str_replace([' ', '"', "'"], '', $name) . random_int(100, 99999);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $text
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $teaser = Purifier::encodeHtml(TextUtils::textTruncate($text, $length));
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 307 characters
    Open

            return "<div class=\"js-more-content c-text-divider\"><pre class=\"teaserContent u-pre\">$teaser</pre><span class=\"fullContent d-none\"><pre class=\"u-pre\">$text</pre></span><span class=\"text-right\"><button type=\"button\" class=\"btn btn-link btn-sm p-0 js-more\">{$btn}</button></span></div>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * Truncating HTML and adding a button showing all the text.
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param mixed  $showBtn
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if (empty($html)) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $iframeClass = 'modal-iframe js-modal-iframe';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            return $content . $btn . '</div>';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $name
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param bool   $nl2br
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            if ($showIcon) {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function truncateHtml(?string $html, ?string $size = 'medium', ?int $length = 200, $showBtn = false): string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 204 characters
    Open

                return "<a href=\"#\" class=\"js-more noLinkBtn font-weight-lighter js-popover-tooltip ml-2 {$btnClass}\" {$data} data-content=\"{$popoverText}\"><span class=\"mdi mdi-overscan\"></span></a>";
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $iframeClass = 'js-iframe-full-height';
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    break;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

        public static function getImagePath($imageName)
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @param string $moduleName
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         *
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                return $nl2br ? nl2br($text) : $text;
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            $text = Purifier::encodeHtml($text);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

         * @return string
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    Line exceeds 120 characters; contains 129 characters
    Open

            $btnTemplate = function (string $popoverText = '', ?string $btnClass = '', string $data = 'data-iframe="true"'): string {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

                    $teaserBefore = str_replace('<br>', '', $html);
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in app/Layout.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status