YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/WebserviceStandard/BaseModule/CustomView.php

Summary

Maintainability
A
0 mins
Test Coverage
A
95%

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

                throw new \Api\Core\Exception('No permissions to view record', 403);

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

            foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {

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\CustomView' in method 'checkPermission'.
Open

        $this->customView = \App\CustomView::getInstance($this->controller->request->getModule());

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

            $response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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

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 {
            foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {
                $response[$cvId] = array_intersect_key($recordModel->getData(), $columns);
                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);
                $response[$cvId]['isFeatured'] = $recordModel->isFeatured();

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

            $response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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 '\CustomView_Record_Model' in method 'get'.
Open

            $recordModel = \CustomView_Record_Model::getInstanceById($this->cvId);

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

                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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\Purifier' in method 'get'.
Open

                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $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

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

        $columns = array_flip(['cvid', 'viewname', 'entitytype', 'sequence', 'description', 'color']);

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.

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

                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

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

            $response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

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", in="path", @OA\Schema(type="string"), description="Module name", required=true, example="Contacts"),

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

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

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

     *        summary="List of custom view",

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

     *        description="Gets a list of custom view",

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

     *            response=200,

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

     *    @OA\Get(

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

     *        summary="List of custom view",

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

     *        path="/webservice/WebserviceStandard/{moduleName}/CustomView",

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

     *        path="/webservice/WebserviceStandard/{moduleName}/CustomView",

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

     *            description="List of custom view",

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

     *        ),

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

     *        ),

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

     *            in="path",

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

     *            response=200,

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

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

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

     *            response=405,

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

     *        type="object",

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\Response(

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

     *            description="List of custom view",

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

     *            response=200,

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

     *        @OA\Response(

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

     *            response=403,

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

     *        description="Gets data of custom view",

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

     *        tags={"BaseModule"},

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

     *        tags={"BaseModule"},

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 to view record` OR `No permissions for module or data provided in the request`",

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

     *        ),

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

     * ),

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

     *        @OA\Response(

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

     *        ),

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

     *         @OA\Parameter(

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

     *            description="Custom view ID",

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

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

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

     *        ),

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

     *        ),

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

     * @OA\Schema(

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

     *        description="Module action - Data of custom view list - response body",

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

     *            response=401,

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

     *        operationId="Api\WebserviceStandard\BaseModule\CustomView::get(cvId)",

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

     *        description="Gets data of custom view",

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

     *            example=12,

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

     *            response=200,

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

     *            description="`No permissions to view record` OR `No permissions for module or data provided in the request`",

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

     *        @OA\Property(

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

     *        description="Gets a list of custom view",

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

     *        @OA\Response(

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

     *            example=12,

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

     *            property="result",

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\JsonContent(ref="#/components/schemas/Exception"),

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

     *        path="/webservice/WebserviceStandard/{moduleName}/CustomView/{cvId}",

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

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

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

     *            @OA\Schema(type="integer"),

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

     *            description="Data of custom view",

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

     *        description="Module action - Data of custom view list - response body",

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="object",

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

     *            @OA\JsonContent(ref="#/components/schemas/BaseModule_Get_CustomView_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

     *        ),

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

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

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

     *            in="path",

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

     *            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\Property(property="status", type="integer", enum={0, 1}, 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

     *            description="List of custom view",

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

     *        @OA\Response(

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\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

     *        ),

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

     *        @OA\Property(property="status", type="integer", enum={0, 1}, 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

     *            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

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

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

     *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_CustomView_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

     *            response=403,

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\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

     *         @OA\Parameter(

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

     *            @OA\Schema(type="integer"),

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

     *        type="object",

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

     *            response=401,

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

     *            response=405,

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

     *        path="/webservice/WebserviceStandard/{moduleName}/CustomView/{cvId}",

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

     *            required=true

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

     *            description="Data of custom view",

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

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

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\XmlContent(ref="#/components/schemas/Exception"),

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

     *        schema="BaseModule_Get_CustomView_Response",

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

     *            property="result",

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

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

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

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

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

     *        operationId="Api\WebserviceStandard\BaseModule\CustomView::get(cvId)",

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

     *        schema="BaseModule_Get_CustomView_Response",

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

     *        @OA\Property(

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

     *            description="List of custom view",

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

     *            @OA\XmlContent(ref="#/components/schemas/BaseModule_Get_CustomView_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

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

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

     *            type="object",

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

     *        type="object",

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

                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

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\Response(

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

     *            name="cvId",

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

     *            name="cvId",

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

     *            required=true

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\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

     *        ),

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

     *        title="Base module - Response action - data of custom view list",

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

     * @OA\Schema(

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

     *        description="Module action - custom view for specific ID - response body",

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="isFeatured", type="boolean", description="Custom view is in favorites", example=false),

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

     *        description="Module action - custom view for specific ID - response body",

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

     *            ref="#/components/schemas/BaseModule_CustomViewById_Result",

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

     *        @OA\Property(property="cvid", type="integer", description="Custom view ID", example=12),

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

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

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

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

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

     *        ),

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

     *            description="Data of custom view",

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

     */

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

     *    @OA\Get(

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

     *            description="Custom view ID",

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

            foreach (\CustomView_Record_Model::getAll($moduleName, false) as $cvId => $recordModel) {

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/BaseModule_Get_CustomViewById_Response"),

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

     *            response=403,

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

     *        title="Base module - Response action - data of custom view list",

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

     *            property="result",

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

     *        schema="BaseModule_CustomViewById_Result",

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

        $response = [];

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

        $columns = array_flip(['cvid', 'viewname', 'entitytype', 'sequence', 'description', 'color']);

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

                $response[$cvId]['isDefault'] = $defaultId === $recordModel->getId();

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

     *        schema="BaseModule_Get_CustomViewById_Response",

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="color", type="string", description="Color for custom view", example="#c28306"),

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

        $defaultId = $this->customView->getViewId(true);

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\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

     *            response=405,

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

     *        summary="Data of custom view",

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

     *        summary="Data of custom view",

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

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

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

     *        @OA\Response(

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="status", type="integer", enum={0, 1}, 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

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

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

     *        required={"cvid", "viewname", "entitytype", "sequence", "description", "color", "isFeatured", "isDefault"},

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

     *        @OA\Property(property="color", type="string", description="Color for custom view", example="#c28306"),

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

     *    ),

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

     *        @OA\Property(

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(property="isDefault", type="boolean", description="Custom view is default", example=false),

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

    {

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

            $recordModel = \CustomView_Record_Model::getInstanceById($this->cvId);

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

            $response['isFeatured'] = $recordModel->isFeatured();

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

                $response[$cvId]['isFeatured'] = $recordModel->isFeatured();

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

     *    ),

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

     *            description="Data of custom view",

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

     *        schema="BaseModule_CustomViewById_Result",

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

     *        @OA\Property(property="isFeatured", type="boolean", description="Custom view is in favorites", example=false),

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

                $response[$cvId] = array_intersect_key($recordModel->getData(), $columns);

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\Property(property="isDefault", type="boolean", description="Custom view is default", example=false),

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

     *        @OA\Property(property="entitytype", type="string", description="Module name", example="Accounts"),

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

     *        @OA\Property(property="description", type="string", description="Custom view description", example="Description"),

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

        if ($this->cvId) {

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

            $response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

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

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

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

     *        required={"cvid", "viewname", "entitytype", "sequence", "description", "color", "isFeatured", "isDefault"},

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

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

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

     *        title="Base module - Response action - data of custom view by specific ID",

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(

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="Data of custom view by specific ID",

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

     *        @OA\Property(property="description", type="string", description="Custom view description", example="Description"),

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

     *        title="Base module - Response action - data of custom view by specific ID",

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

     *        @OA\Property(property="status", type="integer", enum={0, 1}, 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

     *            ref="#/components/schemas/BaseModule_CustomViewById_Result",

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\Property(property="viewname", type="string", description="Custom view name", example="Test 1"),

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

     *        @OA\Property(property="viewname", type="string", description="Custom view name", example="Test 1"),

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

            $response = array_intersect_key($recordModel->getData(), $columns);

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

            $response['isDefault'] = $defaultId === $recordModel->getId();

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

        } else {

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_CustomViewById_Response",

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={"status", "result"},

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

     *        @OA\Property(property="cvid", type="integer", description="Custom view ID", example=12),

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

     *        @OA\Property(property="entitytype", type="string", description="Module name", example="Accounts"),

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

        return $response;

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

    }

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\Schema(

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

     *        title="Data of custom view by specific ID",

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

    public $allowedHeaders = ['x-cv-id'];

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

    /** @var int Custom view ID. */

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

    /**

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

        if ($this->controller->request->has('record')) {

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

    }

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

     * @return array

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

        $this->customView = \App\CustomView::getInstance($this->controller->request->getModule());

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

    protected $cvId;

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

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

    /** @var \App\CustomView Custom view instance. */

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

            $this->cvId = $this->controller->request->getInteger('record');

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

            if (!$this->customView->isPermittedCustomView($this->cvId)) {

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

    /** {@inheritdoc}  */

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

                throw new \Api\Core\Exception('No permissions to view record', 403);

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

     *    @OA\Get(

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

    {

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

     *

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

    protected $customView;

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

        parent::checkPermission();

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

     *

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

            }

Line exceeds 120 characters; contains 145 characters
Open

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

Line exceeds 120 characters; contains 125 characters
Open

     *            description="`No permissions to view record` OR `No permissions for module or data provided in the request`",

Line exceeds 120 characters; contains 189 characters
Open

     *        @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),

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

    protected function checkPermission(): void

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

     * Get custom view list method.

Line exceeds 120 characters; contains 145 characters
Open

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

Line exceeds 120 characters; contains 122 characters
Open

     *        @OA\Property(property="isFeatured", type="boolean", description="Custom view is in favorites", example=false),

Line exceeds 120 characters; contains 189 characters
Open

     *        @OA\Property(property="status", type="integer", enum={0, 1}, description="A numeric value of 0 or 1 that indicates whether the communication is valid. 1 - success , 0 - error"),

Line exceeds 120 characters; contains 126 characters
Open

     *        @OA\Property(property="description", type="string", description="Custom view description", example="Description"),

Line exceeds 120 characters; contains 140 characters
Open

            $response['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

Line exceeds 120 characters; contains 151 characters
Open

                $response[$cvId]['viewname'] = \App\Language::translate(\App\Purifier::decodeHtml($recordModel->getName()), $moduleName, false, false);

There are no issues that match your filters.

Category
Status