YetiForceCompany/YetiForceCRM

View on GitHub
app/Fields/ServerAccess.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
97%

Method getLinks has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getLinks(\Vtiger_Record_Model $recordModel, string $source): ?\Vtiger_Link_Model
    {
        $fields = $recordModel->getModule()->getFieldsByType('serverAccess', true);
        $isActive = 0;
        foreach ($fields as $fieldName => $fieldModel) {
Severity: Minor
Found in app/Fields/ServerAccess.php - About 1 hr to fix

    Function getLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getLinks(\Vtiger_Record_Model $recordModel, string $source): ?\Vtiger_Link_Model
        {
            $fields = $recordModel->getModule()->getFieldsByType('serverAccess', true);
            $isActive = 0;
            foreach ($fields as $fieldName => $fieldModel) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        public static function getLinks(\Vtiger_Record_Model $recordModel, string $source): ?\Vtiger_Link_Model
        {
            $fields = $recordModel->getModule()->getFieldsByType('serverAccess', true);
            $isActive = 0;
            foreach ($fields as $fieldName => $fieldModel) {
    Severity: Minor
    Found in app/Fields/ServerAccess.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 16 to the 15 allowed.
    Open

        public static function getLinks(\Vtiger_Record_Model $recordModel, string $source): ?\Vtiger_Link_Model
    Severity: Critical
    Found in app/Fields/ServerAccess.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

    Missing class import via use statement (line '96', column '15').
    Open

            $row = (new \App\Db\Query())->from('w_#__servers')->where(['id' => $serverId])->one(\App\Db::getInstance('webservice')) ?: [];
    Severity: Minor
    Found in app/Fields/ServerAccess.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\Cache' in method 'get'.
    Open

            if (\App\Cache::has(__METHOD__, $serverId)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Cache' in method 'get'.
    Open

                return \App\Cache::get(__METHOD__, $serverId);
    Severity: Minor
    Found in app/Fields/ServerAccess.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\Db' in method 'get'.
    Open

            $row = (new \App\Db\Query())->from('w_#__servers')->where(['id' => $serverId])->one(\App\Db::getInstance('webservice')) ?: [];
    Severity: Minor
    Found in app/Fields/ServerAccess.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 'getLinks'.
    Open

                $label = \App\Language::translate($isActive ? 'BTN_DISABLE_SHARE_RECORD_IN' : 'BTN_SHARE_RECORD_IN') . ' ' . ($webServiceApp['name'] ?? '');
    Severity: Minor
    Found in app/Fields/ServerAccess.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 'getLinks'.
    Open

                        'edit-fields' => \App\Json::encode(array_keys($fields)),
    Severity: Minor
    Found in app/Fields/ServerAccess.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_Link_Model' in method 'getLinks'.
    Open

                $return = \Vtiger_Link_Model::getInstanceFromValues([
                    'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',
                    'linklabel' => 'BTN_SERVER_ACCESS',
                    'linkicon' => ($isActive ? 'yfi-share-portal-record' : 'yfi-unshare-portal-record'),
                    'linkclass' => 'btn-sm js-quick-edit-modal ' . self::BTN_CLASS[$source][$isActive],
    Severity: Minor
    Found in app/Fields/ServerAccess.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 getLinks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

            } else {
                $return = \Vtiger_Link_Model::getInstanceFromValues([
                    'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',
                    'linklabel' => 'BTN_SERVER_ACCESS',
                    'linkicon' => ($isActive ? 'yfi-share-portal-record' : 'yfi-unshare-portal-record'),
    Severity: Minor
    Found in app/Fields/ServerAccess.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 '\Vtiger_Link_Model' in method 'getLinks'.
    Open

                $return = \Vtiger_Link_Model::getInstanceFromValues([
                    'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',
                    'linklabel' => 'BTN_SERVER_ACCESS',
                    'linkhint' => $label,
                    'linkicon' => ($isActive ? 'yfi-share-portal-record' : 'yfi-unshare-portal-record'),
    Severity: Minor
    Found in app/Fields/ServerAccess.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 'getLinks'.
    Open

                        'modal-title' => \App\Language::translate('BTN_SERVER_ACCESS'),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpmd

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

    Avoid using static access to class '\App\Cache' in method 'get'.
    Open

            \App\Cache::save(__METHOD__, $serverId, $row, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/ServerAccess.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 "BTN_SERVER_ACCESS" 3 times.
    Open

                    'linklabel' => 'BTN_SERVER_ACCESS',
    Severity: Critical
    Found in app/Fields/ServerAccess.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.

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

                return \App\Cache::get(__METHOD__, $serverId);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phan

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

            $row = (new \App\Db\Query())->from('w_#__servers')->where(['id' => $serverId])->one(\App\Db::getInstance('webservice')) ?: [];
    Severity: Critical
    Found in app/Fields/ServerAccess.php by phan

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

            \App\Cache::save(__METHOD__, $serverId, $row, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phan

    Call to undeclared function \array_key_first()
    Open

                $fieldName = array_key_first($fields);
    Severity: Critical
    Found in app/Fields/ServerAccess.php by phan

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

            if (\App\Cache::has(__METHOD__, $serverId)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phan

    Spaces must be used for alignment; tabs are not allowed
    Open

                        'module' => $recordModel->getModuleName(),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

         * Get web service application details by id.
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            if (\App\Cache::has(__METHOD__, $serverId)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

            $row = (new \App\Db\Query())->from('w_#__servers')->where(['id' => $serverId])->one(\App\Db::getInstance('webservice')) ?: [];
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                        'record' => $recordModel->getId(),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                return \App\Cache::get(__METHOD__, $serverId);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linkdata' => [
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                        'show-layout' => 'vertical',
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                        'modal-title' => \App\Language::translate('BTN_SERVER_ACCESS'),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linkdata' => ['add-btn-icon' => 1,    'source-view' => $source],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                $return = \Vtiger_Link_Model::getInstanceFromValues([
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

            \App\Cache::save(__METHOD__, $serverId, $row, \App\Cache::MEDIUM);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

            return $return;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                        'edit-fields' => \App\Json::encode(array_keys($fields)),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                ]);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linklabel' => 'BTN_SERVER_ACCESS',
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linkclass' => 'btn-sm js-quick-edit-modal ' . self::BTN_CLASS[$source][$isActive],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

            return $row;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

        public static function get(int $serverId): array
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

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

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    'linkicon' => ($isActive ? 'yfi-share-portal-record' : 'yfi-unshare-portal-record'),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

                    ],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Spaces must be used for alignment; tabs are not allowed
    Open

         * @param int $serverId
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

        const BTN_CLASS = [
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            'ModComments' => [0 => 'text-secondary', 1 => 'text-success'],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

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

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

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

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

                if ($recordModel->getValueByField($fieldName)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                $fieldModel = $fields[$fieldName];
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

         * @param \Vtiger_Record_Model $recordModel
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

                    'linklabel' => 'BTN_SERVER_ACCESS',
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            'RelatedList' => [0 => 'btn-secondary', 1 => 'btn-success'],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

         * @return \Vtiger_Link_Model|null
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            'List' => [0 => 'btn-secondary', 1 => 'btn-success'],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

            $isActive = 0;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

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

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

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

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

            $fields = $recordModel->getModule()->getFieldsByType('serverAccess', true);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Line exceeds 120 characters; contains 152 characters
    Open

                $label = \App\Language::translate($isActive ? 'BTN_DISABLE_SHARE_RECORD_IN' : 'BTN_SHARE_RECORD_IN') . ' ' . ($webServiceApp['name'] ?? '');
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                return null;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            if (empty($fields)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    'linkdata' => ['add-btn-icon' => 1,    'source-view' => $source],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

         * Get links to share the record in external services (Web service - Applications).
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            foreach ($fields as $fieldName => $fieldModel) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                if (!$fieldModel->isEditable()) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                $label = \App\Language::translate($isActive ? 'BTN_DISABLE_SHARE_RECORD_IN' : 'BTN_SHARE_RECORD_IN') . ' ' . ($webServiceApp['name'] ?? '');
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    'linkhint' => $label,
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

         * @var array Class mapping for different button places
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    $isActive = 1;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

            $return = null;
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    'linkclass' => 'js-action-confirm btn-sm ' . self::BTN_CLASS[$source][$isActive],
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

        public static function getLinks(\Vtiger_Record_Model $recordModel, string $source): ?\Vtiger_Link_Model
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    unset($fields[$fieldName]);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    'linkicon' => ($isActive ? 'yfi-share-portal-record' : 'yfi-unshare-portal-record'),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Line exceeds 120 characters; contains 175 characters
    Open

                    'dataUrl' => "index.php?module={$recordModel->getModuleName()}&action=SaveAjax&record={$recordModel->getId()}&field={$fieldName}&value=" . ($isActive ? 0 : 1),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

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

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

                    'dataUrl' => "index.php?module={$recordModel->getModuleName()}&action=SaveAjax&record={$recordModel->getId()}&field={$fieldName}&value=" . ($isActive ? 0 : 1),
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                $fieldName = array_key_first($fields);
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                $webServiceApp = self::get($fieldModel->get('fieldparams'));
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                $return = \Vtiger_Link_Model::getInstanceFromValues([
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

                    'linktype' => 'LIST_VIEW_ACTIONS_RECORD_LEFT_SIDE',
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

         * @param string               $source
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

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

            if (1 === \count($fields)) {
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    Line exceeds 120 characters; contains 134 characters
    Open

            $row = (new \App\Db\Query())->from('w_#__servers')->where(['id' => $serverId])->one(\App\Db::getInstance('webservice')) ?: [];
    Severity: Minor
    Found in app/Fields/ServerAccess.php by phpcodesniffer

    There are no issues that match your filters.

    Category
    Status