YetiForceCompany/YetiForceCRM

View on GitHub
api/webservice/WebserviceStandard/BaseAction/Files.php

Summary

Maintainability
A
0 mins
Test Coverage
C
78%

Missing class import via use statement (line '164', column '13').
Open

        throw new \Api\Core\Exception('Invalid method', 405);

MissingImport

Since: 2.7.0

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

Example

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

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

Missing class import via use statement (line '152', column '14').
Open

            throw new \Api\Core\Exception('Invalid method', 405);

MissingImport

Since: 2.7.0

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

Example

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

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

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

                throw new \Api\Core\Exception('No permissions', 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 '\Vtiger_Loader' in method 'put'.
Open

        $handlerClass = \Vtiger_Loader::getComponentClassName('File', $action, $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

 *    @OA\Info(

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

 *     )

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

    /** {@inheritdoc}  */

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

 *        url="https://gitstable.yetiforce.com",

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

 *         title="YetiForce API for Webservice App. Type: WebserviceStandard",

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

 *         version="0.2",

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

 *             url="https://yetiforce.com/"

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

 *    )

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

 *        description="Access to user methods"

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

 *        description="Access to record methods"

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

 *       @OA\Contact(

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

 *             url="https://yetiforce.com/en/yetiforce/license"

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

    public $responseType = 'file';

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

     * @return \App\Fields\File

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

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

     *            response=404,

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

     *        ),

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="BaseAction_Files_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="field", type="string", description="Field name. Required for MultiImage action", example="imagename"),

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

 *            name="YetiForce Public License",

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

 *       ),

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

 *    @OA\Server(

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

 *    )

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

     *        description="Download files from the system",

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

     *        security={

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

     *            description="No permissions",

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\Property(property="module", type="string", description="Module name", example="Contacts"),

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

     *        summary="Download files",

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

     *        @OA\RequestBody(

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="Action parameters to download the file",

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

     *                 mediaType="application/x-www-form-urlencoded",

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

     *                 @OA\Schema(ref="#/components/schemas/BaseAction_Files_Request")

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\Property(property="record", type="integer", description="Record ID",  example=123),

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

 *    @OA\Tag(

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

 *        name="Users",

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

 *        description="Access to user methods"

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

     *

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

     *        summary="Download files",

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

     *                )

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

     *            description="File not found",

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="Not Acceptable",

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\Property(property="actionName", type="string", enum={"MultiImage", "DownloadFile"}, description="Action name",  example="MultiImage"),

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

 *             name="Devs API Team",

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

 *        name="BaseAction",

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

    public $allowedMethod = ['PUT'];

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

     * @throws \Api\Core\Exception

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

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

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

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

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

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

     *        @OA\Property(property="record", type="integer", description="Record ID",  example=123),

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

     */

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

 *             email="devs@yetiforce.com",

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

 *    @OA\Tag(

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

    /** {@inheritdoc}  */

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

     *

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

     *        tags={"BaseAction"},

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

     *             @OA\MediaType(

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

     *          ),

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

     *            description="File content, mediaType is dynamic depending on the type of file being downloaded",

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

     *            description="File content, mediaType is dynamic depending on the type of file being downloaded",

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

     *        ),

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

     *         title="Base action - Files request schema",

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

     *        @OA\Property(property="key", type="string", description="Unique key for attachment. Required for MultiImage action", example="14f01c4ea4da107c4145f0519ea1b9027fb24aa7MS2AqcUFuC")

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

 *       @OA\License(

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

 *    )

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

 *        description="Demo server of the latest stable version",

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

 *    )

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

 *    @OA\Server(

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

    /**

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

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

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

     *          required=true,

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

     *            response=200,

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

     *                    format="binary"

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

     *                 @OA\Schema(ref="#/components/schemas/BaseAction_Files_Request")

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

     *        ),

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

     *                    type="string",

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="field", type="string", description="Field name. Required for MultiImage action", example="imagename"),

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

     *            description="No permissions",

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

     *        @OA\Property(property="key", type="string", description="Unique key for attachment. Required for MultiImage action", example="14f01c4ea4da107c4145f0519ea1b9027fb24aa7MS2AqcUFuC")

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

     * ),

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

    public function put()

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

    {

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

 *         description="Skip the `/webservice` fragment for connections via ApiProxy. There are two ways to connect to API, with or without rewrite, below are examples of both:

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

 *    @OA\Tag(

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

     *                 mediaType="application/x-www-form-urlencoded",

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

     *             @OA\MediaType(

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="Invalid method",

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

        $action = $this->controller->request->getByType('actionName', 1);

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

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

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

            }

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

     *        path="/webservice/WebserviceStandard/Files",

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

     *             @OA\MediaType(

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

     *             @OA\MediaType(

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

     *                mediaType="application/octet-stream",

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

     *                    type="string",

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=406,

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

     *         title="Base action - Files request 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

     *         required={"module", "actionName", "record"},

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

        \App\Process::$processType = 'File';

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

     * Put method.

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

     *        description="Download files from the system",

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

     *        },

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

     *            description="Action parameters to download the file",

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

     *                    format="binary"

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

     *             )

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

     *            response=404,

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

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

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

        throw new \Api\Core\Exception('Invalid method', 405);

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

 *         termsOfService="https://yetiforce.com/",

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

 *        url="https://gitdeveloper.yetiforce.com",

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

 *        description="Demo server of the development version",

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

 *        name="BaseModule",

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

     *        path="/webservice/WebserviceStandard/Files",

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

     *        security={

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=405,

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

     *         description="Action parameters to download the file",

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

     *         required={"module", "actionName", "record"},

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

        }

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

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

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

     *        @OA\RequestBody(

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

     *                mediaType="application/octet-stream",

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

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

     *            description="File not found",

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

     *        ),

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

     *         schema="BaseAction_Files_Request",

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

        if (!$moduleName || !$action) {

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

            throw new \Api\Core\Exception('Invalid method', 405);

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

    }

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

     * @OA\Put(

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

     *        tags={"BaseAction"},

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

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

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

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

     *            response=406,

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\Property(property="actionName", type="string", enum={"MultiImage", "DownloadFile"}, description="Action name",  example="MultiImage"),

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

            return $handler->api($this->controller->request);

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

        if ($handler) {

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

        }

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

        $handlerClass = \Vtiger_Loader::getComponentClassName('File', $action, $moduleName);

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

        $handler = new $handlerClass();

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

        \App\Process::$processName = $action;

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

     * @api

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

     *

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

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

     *            description="Not Acceptable",

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

     *         description="Action parameters to download the file",

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

            if (!$handler->getCheckPermission($this->controller->request)) {

Line exceeds 120 characters; contains 173 characters
Open

 *         description="Skip the `/webservice` fragment for connections via ApiProxy. There are two ways to connect to API, with or without rewrite, below are examples of both:

Line exceeds 120 characters; contains 131 characters
Open

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

Line exceeds 120 characters; contains 150 characters
Open

     *        @OA\Property(property="actionName", type="string", enum={"MultiImage", "DownloadFile"}, description="Action name",  example="MultiImage"),

Line exceeds 120 characters; contains 137 characters
Open

     *        @OA\Property(property="field", type="string", description="Field name. Required for MultiImage action", example="imagename"),

Line exceeds 120 characters; contains 190 characters
Open

     *        @OA\Property(property="key", type="string", description="Unique key for attachment. Required for MultiImage action", example="14f01c4ea4da107c4145f0519ea1b9027fb24aa7MS2AqcUFuC")

There are no issues that match your filters.

Category
Status