YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
2 hrs
Test Coverage
F
39%

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

    public function get(): array
    {
        $file = $pdfFiles = $increment = [];
        $recordId = $this->controller->request->getInteger('record');
        foreach ($this->controller->request->getArray('templates', 'Integer') as $templateId) {
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Pdf.php - About 1 hr to fix

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

        public function get(): array
        {
            $file = $pdfFiles = $increment = [];
            $recordId = $this->controller->request->getInteger('record');
            foreach ($this->controller->request->getArray('templates', 'Integer') as $templateId) {
    Severity: Minor
    Found in api/webservice/WebservicePremium/BaseModule/Pdf.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

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

        public function get(): array
        {
            $file = $pdfFiles = $increment = [];
            $recordId = $this->controller->request->getInteger('record');
            foreach ($this->controller->request->getArray('templates', 'Integer') as $templateId) {

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Missing class import via use statement (line '41', column '14').
    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

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

                throw new \Api\Core\Exception('Record doesn\'t exist', 404);

    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 '30', column '14').
    Open

                throw new \Api\Core\Exception('No record id', 404);

    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 '37', column '14').
    Open

                throw new \Api\Core\Exception("No permissions for action ExportPdf in {$moduleName} module", 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

    Avoid using static access to class '\App\Record' in method 'checkPermission'.
    Open

            if (!\App\Record::isExists($this->controller->request->getInteger('record'), $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\Pdf\Pdf' in method 'get'.
    Open

                $pdf = \App\Pdf\Pdf::getInstanceByTemplateId($templateId);

    StaticAccess

    Since: 1.4.0

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

    Example

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

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

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

            $recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $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\Zip' in method 'get'.
    Open

                $zip = \App\Zip::createFile($zipPath);

    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 '\Api\WebservicePremium\Privilege' in method 'checkPermission'.
    Open

            if (!\Api\WebservicePremium\Privilege::isPermitted($moduleName, 'ExportPdf')) {

    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 "record" 4 times.
    Open

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

    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;

    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\Parameter(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

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

         *        @OA\Parameter(name="templates", in="query", description="Pdf templates ids", required=true,

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

         *            @OA\JsonContent(type="integer", description="Pdf templates ids"),

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

         *        path="/webservice/WebservicePremium/{moduleName}/Pdf/{recordId}",

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

         *        ),

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

         *        description="Get PDF file by template",

    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(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

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

    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

         *        summary="Generates and downloads a PDF file from a template",

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

    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\Parameter(name="templates", in="query", description="Pdf templates ids", required=true,

    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="Get PDF file by template",

    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

         * ),

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

         *                 @OA\Property(property="name", type="string", example="order.pdf"),

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

        {

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

                $pdf = \App\Pdf\Pdf::getInstanceByTemplateId($templateId);

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

                }

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

                $pdf->loadTemplateData();

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

                $zipPath = $template->getPath('APIZIP');

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

                $file = ['name' => 'PdfZipFile_' . time() . '.zip', 'data' => base64_encode(file_get_contents($zipPath))];

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

         *            @OA\JsonContent(type="integer", description="Pdf templates ids"),

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

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

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

         *        title="Base module - Generate PDF response 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

            return $file;

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

         *        summary="Generates and downloads a PDF file from a template",

    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/BaseModule_Get_Pdf_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

         *            response=405,

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

         *        ),

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

         *            title="Pdf",

    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="No permissions to view record",

    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

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

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

                if (!$template || !$template->isVisible('Detail') || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {

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

                $increment[$fileName] = $increment[$fileName] ?? 0;

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

                unlink($zipPath);

    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 permissions to view record",

    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="name", type="string", example="order.pdf"),

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

                $zip = \App\Zip::createFile($zipPath);

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

            foreach ($pdfFiles as $pdfFile) {

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

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

         *            type="object",

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

         *            @OA\AdditionalProperties(

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

                    continue;

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

                }

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

                unlink($pdfFile['path']);

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

         *            description="No permissions for action ExportPdf in {moduleName} 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

         *                type="object",

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

         *             ),

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

                $filePath = $template->getPath();

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

         *            description="Generate PDF",

    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

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

    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="data", type="string", format="binary"),

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

         *                 @OA\Property(property="data", type="string", format="binary"),

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

         *    ),

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

                $pdfFiles[] = ['path' => $filePath,    'name' => $fileName];

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

         *            response=404,

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

         *            description="No record id",

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

         *        ),

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

                $pdf->output($filePath, 'F');

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

            } elseif ($pdfFiles) {

    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

         *        title="Base module - Generate PDF response schema",

    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

         *             ),

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

         *        ),

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

                $fileName = ($pdf->getFileName() ?: time());

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

                foreach ($pdfFiles as $file) {

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

                $file = ['name' => $file['name'], 'data' => base64_encode(file_get_contents($file['path']))];

    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 permissions for action ExportPdf in {moduleName} module",

    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

            $file = $pdfFiles = $increment = [];

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

            foreach ($this->controller->request->getArray('templates', 'Integer') as $templateId) {

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

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

         *            @OA\AdditionalProperties(

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

                $file = current($pdfFiles);

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

         *            description="No record id",

    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

         *        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

        public function get(): array

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

                $template->setVariable('recordId', $recordId);

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

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

         *                title="Pdf detail",

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

                $fileName .= ($increment[$fileName]++ > 0 ? '_' . $increment[$fileName] : '') . '.pdf';

    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

         *            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

         *        schema="BaseModule_Get_Pdf_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

                $template = $pdf->getTemplate();

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

                    $zip->addFile($file['path'], $file['name']);

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

        }

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

         *            description="Generate PDF",

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

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

         *                title="Pdf detail",

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

         *    ),

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

                $pdfFiles[] = ['path' => $filePath,    'name' => $fileName];

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

            if (\count($pdfFiles) > 1) {

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

                $zip->close();

    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

         * Get method - Generates and downloads a PDF file from a template.

    Line exceeds 120 characters; contains 135 characters
    Open

         *        @OA\Parameter(name="recordId", in="path", @OA\Schema(type="integer"), description="Record id", required=true, example=116),

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

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

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

            if (!$recordModel->isViewable()) {

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

            }

    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

         *        path="/webservice/WebservicePremium/{moduleName}/Pdf/{recordId}",

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

            $recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);

    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

            if ($this->controller->request->isEmpty('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

         *

    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

            if (!\Api\WebservicePremium\Privilege::isPermitted($moduleName, 'ExportPdf')) {

    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

        {

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

                throw new \Api\Core\Exception('No record id', 404);

    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

                throw new \Api\Core\Exception('Record doesn\'t exist', 404);

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

                throw new \Api\Core\Exception("No permissions for action ExportPdf in {$moduleName} module", 405);

    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

        }

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

    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

            }

    Line exceeds 120 characters; contains 124 characters
    Open

            $recordModel = \Vtiger_Record_Model::getInstanceById($this->controller->request->getInteger('record'), $moduleName);

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

            if (!\App\Record::isExists($this->controller->request->getInteger('record'), $moduleName)) {

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

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

    Line exceeds 120 characters; contains 150 characters
    Open

                if (!$template || !$template->isVisible('Detail') || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {

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

    There are no issues that match your filters.

    Category
    Status