YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
C
7 hrs
Test Coverage
F
0%

Function process has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $this->preProcess($request);
        $viewer = $this->getViewer($request);
        $pdfModuleName = $moduleName = $request->getModule();
Severity: Minor
Found in modules/Vtiger/views/PDF.php - About 3 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Method process has 92 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $this->preProcess($request);
        $viewer = $this->getViewer($request);
        $pdfModuleName = $moduleName = $request->getModule();
Severity: Major
Found in modules/Vtiger/views/PDF.php - About 3 hrs to fix

    The method process() has an NPath complexity of 104832. The configured NPath complexity threshold is 200.
    Open

        public function process(App\Request $request)
        {
            $this->preProcess($request);
            $viewer = $this->getViewer($request);
            $pdfModuleName = $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpmd

    NPathComplexity

    Since: 0.1

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

    Example

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

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

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

        public function process(App\Request $request)
        {
            $this->preProcess($request);
            $viewer = $this->getViewer($request);
            $pdfModuleName = $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpmd

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

        public function process(App\Request $request)
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by sonar-php

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

    See

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

    class Vtiger_PDF_View extends Vtiger_BasicModal_View
    {
        /** {@inheritdoc} */
        public function checkPermission(App\Request $request)
        {
    Severity: Minor
    Found in modules/Vtiger/views/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

    Missing class import via use statement (line '59', column '23').
    Open

            $eventHandler = new App\EventHandler();
    Severity: Minor
    Found in modules/Vtiger/views/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 '28', column '14').
    Open

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Vtiger/views/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 '25', column '14').
    Open

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
    Severity: Minor
    Found in modules/Vtiger/views/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 '\App\Condition' in method 'process'.
    Open

                \App\Condition::validAdvancedConditions($advancedConditions);
    Severity: Minor
    Found in modules/Vtiger/views/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 process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
                $records = \Vtiger_Mass_Action::getRecordsListFromRequest($request);
            }
    Severity: Minor
    Found in modules/Vtiger/views/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\Condition' in method 'process'.
    Open

            $viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
    Severity: Minor
    Found in modules/Vtiger/views/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\Privilege' in method 'checkPermission'.
    Open

            if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
    Severity: Minor
    Found in modules/Vtiger/views/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\Pdf\InventoryColumns' in method 'process'.
    Open

                $viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
    Severity: Minor
    Found in modules/Vtiger/views/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 assigning values to variables in if clauses and the like (line '40', column '7').
    Open

        public function process(App\Request $request)
        {
            $this->preProcess($request);
            $viewer = $this->getViewer($request);
            $pdfModuleName = $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/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_Module_Model' in method 'process'.
    Open

            $moduleModel = \Vtiger_Module_Model::getInstance($pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/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\Condition' in method 'process'.
    Open

            $viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
                $request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
                $request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
            ));
    Severity: Minor
    Found in modules/Vtiger/views/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 'process'.
    Open

            $handlerClass = \Vtiger_Loader::getComponentClassName('Model', 'PDF', $pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/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_Mass_Action' in method 'process'.
    Open

                $records = \Vtiger_Mass_Action::getRecordsListFromRequest($request);
    Severity: Minor
    Found in modules/Vtiger/views/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_RelationAjax_Action' in method 'process'.
    Open

                $records = \Vtiger_RelationAjax_Action::getRecordsListFromRequest($request);
    Severity: Minor
    Found in modules/Vtiger/views/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 "record" 4 times.
    Open

            if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
    Severity: Critical
    Found in modules/Vtiger/views/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 undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ACTIVE_DYNAMIC', $activeDynamic);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('STANDARD_TEMPLATES', $templates);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RELATED_MODULE', $pdfModuleName);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ORDER_BY', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('CAN_CHANGE_SCHEME', $moduleModel->isPermitted('RecordPdfInventory'));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('RELATION_ID', $request->getInteger('relationId'));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ENTITY_STATE', $request->isEmpty('entityState') ? '' : $request->getByType('entityState'));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('ALL_INVENTORY_COLUMNS', $allInventoryColumns);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('FROM_VIEW', $view);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SEARCH_KEY', $request->getByType('search_key', \App\Purifier::ALNUM));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SELECTED_IDS', $request->getArray('selected_ids', \App\Purifier::INTEGER));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ADVANCED_CONDITIONS', $advancedConditions);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('EXCLUDED_IDS', $request->getArray('excluded_ids', \App\Purifier::INTEGER));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('DYNAMIC_TEMPLATES', $dynamicTemplates);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('RECORD_ID', $recordId);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('OPERATOR', $request->getByType('operator'));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('CV_ID', $request->getByType('cvId', \App\Purifier::ALNUM));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('ACTIVE', $active);
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

            $viewer->assign('VIEW_NAME', $request->getByType('viewname', \App\Purifier::ALNUM));
    Severity: Critical
    Found in modules/Vtiger/views/PDF.php by phan

    Call to undeclared method \Vtiger_Viewer::assign
    Open

                $viewer->assign('MODULE_NAME', $moduleName);
    Severity: Critical
    Found in modules/Vtiger/views/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_View extends Vtiger_BasicModal_View
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    The class Vtiger_PDF_View is not named in CamelCase.
    Open

    class Vtiger_PDF_View extends Vtiger_BasicModal_View
    {
        /** {@inheritdoc} */
        public function checkPermission(App\Request $request)
        {
    Severity: Minor
    Found in modules/Vtiger/views/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

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

                $request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $dynamicTemplates = $records = [];
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                'records' => $records,
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                'pdfModel' => $pdfModel,
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    $allInventoryColumns[$name] = $field->get('label');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('FROM_VIEW', $view);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ORDER_BY', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $advancedConditions = $request->has('advancedConditions') ? $request->getArray('advancedConditions') : [];
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if ($isRelatedView) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $eventHandler->trigger('PdfModalAfter');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        /** {@inheritdoc} */
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('DYNAMIC_TEMPLATES', $dynamicTemplates);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ENTITY_STATE', $request->isEmpty('entityState') ? '' : $request->getByType('entityState'));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    Line exceeds 120 characters; contains 152 characters
    Open

            $viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $isInventory = $moduleModel->isInventory();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            foreach ($templates as $key => $template) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                if ($isTemplateActive && !$active) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ACTIVE_DYNAMIC', $activeDynamic);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('SELECTED_IDS', $request->getArray('selected_ids', \App\Purifier::INTEGER));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if ($advancedConditions) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    foreach ($records as $record) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('OPERATOR', $request->getByType('operator'));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    Line exceeds 120 characters; contains 140 characters
    Open

            if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $pdfModuleName = $moduleName = $request->getModule();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            } else {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                            $active = true;
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('ALL_INVENTORY_COLUMNS', $allInventoryColumns);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ACTIVE', $active);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('EXCLUDED_IDS', $request->getArray('excluded_ids', \App\Purifier::INTEGER));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    Line exceeds 120 characters; contains 135 characters
    Open

            $viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ADVANCED_CONDITIONS', $advancedConditions);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('CV_ID', $request->getByType('cvId', \App\Purifier::ALNUM));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('MODULE_NAME', $moduleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $recordId = $request->isEmpty('record', true) ? null : $request->getInteger('record');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if ($isRelatedView = ('RelatedList' === $view)) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $records = \Vtiger_RelationAjax_Action::getRecordsListFromRequest($request);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $records = \Vtiger_Mass_Action::getRecordsListFromRequest($request);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            ]);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    unset($templates[$key]);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->view('ExportPDF.tpl', $pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    Line exceeds 120 characters; contains 124 characters
    Open

            if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModuleActionPermission($moduleName, 'ExportPdf')) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        public function process(App\Request $request)
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $handlerClass = \Vtiger_Loader::getComponentClassName('Model', 'PDF', $pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $eventHandler->setParams([
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                        }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                if ($isInventory && \Vtiger_PDF_Model::TEMPLATE_TYPE_DYNAMIC === $template->get('type')) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    $dynamicTemplates[] = $template;
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            ));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $this->postProcess($request);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $this->preProcess($request);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $records = [$recordId];
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModuleActionPermission($moduleName, 'ExportPdf')) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                'viewInstance' => $this,
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $moduleModel = \Vtiger_Module_Model::getInstance($pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if ($isInventory) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                \App\Condition::validAdvancedConditions($advancedConditions);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer = $this->getViewer($request);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $active = $activeDynamic = false;
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            } elseif ($recordId) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        public function checkPermission(App\Request $request)
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        /** {@inheritdoc} */
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if ($isRelatedView) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $eventHandler->trigger('PdfModalBefore');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                            break;
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('RECORD_ID', $recordId);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $view = $request->getByType('fromview', \App\Purifier::STANDARD);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $templates = $pdfModel->getActiveTemplatesForRecord($recordId, $view, $pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $allInventoryColumns = [];
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('CAN_CHANGE_SCHEME', $moduleModel->isPermitted('RecordPdfInventory'));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('STANDARD_TEMPLATES', $templates);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('VIEW_NAME', $request->getByType('viewname', \App\Purifier::ALNUM));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('RELATED_MODULE', $pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $viewer->assign('RELATION_ID', $request->getInteger('relationId'));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                    if ($isTemplateActive && !$activeDynamic) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $pdfModuleName = $request->getByType('relatedModule', \App\Purifier::ALNUM);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $pdfModel = new $handlerClass();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $eventHandler = new App\EventHandler();
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                        if ($template->checkFiltersForRecord((int) $record)) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $viewer->assign('SEARCH_KEY', $request->getByType('search_key', \App\Purifier::ALNUM));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

        }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            $eventHandler->setModuleName($pdfModuleName);
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                $isTemplateActive = $template->get('default');
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                        $activeDynamic = true;
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

                foreach (\Vtiger_Inventory_Model::getInstance($pdfModuleName)->getFields() as $name => $field) {
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    Line exceeds 120 characters; contains 210 characters
    Open

                $viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

            }
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

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

    class Vtiger_PDF_View extends Vtiger_BasicModal_View
    Severity: Minor
    Found in modules/Vtiger/views/PDF.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status