YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/MailIntegration/actions/Download.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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\YetiForce\Register' in method 'outlook'.
Open

        $ik = \App\YetiForce\Register::getInstanceKey();

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

        if(!\App\YetiForce\Shop::check('YetiForceOutlook')){

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 unused parameters such as '$request'.
Open

    public function outlook(App\Request $request)

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Reference to static property site_URL from undeclared class \Config\Main
Open

            Config\Main::$site_URL,

Call to method getInstanceKey from undeclared class \App\YetiForce\Register
Open

        $ik = \App\YetiForce\Register::getInstanceKey();

Call to method check from undeclared class \App\YetiForce\Shop
Open

        if(!\App\YetiForce\Shop::check('YetiForceOutlook')){

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

class Settings_MailIntegration_Download_Action extends Settings_Vtiger_Basic_Action

The class Settings_MailIntegration_Download_Action is not named in CamelCase.
Open

class Settings_MailIntegration_Download_Action extends Settings_Vtiger_Basic_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

Avoid variables with short names like $ik. Configured minimum length is 3.
Open

        $ik = \App\YetiForce\Register::getInstanceKey();

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

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

            '{__CRM_URL__}',

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

        $request->validateReadAccess();

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

        $this->exposeMethod('outlook');

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

     *

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

            substr($ik, 0, 30),

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

        ], $body);

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

    /** {@inheritdoc} */

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

     * @param App\Request $request

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

     * @return void

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

        parent::checkPermission($request);

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

        $body = str_replace([

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

            '{__ACCESS_TOKEN__}',

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

        header('content-type: text/xml');

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

            Config\Main::$site_URL,

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

        echo $body;

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

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');

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

     * Generate outlook manifest.

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

        $ik = \App\YetiForce\Register::getInstanceKey();

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

    {

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

        $manifestPath = ROOT_DIRECTORY . '/modules/MailIntegration/installation/outlook.xml';

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

        header('content-disposition: attachment; filename="outlook_manifest.xml";');

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

        if(!\App\YetiForce\Shop::check('YetiForceOutlook')){

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

            vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split($ik, 4)),

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

        $body = file_get_contents($manifestPath);

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

    {

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

            '{__CRM_GUID__}',

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

        header('content-length: ' . \strlen($body));

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

    public function validateRequest(App\Request $request)

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

    public function checkPermission(\App\Request $request)

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

    public function outlook(App\Request $request)

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

        ], [

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

class Settings_MailIntegration_Download_Action extends Settings_Vtiger_Basic_Action

Expected 1 space after closing parenthesis; found 0
Open

        if(!\App\YetiForce\Shop::check('YetiForceOutlook')){

Expected 1 space after IF keyword; 0 found
Open

        if(!\App\YetiForce\Shop::check('YetiForceOutlook')){

There are no issues that match your filters.

Category
Status