YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using static access to class '\Vtiger_Record_Model' in method 'put'.
Open

        $recordModel = \Vtiger_Record_Model::getCleanInstance($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

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

use OpenApi\Annotations as OA;

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_Put_SourceBasedData_Request"),

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

     *                 @OA\Property(property="sourceModule", type="string", description="Source module", example="Accounts"),

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

     *                 @OA\Property(property="sourceModule", type="string", description="Source module", example="Accounts"),

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

     *                 @OA\Property(property="sourceRecord", type="integer", description="Source record ID", example=221),

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

    public function put(): array

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

        }

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

     *        oneOf={

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

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

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

     *                 @OA\Property(property="sourceRecordData", title="Record data", type="object", ref="#/components/schemas/Record_Edit_Details"),

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

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

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

     *        },

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

     *        oneOf={

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

     *            ),

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

     *        schema="BaseModule_Put_SourceBasedData_Response",

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

     *            required={"data", "rawData"},

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

     *        @OA\RequestBody(required=true, description="Contents of the request contains an associative array with the data record.",

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="Base module - Source-based data response",

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

     *                required={"sourceModule", "sourceRecord"},

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

            'rawData' => $raw

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

     *                 @OA\Property(property="sourceRecord", type="integer", description="Source record ID", example=221),

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

     *                required={"sourceRecordData"},

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

     *                required={"sourceRecordData"},

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

     *        title="Base module - Source-based data response",

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

     *        description="Data to auto-complete in compose 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

        $raw = $data = [];

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

            $recordModel->set($fieldName, $value);

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

     *        description="Get the record by sources",

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

     *        description="Get the record by sources",

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

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

     *        schema="BaseModule_Put_SourceBasedData_Response",

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="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

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

     *        description="Data to auto-complete in compose view",

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

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="object", title="Create a record from a related module",

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

     *    @OA\Schema(

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

     *            @OA\Property(property="data", title="Record data", type="object", ref="#/components/schemas/Record_Display_Details"),

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

        foreach (array_keys($raw) as $fieldName) {

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

            'data' => $data,

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

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

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

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

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

     *                required={"sourceModule", "sourceRecord"},

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

     *            @OA\Schema(type="object", title="Create a record from a reference field",

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

     *        summary="Gets the record data from sources",

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

     *        @OA\RequestBody(required=true, description="Contents of the request contains an associative array with the data record.",

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

     *        ),

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

     *        schema="BaseModule_Put_SourceBasedData_Request",

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

     *        title="Base module - Source-based data request",

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

     *                 @OA\Property(property="sourceRecordData", title="Record data", type="object", ref="#/components/schemas/Record_Edit_Details"),

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

        return [

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\Response(response=200, description="Source-based data 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\Schema(type="object", title="Create a record from a related module",

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

     *        @OA\Property(property="result", type="object", title="Returns record data",

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

     *            @OA\Property(property="data", title="Record data", type="object", ref="#/components/schemas/Record_Display_Details"),

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

     *    ),

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

        foreach ($recordModel->getModule()->getValuesFromSource($this->controller->request) as $fieldName => $value) {

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

    }

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

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

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(type="object", title="Create a record from a reference field",

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

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

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

     *        summary="Gets the record data from sources",

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

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

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

     *        ),

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

     *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

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

     *        @OA\Response(response=200, description="Source-based data response",

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

     *        schema="BaseModule_Put_SourceBasedData_Request",

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

        $recordModel = \Vtiger_Record_Model::getCleanInstance($moduleName);

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

     *        @OA\Property(property="result", type="object", title="Returns record data",

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

     *            required={"data", "rawData"},

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 - Source-based data request",

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="rawData", description="Raw record data", type="object", ref="#/components/schemas/Record_Raw_Details"),

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

     *            @OA\Property(property="rawData", description="Raw record data", type="object", ref="#/components/schemas/Record_Raw_Details"),

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

     *        ),

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

            $raw[$fieldName] = $recordModel->getRawValue($fieldName);

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

            $data[$fieldName] = $recordModel->getModule()->getFieldByName($fieldName)->getUITypeModel()->getApiDisplayValue($recordModel->get($fieldName), $recordModel);

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

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

     *

Line exceeds 120 characters; contains 142 characters
Open

     *            @OA\Property(property="rawData", description="Raw record data", type="object", ref="#/components/schemas/Record_Raw_Details"),

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

     * @return array

Line exceeds 120 characters; contains 131 characters
Open

     *        @OA\Parameter(name="X-ENCRYPTED", in="header", @OA\Schema(ref="#/components/schemas/Header-Encrypted"), required=true),

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

    /** {@inheritdoc}  */

Line exceeds 120 characters; contains 146 characters
Open

     *                 @OA\Property(property="sourceRecordData", title="Record data", type="object", ref="#/components/schemas/Record_Edit_Details"),

Line exceeds 120 characters; contains 133 characters
Open

     *            @OA\Property(property="data", title="Record data", type="object", ref="#/components/schemas/Record_Display_Details"),

Line exceeds 120 characters; contains 122 characters
Open

     *                 @OA\Property(property="sourceModule", type="string", description="Source module", example="Accounts"),

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

    /**

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

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

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

     * Put method - Gets the record data from sources.

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

     * @OA\Put(

Line exceeds 120 characters; contains 133 characters
Open

     *        @OA\RequestBody(required=true, description="Contents of the request contains an associative array with the data record.",

Line exceeds 120 characters; contains 169 characters
Open

            $data[$fieldName] = $recordModel->getModule()->getFieldByName($fieldName)->getUITypeModel()->getApiDisplayValue($recordModel->get($fieldName), $recordModel);

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

    public $allowedMethod = ['PUT'];

There are no issues that match your filters.

Category
Status