YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/PDF.php

Summary

Maintainability
C
1 day
Test Coverage
F
56%

Vtiger_PDF_Model has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class Vtiger_PDF_Model extends \App\Base
{
    /**
     * Template type standard.
     *
Severity: Minor
Found in modules/Vtiger/models/PDF.php - About 3 hrs to fix

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

    class Vtiger_PDF_Model extends \App\Base
    {
        /**
         * Template type standard.
         *
    Severity: Minor
    Found in modules/Vtiger/models/PDF.php by phpmd

    File PDF.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Basic PDF Model Class.
     *
    Severity: Minor
    Found in modules/Vtiger/models/PDF.php - About 2 hrs to fix

      Method checkUserPermissions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function checkUserPermissions()
          {
              $permissions = $this->get('template_members');
              if (empty($permissions)) {
                  return true;
      Severity: Minor
      Found in modules/Vtiger/models/PDF.php - About 1 hr to fix

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

            public function checkUserPermissions()
            {
                $permissions = $this->get('template_members');
                if (empty($permissions)) {
                    return true;
        Severity: Minor
        Found in modules/Vtiger/models/PDF.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

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

            public function getParser()
            {
                if (!isset($this->textParser)) {
                    if (isset($this->variables['recordId'])) {
                        $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
        Severity: Minor
        Found in modules/Vtiger/models/PDF.php - About 35 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

            public function getFieldFilterValueType($fieldname)
            {
                $conditions = $this->get('conditions');
                if (!empty($conditions) && \is_array($conditions)) {
                    foreach ($conditions as $filter) {
        Severity: Minor
        Found in modules/Vtiger/models/PDF.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

        Avoid too many return statements within this method.
        Open

                        return true;
        Severity: Major
        Found in modules/Vtiger/models/PDF.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return false;
          Severity: Major
          Found in modules/Vtiger/models/PDF.php - About 30 mins to fix

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

                public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
                {
                    if (!\App\Record::isExists($recordId)) {
                        return [];
                    }
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php - About 25 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Class "Vtiger_PDF_Model" has 29 methods, which is greater than 20 authorized. Split it into smaller classes.
            Open

            class Vtiger_PDF_Model extends \App\Base
            Severity: Major
            Found in modules/Vtiger/models/PDF.php by sonar-php

            A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

            Reduce the number of returns of this function 6, down to the maximum allowed 3.
            Open

                public function checkUserPermissions()
            Severity: Major
            Found in modules/Vtiger/models/PDF.php by sonar-php

            Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

            Noncompliant Code Example

            With the default threshold of 3:

            function myFunction(){ // Noncompliant as there are 4 return statements
              if (condition1) {
                return true;
              } else {
                if (condition2) {
                  return false;
                } else {
                  return true;
                }
              }
              return false;
            }
            

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

            class Vtiger_PDF_Model extends \App\Base
            {
                /**
                 * Template type standard.
                 *
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            CouplingBetweenObjects

            Since: 1.1.0

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

            Example

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

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

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

                public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 '267', column '16').
            Open

                        $row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

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

                        $conditionStrategy = new VTJsonCondition();
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

            Missing class import via use statement (line '240', column '22').
            Open

                    $dataReader = (new \App\Db\Query())->from(self::$baseTable)
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            MissingImport

            Since: 2.7.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Module_Model' in method 'getModule'.
            Open

                    return Vtiger_Module_Model::getInstance($this->get('module_name'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'checkFiltersForRecord'.
            Open

                        return \App\Cache::staticGet(__METHOD__, $key);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Json' in method 'checkFiltersForRecord'.
            Open

                    $test = \App\Json::isEmpty($this->getRaw('conditions'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Zip' in method 'zipAndDownload'.
            Open

                    $zip = \App\Zip::createFile($zipPath);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 'getName'.
            Open

                    return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'checkFiltersForRecord'.
            Open

                    if (\App\Cache::staticHas(__METHOD__, $key)) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 getParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                        } else {
                            $this->textParser = \App\TextParser::getInstance($this->get('module_name'));
                        }
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'getInstanceById'.
            Open

                        $pdf = \App\Cache::get($cache, $recordId);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\TextParser' in method 'getParser'.
            Open

                            $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $moduleName = \App\Record::getType($recordId);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'getInstanceById'.
            Open

                    if (\App\Cache::has($cache, $recordId)) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 getParameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $parameters['margin-top'] = '';
                        $parameters['margin-right'] = '';
                        $parameters['margin-bottom'] = '';
                        $parameters['margin-left'] = '';
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 assigning values to variables in if clauses and the like (line '112', column '33').
            Open

                public function get($key)
                {
                    if ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {
                        return json_decode($value, true);
                    }
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            IfStatementAssignment

            Since: 2.7.0

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

            Example

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

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

            Avoid using static access to class 'Vtiger_Loader' in method 'getTemplatesByModule'.
            Open

                        $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $moduleName);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 getInstanceById uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

                    } else {
                        $row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
                        if ($row) {
                            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);
                            $pdf = new $handlerClass();
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Record' in method 'getActiveTemplatesForRecord'.
            Open

                    if (!\App\Record::isExists($recordId)) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'getInstanceById'.
            Open

                        \App\Cache::save($cache, $recordId, $pdf);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                    return \App\Fields\File::createTempFile($prefix, 'pdf');
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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\Cache' in method 'checkFiltersForRecord'.
            Open

                    \App\Cache::staticSave(__METHOD__, $key, $test);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class '\App\TextParser' in method 'getParser'.
            Open

                            $this->textParser = \App\TextParser::getInstance($this->get('module_name'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 'getName'.
            Open

                    return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 'getInstanceById'.
            Open

                            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 'checkFiltersForRecord'.
            Open

                        Vtiger_Loader::includeOnce('~/modules/com_vtiger_workflow/VTJsonCondition.php');
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

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

                        $recordModel = Vtiger_Record_Model::getInstanceById($recordId);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            StaticAccess

            Since: 1.4.0

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

            Example

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

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

            Avoid using static access to class 'Users_Record_Model' in method 'checkUserPermissions'.
            Open

                    $currentUser = Users_Record_Model::getCurrentUserModel();
            Severity: Minor
            Found in modules/Vtiger/models/PDF.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 "recordId" 3 times.
            Open

                        if (isset($this->variables['recordId'])) {
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "module_name" 6 times.
            Open

                    return Vtiger_Module_Model::getInstance($this->get('module_name'));
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

            Define a constant instead of duplicating this literal "conditions" 5 times.
            Open

                    if ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by sonar-php

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

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

            Noncompliant Code Example

            With the default threshold of 3:

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

            Compliant Solution

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

            Exceptions

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

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

                    $parameters['page_format'] = $this->get('page_format');
            Severity: Critical
            Found in modules/Vtiger/models/PDF.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.

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

                            $this->textParser = \App\TextParser::getInstance($this->get('module_name'));
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                        $this->textParser->setParams(['pdf' => $this]);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

                public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Argument 2 (key) is int but \App\Cache::get() takes string defined at /code/app/Cache.php:61
            Open

                        $pdf = \App\Cache::get($cache, $recordId);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                    return $this->textParser;
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                            $this->textParser->setLanguage($this->get('language'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

                            $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

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

                    return $str ? $this->getParser()->setContent($str)->parse()->getContent() : '';
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                            $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                        $this->textParser->setType('pdf');
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Argument 1 (moduleName) is ?string but \Vtiger_PDF_Model::getTemplatesByModule() takes string defined at /code/modules/Vtiger/models/PDF.php:238
            Open

                    $templates = $this->getTemplatesByModule($moduleName);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

                        $row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Argument 1 (condition) is string but \VTJsonCondition::evaluate() takes array defined at /code/modules/com_vtiger_workflow/VTJsonCondition.php:22
            Open

                        $test = $conditionStrategy->evaluate($conditions, $recordModel);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

                        $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Argument 2 (key) is int but \App\Cache::save() takes string defined at /code/app/Cache.php:89
            Open

                        \App\Cache::save($cache, $recordId, $pdf);
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                    if (!isset($this->textParser)) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                        $this->textParser = null;
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                        $this->textParser = $this->getParser();
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Saw unextractable annotation for comment '* @return <number> - Record Id'</number>
            Open

                 * @return <Number> - Record Id
            Severity: Info
            Found in modules/Vtiger/models/PDF.php by phan

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

                    $dataReader = (new \App\Db\Query())->from(self::$baseTable)
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                        $this->textParser->useExtension = true;
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

                    \App\Db::getInstance()->createCommand()
            Severity: Critical
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                            $this->textParser = \App\TextParser::getInstance($this->get('module_name'));
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Reference to undeclared property \Vtiger_PDF_Model->textParser
            Open

                    } elseif (($this->variables['recordId'] ?? null) !== $this->textParser->record) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Argument 2 (key) is int but \App\Cache::has() takes string defined at /code/app/Cache.php:74
            Open

                    if (\App\Cache::has($cache, $recordId)) {
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Returning type false but getFieldFilterValueType() is declared to return string
            Open

                    return false;
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

            Return type of getParser() is undeclared type \App\TextParser (Did you mean class \Tests\App\TextParser)
            Open

                public function getParser()
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phan

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

            class Vtiger_PDF_Model extends \App\Base

            The class Vtiger_PDF_Model is not named in CamelCase.
            Open

            class Vtiger_PDF_Model extends \App\Base
            {
                /**
                 * Template type standard.
                 *
            Severity: Minor
            Found in modules/Vtiger/models/PDF.php by phpmd

            CamelCaseClassName

            Since: 0.2

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

            Example

            class class_name {
            }

            Source

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

                /**

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

                 * Template type dynamic.

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

                 */

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

                /**

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

                protected $variables = [];

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

                 * @return <Number> - Record Id

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

                    return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));

            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

                public static $baseTable = 'a_yf_pdf';

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

                public function getWatermarkType()

            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 parent::get($key);

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

                 *

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

                {

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

                 */

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

                 * @param string $moduleName - name of the module

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

                 */

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

                public const TEMPLATE_TYPE_STANDARD = 0;

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

                 * Fuction to get the Name of the 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

                 * @return mixed

            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 mixed

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

                /**

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

                 * @var string

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

                 */

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

                 * Table index.

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

                 */

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

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

            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

                 * @param mixed  $value

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

                    $this->variables[$key] = $value;

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

                public function getVariable(string $key)

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

                 *

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

                 * @var int

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

                 *

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

                 * View to picklist assignment array.

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

                 */

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

                 * @return bool true or false

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

                public function checkActiveTemplates($recordId, $moduleName, $view)

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

                 * @var array

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

                 */

            Line exceeds 120 characters; contains 134 characters
            Open

                protected $viewToPicklistValue = ['Detail' => 'PLL_DETAILVIEW', 'List' => 'PLL_LISTVIEW', 'RelatedList' => 'PLL_RELATEDLISTVIEW'];

            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

                 * Sets custom variable.

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

                 * Gets custom variable.

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

                {

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

                 * Table name.

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

                 * @var string

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

                /**

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

                 *

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

                 * @var array

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

                 * Function to get the id of the record.

            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

                 * Variables.

            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

                 * Custom columns.

            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

                 * @var bool

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

                    return Vtiger_Module_Model::getInstance($this->get('module_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 setVariable(string $key, $value)

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

                }

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

                /**

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

                 * @param int    $recordId   - id of a record

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

                 * Template type summary.

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

                 * @var int

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

                /**

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

                 *

            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 - Entity Name of the record

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

                 *  Return key value.

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

                /**

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

                    return $this;

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

                 * @return false|object

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

                    $templates = $this->getActiveTemplatesForRecord($recordId, $view, $moduleName);

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

                public const TEMPLATE_TYPE_DYNAMIC = 2;

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

                /**

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

                    return [0 => 'PLL_TEXT', 1 => 'PLL_IMAGE'];

            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 ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {

            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

                /**

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

                 * @var int

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

                 *

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

                }

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

                 */

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

                 *

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

                public static $baseIndex = 'pdfid';

            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

                 * @return $this

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

                }

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

                 * Template type standard.

            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 const TEMPLATE_TYPE_SUMMARY = 1;

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

                 *

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

                 * @return array

            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

                }

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

                 * Return raw key value.

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

                 * Return module instance or false.

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

                public function getModule()

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

                 * Check if pdf templates are avauble for this record, user and view.

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

                 *

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

                 */

            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 watermark type.

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

                public function get($key)

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

                        return json_decode($value, true);

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

                 * @return mixed

            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 getRaw($key)

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

                 *

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

                /**

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

                {

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

                        return [];

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

                        if (!$template->isVisible($view) || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {

            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

                    $conditions = $this->get('conditions');

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

                        ], [self::$baseIndex => $this->getId()])

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

                public function checkFiltersForRecord($recordId)

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

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

                    $templates = $this->getTemplatesByModule($moduleName);

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

                    $templates = [];

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

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

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

                public static function getInstanceById(int $recordId)

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

                 *

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

                 * @return bool

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

                /**

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

                 * Function to check filters for record.

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

                    $key = $this->getId() . '_' . $recordId;

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

                    return $templates;

            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

                        $row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();

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

                            $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);

            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 getFieldFilterValueType($fieldname)

            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

                    $test = \App\Json::isEmpty($this->getRaw('conditions'));

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

                        return true;

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

                 * @param int    $recordId

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

                 * @param string $moduleName

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

                 * @param string $view

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

                 *

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

                public static function getTemplatesByModule($moduleName)

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

                {

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

                        if ($row) {

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

                {

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

                    $dataReader = (new \App\Db\Query())->from(self::$baseTable)

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

                        ->where(['module_name' => $moduleName, 'status' => 1])

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

                        $pdf = new $handlerClass();

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

                 * @param int $recordId

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

                    if (\App\Cache::has($cache, $recordId)) {

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

                 * @param mixed $fieldname

            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

                protected $viewToPicklistValue = ['Detail' => 'PLL_DETAILVIEW', 'List' => 'PLL_LISTVIEW', 'RelatedList' => 'PLL_RELATEDLISTVIEW'];

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

                public static $customColumns = false;

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

                    $displayName = $this->get('primary_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

                 * @param string $moduleName

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

                 */

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

                    if (!\App\Record::isExists($recordId)) {

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

                        $moduleName = \App\Record::getType($recordId);

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

                    return $templates;

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

                 * @param string $moduleName - module name for which template was created

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

                            $pdf->setData($row);

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

                        $templates[$pdf->getId()] = $pdf;

            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 $pdf ? clone $pdf : $pdf;

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

                        $pdf = \App\Cache::get($cache, $recordId);

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

                        foreach ($conditions as $filter) {

            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 $filter['valuetype'];

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

                public function deleteConditions()

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

                 * Check if is visible for provided view.

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

                 *

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

                    return \in_array($this->viewToPicklistValue[$view], $visibility);

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

                    }

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

                /**

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

                 * @return array

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

                        }

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

                 * Get PDF instance by 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

                        \App\Cache::save($cache, $recordId, $pdf);

            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

                            'conditions' => '',

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

                    if (!$moduleName) {

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

                /**

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

                 * Returns template records by module name.

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

                 * @return bool|Vtiger_PDF_Model

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

                    } else {

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

                }

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

                /**

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

                 *

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

                 */

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

                 */

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

                {

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

                 */

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

                    return parent::get($key);

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

                 *

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

                    return $this->variables[$key] ?? null;

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

                 * @param string $view       - modules view - Detail or List

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

                {

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

                            unset($templates[$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

                    $templates = $this->getTemplatesByModule($moduleName);

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

                /**

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

                /**

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

                 */

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

                /**

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

                 *

            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

                 * Return available templates for 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

                public function getActiveTemplatesForModule($moduleName, $view)

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

                            unset($templates[$id]);

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

                 * @return array of template record models

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

                    return $templates;

            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 ($fieldname == $filter['fieldname']) {

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

                    return false;

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

                {

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

                    $visibility = explode(',', $this->get('visibility'));

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

                 * @param int $recordId

            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 getActiveTemplatesForRecord($recordId, $view, $moduleName = false)

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

                    }

            Line exceeds 120 characters; contains 133 characters
            Open

                        if (!$template->isVisible($view) || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {

            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 available templates for module.

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

                        ->createCommand()->query();

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

                    }

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

                }

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

                }

            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

                    foreach ($templates as $id => &$template) {

            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 (!$template->isVisible($view) || !$template->checkUserPermissions()) {

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

                    }

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

                        $handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $moduleName);

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

                    $cache = __CLASS__;

            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 returns valuetype of the field filter.

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

                    if (!empty($conditions) && \is_array($conditions)) {

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

                    if (\count($templates) > 0) {

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

                 */

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

                        }

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

                }

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

                            $pdf = new $handlerClass();

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

                        }

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

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

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

                        ->update(self::$baseTable, [

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

                public function isVisible($view)

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

                    }

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

                    foreach ($templates as $id => $template) {

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

                 */

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

                        $pdf->setData($row);

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

                    $pdf = false;

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

                 */

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

                 * @param string $view

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

                 */

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

                 */

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

                    if (\App\Cache::staticHas(__METHOD__, $key)) {

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

                 *

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

                 * @param string $view

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

                 *

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

                 *

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

                 * @return array

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

                 * Remove conditions for current record.

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

                        return \App\Cache::staticGet(__METHOD__, $key);

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

                        $conditionStrategy = new VTJsonCondition();

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

                {

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

                        return true;

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

                        $getTypes[$valueType[0]][] = $valueType[1];

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

                    $parameters['header_height'] = $this->get('header_height');

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

                        $parameters['margin-right'] = $this->get('margin_right');

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

                        $parameters['margin-right'] = '';

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

                 * Get page orientation.

            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

                        $groups = array_intersect($getTypes['Groups'], $currentUser->getGroups());

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

                    // metadata

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

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

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

                /**

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

                            $this->textParser = \App\TextParser::getInstance($this->get('module_name'));

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

                        if ($this->get('language')) {

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

                    }

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

                        return true;

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

                            return true;

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

                        }

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

                        }

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

                 * @return array

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

                        $parameters['margin-top'] = '';

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

                    }

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

                        $parameters['keywords'] = $this->parseVariables($this->get('meta_keywords'));

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

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

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

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

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

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

                        $parameters['title'] = $this->parseVariables($this->get('meta_title'));

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

                    return 'P';

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

                }

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

                 */

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

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

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

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

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

                    \App\Cache::staticSave(__METHOD__, $key, $test);

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

                    $permissions = explode(',', $permissions);

            Line exceeds 120 characters; contains 147 characters
            Open

                        $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());

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

                        $roles[] = $currentUser->getRole();

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

                    $parameters['page_orientation'] = $this->getOrientation();

            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 'L';

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

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

                /**

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

                        $parameters['margin-left'] = '';

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

                    if (1 === (int) $this->get('metatags_status')) {

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

                        $parameters['subject'] = $this->parseVariables($this->get('meta_subject'));

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

                    return $parameters;

            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

                    $orientation = $this->get('page_orientation');

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

                 */

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

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

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

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

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

                 */

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

                /**

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

                 * @return bool

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

                        $accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());

            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

                 * Returns page format.

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

                public function getOrientation()

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

                 * @return string - header content

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

                public function getBody()

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

                {

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

                            $this->textParser->setLanguage($this->get('language'));

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

                    return $test;

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

                 * Check if user has permissions to 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

                    $parameters = [];

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

                        $parameters['author'] = $this->parseVariables($this->get('meta_author'));

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

                public function getFormat()

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

                 * Get body content.

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

                 */

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

                public function getFooter()

            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

                    $getTypes = [];

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

                    if (!$test) {

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

                    if (\array_key_exists('Groups', $getTypes)) {

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

                    $permissions = $this->get('template_members');

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

                 */

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

                        return true;

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

                }

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

                /**

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

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

                            $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));

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

                 * Get body content.

            Line exceeds 120 characters; contains 126 characters
            Open

                            $this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));

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

                        $test = $conditionStrategy->evaluate($conditions, $recordModel);

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

                    }

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

                 */

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

                    $parameters['page_format'] = $this->get('page_format');

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

                        $parameters['margin-left'] = $this->get('margin_left');

            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 $this->get('footer_content');

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

                {

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

                    if (!isset($this->textParser)) {

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

                        $conditions = htmlspecialchars_decode($this->getRaw('conditions'));

            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 (array_intersect($getTypes['RoleAndSubordinates'], array_filter($roles))) {

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

                    return false;

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

                 * Returns array of template parameters understood by the pdf engine.

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

                 * @return string page format

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

                 * @return string - body content

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

                    }

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

                    if (\in_array('Users:' . $currentUser->getId(), $permissions)) { // check user id

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

                    if (\in_array('Roles:' . $currentUser->getRole(), $permissions)) {

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

                        $roles = $currentUser->getParentRoles();

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

                            return true;

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

                }

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

                {

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

                    } else {

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

                }

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

                    $currentUser = Users_Record_Model::getCurrentUserModel();

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

                        $valueType = explode(':', $name);

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

                        if (array_intersect($groups, $accessibleGroups)) {

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

                    if (\array_key_exists('RoleAndSubordinates', $getTypes)) {

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

                    // margins

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

                 * Get header content.

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

                 *

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

                    if (empty($permissions)) {

            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

                        $parameters['margin-top'] = $this->get('margin_top');

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

                    $parameters['creator'] = 'YetiForce CRM';

            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

                    foreach ($permissions as $name) {

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

                    $parameters['footer_height'] = $this->get('footer_height');

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

                        $parameters['margin-bottom'] = $this->get('margin_bottom');

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

                        $parameters['margin-bottom'] = '';

            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 ('PLL_LANDSCAPE' === $orientation) {

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

                {

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

                 * Gets TextParser.

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

                 * @return \App\TextParser

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

                        if (isset($this->variables['recordId'])) {

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

                        } else {

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

                 * @param string $salt

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

                 *

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

                        unlink($file['path']);

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

                 */

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

                        $this->textParser = $this->getParser();

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

                 * Gets path.

            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 parseVariables(string $str)

            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

                    foreach ($fileNames as $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

                public function getPath(string $prefix = '')

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

                 */

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

                    $zip->download('PdfZipFile_' . time());

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

                    }

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

                /**

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

                    return $str ? $this->getParser()->setContent($str)->parse()->getContent() : '';

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

                    return \App\Fields\File::createTempFile($prefix, 'pdf');

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

                    return $this->textParser;

            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

                        $this->textParser->setParams(['pdf' => $this]);

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

                        $this->textParser->useExtension = true;

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

                 * Attach current record to email.

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

                 * @param array $fileNames

            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

                        $this->textParser->setType('pdf');

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

                        $this->textParser = null;

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

                /**

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

                public static function attachToEmail($salt)

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

                /**

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

                public static function zipAndDownload(array $fileNames)

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

                    $zip = \App\Zip::createFile($zipPath);

            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

                 * @throws \App\Exceptions\NoPermitted

            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

                    $zipPath = 'cache' . DIRECTORY_SEPARATOR . 'pdf' . DIRECTORY_SEPARATOR;

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

                 * @param string $prefix

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

                 * Parse variables.

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

                 * @param string $str

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

                 */

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

                    header('location: index.php?module=OSSMail&view=Compose&pdf_path=' . $salt);

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

                        }

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

                    $zipPath .= basename($tmpFileName);

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

                {

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

                    } elseif (($this->variables['recordId'] ?? null) !== $this->textParser->record) {

            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

                 * Compress files and send to browser.

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

                        $zip->addFile($file['path'], $file['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

                {

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

                {

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

                    $tmpFileName = tempnam($zipPath, 'PDFZIP' . time());

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

                    foreach ($fileNames as $file) {

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

            class Vtiger_PDF_Model extends \App\Base

            There are no issues that match your filters.

            Category
            Status