YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/WebservicePremium/BaseModule/Widgets.php

Summary

Maintainability
A
2 hrs
Test Coverage
A
95%

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

    public function get(): array
    {
        $response = [];
        $moduleName = $this->controller->request->getModule();
        $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Widgets.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

Method get has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $response = [];
        $moduleName = $this->controller->request->getModule();
        $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Widgets.php - About 1 hr to fix

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

            $dataReader = (new \App\Db\Query())->from('vtiger_widgets')

    MissingImport

    Since: 2.7.0

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

    Example

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

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

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

                } else {
                    $row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);
                }

    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_Loader' in method 'get'.
    Open

                $widgetClass = \Vtiger_Loader::getComponentClassName('Widget', $row['type'], $moduleName);

    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 'get'.
    Open

                    $row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);

    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 'get'.
    Open

                        $row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);

    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 'get'.
    Open

                $row['data'] = \App\Json::decode($row['data']);

    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 get uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
    Open

                    } else {
                        $row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);
                    }

    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 '141', column '8').
    Open

        public function get(): array
        {
            $response = [];
            $moduleName = $this->controller->request->getModule();
            $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);

    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\Module' in method 'get'.
    Open

                ->where(['tabid' => \App\Module::getModuleId($moduleName), 'type' => $this->supportedTypes])

    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 'get'.
    Open

                        $row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);

    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 "label" 3 times.
    Open

            $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);

    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 3 (language) is false but \App\Language::translate() takes null|string defined at /code/app/Language.php:161
    Open

                        $row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);

    Possibly zero references to use statement for classlike/namespace OA (\OpenApi\Annotations)
    Open

    use OpenApi\Annotations as OA;

    Argument 3 (language) is false but \App\Language::translate() takes null|string defined at /code/app/Language.php:161
    Open

                    $row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);

    Reference to constant DEFAULT_LABELS from undeclared class \Vtiger_Widget_Model
    Open

                    if (isset(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']])) {

    Argument 3 (language) is false but \App\Language::translate() takes null|string defined at /code/app/Language.php:161
    Open

                        $row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);

    Reference to constant DEFAULT_LABELS from undeclared class \Vtiger_Widget_Model
    Open

                        $row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);

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

            $dataReader = (new \App\Db\Query())->from('vtiger_widgets')

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

         *        summary="Gets a list of widgets",

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

         *            description="List of widgets",

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

         *        ),

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

         *        ),

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

         *        ),

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

         *        summary="Gets a list of widgets",

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

         *            response=200,

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

         *            response=200,

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

         *        ),

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *            description="`No permissions for module`",

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

         *        ),

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

         *        ),

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *            description="`No sent token`, `Invalid token`, `Token has expired`",

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *            response=403,

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

         *            response=405,

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

         *        description="List of widgets",

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

         *        description="List of widgets",

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

         *            @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *        tags={"BaseModule"},

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

         *            @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *            response=403,

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

         *            response=405,

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),

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

         *        ),

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

         *            description="`No permissions for module`",

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

         *        @OA\Response(

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

         *        @OA\Response(

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

         *            description="`Invalid method`",

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

         *        tags={"BaseModule"},

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

         *        @OA\Parameter(name="moduleName", description="Module name",    @OA\Schema(type="string"), in="path", example="Contacts", required=true),

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

         *            response=401,

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

         *        security={{"basicAuth" : {}, "ApiKeyAuth" : {}, "token" : {}}},

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

         *        ),

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

         *        @OA\Response(

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *            response=401,

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

         *        @OA\Response(

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

         *        @OA\Response(

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

         *            description="`No sent token`, `Invalid token`, `Token has expired`",

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *        path="/webservice/WebservicePremium/{moduleName}/Widgets",

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

         *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_Widgets_Response"),

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

         *        @OA\Response(

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *            @OA\XmlContent(ref="#/components/schemas/Exception"),

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

         *    @OA\Get(

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

         *        @OA\Parameter(name="moduleName", description="Module name",    @OA\Schema(type="string"), in="path", example="Contacts", required=true),

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

         *            description="List of widgets",

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

         *            @OA\JsonContent(ref="#/components/schemas/Exception"),

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

         *        path="/webservice/WebservicePremium/{moduleName}/Widgets",

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

         *        @OA\Parameter(name="moduleName", description="Module name",    @OA\Schema(type="string"), in="path", example="Contacts", required=true),

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

         *        @OA\Response(

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

         *        @OA\Response(

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

         *            description="`Invalid method`",

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

         *        required={"status", "result"},

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

         *            type="integer",

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

         * ),

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

         *            "relation_id" : 1,

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

         *                "1" : "lastname",

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

         *                "2" : "phone",

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

         *            property="result",

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

         *        title="Widget data by specific ID",

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

         *        @OA\Property(property="label", type="string", description="Widget label", example="Contacts"),

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

         *            "relatedmodule" : 4,

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

         *            },

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

         *            "action" : 1,

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

                ->orderBy(['tabid' => SORT_ASC, 'sequence' => SORT_ASC])

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

         * @OA\Schema(

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

         *            property="status",

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

         *        ),

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

         *            description="List of widgets",

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

         *         ),

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

         *                "0" : "firstname",

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

         *                "3" : "email"

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

         *            "limit" : 5,

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

                }

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

         *            "limit" : 5,

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

         *            "switchHeader" : "-",

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

         *            "switchHeader" : "-",

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

        {

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

            $dataReader = (new \App\Db\Query())->from('vtiger_widgets')

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

                    if (isset(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']])) {

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

                $widgetInstance = new $widgetClass($moduleName, null, null, $row);

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

         *        required={"status", "result"},

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

         *            description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",

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

         *            enum={0, 1},

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

         *        description="Module action - Widget for specific ID - response data",

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

         *        @OA\Property(property="id", type="integer", description="Widget ID", example=12),

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

         *        @OA\Property(property="label", type="string", description="Widget label", example="Contacts"),

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

         *        @OA\Property(property="sequence", type="integer", description="Sequence", example=1),

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

         *            "customView" : {},

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

         *            "actionSelect" : "0",

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

         *            "no_result_text" : "0",

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

         *            "relatedModuleName" : "Contacts"

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

        public function get(): array

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

            $response = [];

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

                ->where(['tabid' => \App\Module::getModuleId($moduleName), 'type' => $this->supportedTypes])

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

                ->createCommand()->query();

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

         *        ),

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

         *            description="List of widgets",

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

         *        @OA\Property(property="wcol", type="integer", description="Widget position", example=1, enum={1, 2, 3}),

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

         *        @OA\Property(property="data", type="object", description="Widget specific data", example={

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

         *            "relatedmodule" : 4,

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

         *            "viewtype" : "List",

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

         *            "orderby" : {},

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

                        $row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);

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

         *            type="object",

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

         *        required={"id", "type", "label", "wcol", "sequence", "name", "data"},

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

         *        @OA\Property(property="type", type="string", description="Widget type", example="RelatedModule"),

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

         *            "actionSelect" : "0",

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

         *            "filter" : "-",

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

         *            "orderby" : {},

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

         *            "relatedModuleName" : "Contacts"

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

                    }

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

         *        schema="BaseModule_Get_Widgets_Response",

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

         *            enum={0, 1},

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

         *        @OA\Property(

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

         *            type="object",

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

         *        schema="BaseModule_Widget_Result",

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

         *        type="object",

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

         *        type="object",

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

         *                "0" : "firstname",

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

         *                "2" : "phone",

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

                $row['data'] = \App\Json::decode($row['data']);

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

            return $response;

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

         * ),

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

         *        description="Module action - Data of widgets - response body",

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

         *        description="Module action - Widget for specific ID - response data",

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

         *        @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),

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

         *                "3" : "email"

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

         *        }),

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

            $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);

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

                }

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

         *            type="integer",

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

         *        schema="BaseModule_Widget_Result",

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

         *        title="Widget data by specific ID",

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

         *        @OA\Property(property="data", type="object", description="Widget specific data", example={

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

         *            "relatedfields" : {

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

         *    ),

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

                if (empty($row['label'])) {

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

                } else {

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

         *        @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),

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

         *            "filter" : "-",

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

         *        type="object",

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

         *            property="status",

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

         *        required={"id", "type", "label", "wcol", "sequence", "name", "data"},

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

         *        @OA\Property(property="id", type="integer", description="Widget ID", example=12),

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

         *                "1" : "lastname",

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

         *            "checkbox" : "-",

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

         *        }),

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

                    } else {

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

                    $row['name'] = \App\Language::translate($row['label'], $moduleName, false, false);

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

                $widgetClass = \Vtiger_Loader::getComponentClassName('Widget', $row['type'], $moduleName);

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

         *        title="Base module - Response action - data of widgets",

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

         *         ),

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

         * @OA\Schema(

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

         *        schema="BaseModule_Get_Widgets_Response",

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

         *        @OA\Property(property="wcol", type="integer", description="Widget position", example=1, enum={1, 2, 3}),

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

         *        type="object",

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

         *        @OA\Property(property="sequence", type="integer", description="Sequence", example=1),

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

         *        @OA\Property(

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

         *            "viewtype" : "List",

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

         *        @OA\Property(

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

            $moduleName = $this->controller->request->getModule();

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

         *            property="result",

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

                    $response[$row['id']] = array_intersect_key($row, $columns);

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

         *            @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_Widget_Result"),

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

            }

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

         *        @OA\Property(property="type", type="string", description="Widget type", example="RelatedModule"),

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

         *            "customView" : {},

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

         *    ),

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

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

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

                        $row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);

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

         *        title="Base module - Response action - data of widgets",

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

         *        description="Module action - Data of widgets - response body",

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

         *        @OA\Property(

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

         *            "relation_id" : 1,

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

         *            "checkbox" : "-",

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

                if ($row = $widgetInstance->getApiData($row)) {

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

        }

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

         *            description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",

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

         *            @OA\AdditionalProperties(type="object", ref="#/components/schemas/BaseModule_Widget_Result"),

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

         *            "relatedfields" : {

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

         *            },

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

         *            "action" : 1,

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

         *            "no_result_text" : "0",

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

         */

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

            $dataReader->close();

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

        public $allowedMethod = ['GET'];

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

         * Get widgets list method.

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

         * @return array

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

        /**

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

        /** @var string[] Supported widget types */

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

        protected $supportedTypes = ['RelatedModule', 'Updates', 'Comments', 'DetailView'];

    Line exceeds 120 characters; contains 145 characters
    Open

         *        @OA\Parameter(name="moduleName", description="Module name",    @OA\Schema(type="string"), in="path", example="Contacts", required=true),

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

         *

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

         *

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

        /** {@inheritdoc}  */

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

         *    @OA\Get(

    Line exceeds 120 characters; contains 139 characters
    Open

                        $row['name'] = \App\Language::translate(\Vtiger_Widget_Model::DEFAULT_LABELS[$row['type']], $moduleName, false, false);

    Line exceeds 120 characters; contains 136 characters
    Open

                        $row['name'] = \App\Language::translate($row['data']['relatedmodule'], $row['data']['relatedmodule'], false, false);

    Line exceeds 120 characters; contains 126 characters
    Open

         *        @OA\Property(property="name", type="string", description="The translated name of the widget", example="Contacts"),

    Line exceeds 120 characters; contains 131 characters
    Open

         *            description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error",

    There are no issues that match your filters.

    Category
    Status