YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Backup/actions/DownloadFile.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE');

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

            throw new \App\Exceptions\NoPermitted('ERR_FILE_EMPTY_NAME');

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 \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE');

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\Utils\Backup' in method 'process'.
Open

        if (!\in_array($extension, \App\Utils\Backup::getAllowedExtension())) {

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\Fields\File' in method 'process'.
Open

        if (!App\Fields\File::isAllowedFileDirectory($filePath)) {

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\Utils\Backup' in method 'process'.
Open

        $filePath = \App\Utils\Backup::getBackupCatalogPath() . DIRECTORY_SEPARATOR . $requestFilePath;

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

Reference to static property rewrite from undeclared class \CsrfMagic\Csrf
Open

        \CsrfMagic\Csrf::$rewrite = false;

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Settings_Backup_DownloadFile_Action extends Settings_Vtiger_Index_Action

The class Settings_Backup_DownloadFile_Action is not named in CamelCase.
Open

class Settings_Backup_DownloadFile_Action extends Settings_Vtiger_Index_Action
{
    /** {@inheritdoc} */
    public function __construct()
    {

CamelCaseClassName

Since: 0.2

It is considered best practice to use the CamelCase notation to name classes.

Example

class class_name {
}

Source

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

        $extension = strtolower(array_pop($extension));

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 function __construct()

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

        if (!\in_array($extension, \App\Utils\Backup::getAllowedExtension())) {

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

        parent::__construct();

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

        if ($request->isEmpty('file')) {

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

        $extension = explode('.', $requestFilePath);

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

    public function process(App\Request $request)

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

    {

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

        $requestFilePath = $request->getByType('file', \App\Purifier::PATH);

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

        \CsrfMagic\Csrf::$rewrite = false;

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

        header('content-description: File Transfer');

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

        }

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

        header('content-disposition: attachment; filename=' . basename($filePath));

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

            throw new \App\Exceptions\NoPermitted('ERR_FILE_EMPTY_NAME');

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

        ob_implicit_flush();

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

            throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE');

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

            throw new \App\Exceptions\NoPermitted('ERR_ILLEGAL_VALUE');

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

        header('pragma: private');

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

    }

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

        header('content-type: application/octet-stream');

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

        header('content-transfer-encoding: binary');

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

        $filePath = \App\Utils\Backup::getBackupCatalogPath() . DIRECTORY_SEPARATOR . $requestFilePath;

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

        header('accept-ranges: bytes');

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

        readfile($filePath);

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

        }

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

        header('content-length: ' . filesize($filePath));

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

        header('cache-control: no-cache, must-revalidate');

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

        if (!App\Fields\File::isAllowedFileDirectory($filePath)) {

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

        header('expires: Mon, 26 Jul 1997 05:00:00 GMT');

Class name "Settings_Backup_DownloadFile_Action" is not in camel caps format
Open

class Settings_Backup_DownloadFile_Action extends Settings_Vtiger_Index_Action

There are no issues that match your filters.

Category
Status