YetiForceCompany/YetiForceCRM

View on GitHub
app/RecordCollectors/Base.php

Summary

Maintainability
C
1 day
Test Coverage
F
46%

Function loadData has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadData(): void
    {
        if (empty($this->data)) {
            return;
        }
Severity: Minor
Found in app/RecordCollectors/Base.php - About 6 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 loadData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function loadData(): void
    {
        if (empty($this->data)) {
            return;
        }
Severity: Major
Found in app/RecordCollectors/Base.php - About 2 hrs to fix

    Function getFields has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFields(): array
        {
            $fieldsModel = [];
            foreach ($this->fields as $fieldName => $data) {
                if (isset($data['picklistValuesFunction'])) {
    Severity: Minor
    Found in app/RecordCollectors/Base.php - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    The class Base has 16 fields. Consider redesigning Base to keep the number of fields under 15.
    Open

    class Base
    {
        /** @var string Module name. */
        public $moduleName;
    
    
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    TooManyFields

    Since: 0.1

    Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

    Example

    class Person {
       protected $one;
       private $two;
       private $three;
       [... many more fields ...]
    }

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

    The method loadData() has an NPath complexity of 6216. The configured NPath complexity threshold is 200.
    Open

        public function loadData(): void
        {
            if (empty($this->data)) {
                return;
            }
    Severity: Minor
    Found in app/RecordCollectors/Base.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 loadData() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
    Open

        public function loadData(): void
        {
            if (empty($this->data)) {
                return;
            }
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    CyclomaticComplexity

    Since: 0.1

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

    Example

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

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

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

            $this->response['dataCounter'] = $dataCounter;
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    UndefinedVariable

    Since: 2.8.0

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

    Example

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

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

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

                $dataCounter[$key] = 0;
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    UndefinedVariable

    Since: 2.8.0

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

    Example

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

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

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

                        ++$dataCounter[$key];
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    UndefinedVariable

    Since: 2.8.0

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

    Example

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

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

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

            if ($params = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linkurl' => static::class])->scalar()) {
    Severity: Minor
    Found in app/RecordCollectors/Base.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 '80', column '18').
    Open

            $config = (new \ReflectionClass($class))->getStaticProperties();
    Severity: Minor
    Found in app/RecordCollectors/Base.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 '184', column '13').
    Open

            throw new \Api\Core\Exception('no search function');
    Severity: Minor
    Found in app/RecordCollectors/Base.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\Log' in method 'getFields'.
    Open

                        \App\Log::error($th->__toString(), 'RecordCollectors');
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                                $skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $this->moduleName);
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

                    $fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $this->moduleName);
    Severity: Minor
    Found in app/RecordCollectors/Base.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 'loadData'.
    Open

                $recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->moduleName);
    Severity: Minor
    Found in app/RecordCollectors/Base.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 '197', column '7').
    Open

        public function loadData(): void
        {
            if (empty($this->data)) {
                return;
            }
    Severity: Minor
    Found in app/RecordCollectors/Base.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

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

            } else {
                $fieldsModel = \Vtiger_Module_Model::getInstance($this->moduleName)->getFields();
            }
    Severity: Minor
    Found in app/RecordCollectors/Base.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 '282', column '7').
    Open

        protected function getParams(): array
        {
            if ($params = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linkurl' => static::class])->scalar()) {
                return \App\Json::decode($params, true);
            }
    Severity: Minor
    Found in app/RecordCollectors/Base.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

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

    Example

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

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

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

                        $data['picklistValues'][$picklistKey] = \App\Language::translate($value, $picklistModule);
    Severity: Minor
    Found in app/RecordCollectors/Base.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_Field_Model' in method 'getFields'.
    Open

                $fieldModel = \Vtiger_Field_Model::init($this->moduleName, $data, $fieldName);
    Severity: Minor
    Found in app/RecordCollectors/Base.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 'getParams'.
    Open

                return \App\Json::decode($params, true);
    Severity: Minor
    Found in app/RecordCollectors/Base.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\YetiForce\Shop' in method 'isAvailable'.
    Open

            return !$this->paid || \App\YetiForce\Shop::check($this->addOnName);
    Severity: Minor
    Found in app/RecordCollectors/Base.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 loadData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                            } else {
                                $skip[$fieldName]['label'] = $fieldName;
                            }
    Severity: Minor
    Found in app/RecordCollectors/Base.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

    syntax error, unexpected 'bool' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)
    Open

        protected bool $paid = true;
    Severity: Critical
    Found in app/RecordCollectors/Base.php by phan

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

        public function __construct()

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

            if (!class_exists($class)) {

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

                $this->{$key} = $value;

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

                if (isset($this->modulesFieldsMap[$this->moduleName][$fieldName]) && $this->request->has($this->modulesFieldsMap[$this->moduleName][$fieldName])) {

    Line exceeds 120 characters; contains 159 characters
    Open

                if (isset($this->modulesFieldsMap[$this->moduleName][$fieldName]) && $this->request->has($this->modulesFieldsMap[$this->moduleName][$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

        public function search(): array

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

        public $label;

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

        /** @var string Record collector name. */

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

        /** @var array Fields mapping for loading record data. */

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

            $config = (new \ReflectionClass($class))->getStaticProperties();

    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 getName(): 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

                    $data['picklistValues'] = $this->{$data['picklistValuesFunction']}($data);

    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 fields for the 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

        /** @var string Search results display type. */

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

        protected $data = [];

    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 \App\Request $request

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

         * @return \Vtiger_Field_Model[]

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

         */

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

        public $docUrl;

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

        protected $fields = [];

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

        protected $request;

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

        /** @var bool Requires subscription. */

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

                } elseif (isset($data['picklistValues']) && false !== $data['picklistModule']) {

    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 Module name. */

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

        /** @var string Additional description, visible in the modal window. */

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

        protected bool $paid = true;

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

            if (isset($config['allowedModules'])) {

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

            return $this->name;

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

                        \App\Log::error($th->__toString(), 'RecordCollectors');

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

        public function getFieldsModule(string $moduleName): array

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

         * Check whether it is active.

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

        public function isAvailable(): 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

        /** @var string The name of Add-on. */

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

                $this->allowedModules = $config['allowedModules'];

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

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

                if (isset($data['picklistValuesFunction'])) {

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

                    foreach ($data['picklistValues'] as $picklistKey => $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

         * @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

        /** var array List of fields for the modal search window. */

    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->request = $request;

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

        /**

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

                    try {

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

                        $uitypeModel->validate($value, 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

        /** @var string Icon. */

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

        public $icon;

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

         * Get record collector name.

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

         * @return void

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

                        $uitypeModel = $fieldModel->getUITypeModel();

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

            return $this->modulesFieldsMap[$moduleName];

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

        public function isActive(): bool

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

         * Check if product is available.

    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 \App\Request Request instance. */

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

        protected $modulesFieldsMap = [];

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

        /**

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

            $class = '\\Config\\Components\\RecordCollectors\\' . $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

            $fieldsModel = [];

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

                $fieldModel = \Vtiger_Field_Model::init($this->moduleName, $data, $fieldName);

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

                        $value = $this->request->getByType($this->modulesFieldsMap[$this->moduleName][$fieldName], 'Text');

    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->paid || \App\YetiForce\Shop::check($this->addOnName);

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

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

        /** @var string Label. */

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

        protected $name;

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

        /** @var array Data from record collector source. */

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

        protected $response = [];

    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

        /**

    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

        }

    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

         *

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

        public $moduleName;

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

        /** @var array Configuration field list. */

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

            $name = basename(str_replace('\\', '/', static::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

        public function setRequest(\App\Request $request): void

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

            foreach ($this->fields as $fieldName => $data) {

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

                        $fieldModel->set('fieldvalue', $uitypeModel->getDBValue($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 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

        }

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

         * Get fields for the modal search window.

    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 \in_array($this->moduleName, $this->allowedModules) && $this->isAvailable();

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

        /** @var string Url to Documentation API */

    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

                    } catch (\Throwable $th) {

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

            return $fieldsModel;

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

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

        /** @var array Response data. */

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

        public function getFields(): array

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

                $recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->moduleName);

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

                $fieldsModel = $recordModel->getModule()->getFields();

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

                $fieldsModel = \Vtiger_Module_Model::getInstance($this->moduleName)->getFields();

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

            foreach ($rows as $key => &$row) {

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

                foreach ($this->formFieldsToRecordMap[$this->moduleName] as $apiKey => $fieldName) {

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

                        $value = trim($row[$apiKey]);

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

            $this->response['additional'] = $additional;

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

         * Get fields labels for the 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

        /** @var string[] Allowed modules. */

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

         * Constructor.

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

                    $picklistModule = $data['picklistModule'] ?? $this->moduleName;

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

                        $data['picklistValues'][$picklistKey] = \App\Language::translate($value, $picklistModule);

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

                $fieldsModel[$fieldName] = $fieldModel;

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

        {

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

         * Search data function.

    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($fieldsModel[$fieldName]) && empty($skip[$fieldName]['label'])) {

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

                                $skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $this->moduleName);

    Line exceeds 120 characters; contains 144 characters
    Open

                                $skip[$fieldName]['label'] = \App\Language::translate($fieldsModel[$fieldName]->getFieldLabel(), $this->moduleName);

    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

                                $skip[$fieldName]['label'] = $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

                        unset($row[$apiKey]);

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

                    if ('' === $value && isset($fieldsData[$fieldName]['data'][$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

        public $description;

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

        public $settingsFields = [];

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

        protected string $addOnName = '';

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

                unset($config['allowedModules']);

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

         *

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

         * Set request.

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

        }

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

         *

    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

            $this->response['skip'] = $skip;

    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 loadData(): void

    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

            $rows = isset($this->data[0]) ? $this->data : [$this->data];

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

                if (empty($row)) {

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

                    continue;

    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->response['keys'] = array_keys($rows);

    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

        }

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

                        'display' => $fieldModel->getDisplayValue($value, false, false, false, 40),

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

                }

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

         *

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

                return \App\Json::decode($params, true);

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

            $additional = $fieldsData = $skip = [];

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

                            }

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

                    $fieldsData[$fieldName]['data'][$key] = [

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

            foreach ($this->formFieldsToRecordMap[$moduleName] as $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

            if ($recordId = $this->request->getInteger('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

                    }

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

            $fieldsModels = \Vtiger_Module_Model::getInstance($moduleName)->getFields();

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

                }

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

                        continue;

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

            if ($params = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linkurl' => static::class])->scalar()) {

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

            }

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

                    if ($value) {

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

                foreach ($row as $name => $value) {

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

                        $additional[$name][$key] = $value;

    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

                    $labels[$fieldName] = $fieldsModels[$fieldName]->getFullLabelTranslation();

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

        {

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

            throw new \Api\Core\Exception('no search function');

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

         * Load data.

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

         */

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

                $dataCounter[$key] = 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

                        if (isset($row[$apiKey]) && '' !== $row[$apiKey] && null !== $row[$apiKey]) {

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

                    $value = '';

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

                        'edit' => $fieldModel->getEditViewDisplayValue($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

        public function getFieldsLabelsByModule(string $moduleName): array

    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

            if (empty($this->data)) {

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

                            $skip[$fieldName]['data'][$key] = $row[$apiKey];

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

            $this->response['fields'] = $fieldsData;

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

            $this->response['dataCounter'] = $dataCounter;

    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

                $this->response['recordModel'] = $recordModel;

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

                    }

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

                    if (isset($row[$apiKey])) {

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

                    $fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $this->moduleName);

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

                        'raw' => $value,

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

            $labels = [];

    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

                        ++$dataCounter[$key];

    Line exceeds 120 characters; contains 125 characters
    Open

                    $fieldsData[$fieldName]['label'] = \App\Language::translate($fieldModel->getFieldLabel(), $this->moduleName);

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

                if (isset($fieldsModels[$fieldName]) && $fieldsModels[$fieldName]->isActiveField()) {

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

         * Get params of collector.

    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

                        unset($row[$apiKey]);

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

                    if ('' !== $value && null !== $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

        protected function getParams(): array

    Line exceeds 120 characters; contains 179 characters
    Open

            if ($params = (new \App\Db\Query())->select(['params'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR', 'linkurl' => static::class])->scalar()) {

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

         * @return void

    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($fieldsModel[$fieldName]) || !$fieldsModel[$fieldName]->isActiveField()) {

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

                        continue;

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

                    $fieldModel = $fieldsModel[$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

            return $labels;

    There are no issues that match your filters.

    Category
    Status