YetiForceCompany/YetiForceCRM

View on GitHub
modules/Settings/Companies/actions/CheckStatus.php

Summary

Maintainability
A
0 mins
Test Coverage

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

                throw new \App\Exceptions\AppException($error);

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 '24').
Open

            $registration = new \App\YetiForce\Register();

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 '39', column '19').
Open

        $response = new Vtiger_Response();

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 assigning values to variables in if clauses and the like (line '30', column '8').
Open

    public function process(App\Request $request): void
    {
        try {
            $message = '';
            $responseType = 'success';

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

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

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

            $registration = new \App\YetiForce\Register();

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

            if ($error = $registration->getError()) {

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

            $result = $registration->check();

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

class Settings_Companies_CheckStatus_Action extends Settings_Vtiger_Basic_Action

The class Settings_Companies_CheckStatus_Action is not named in CamelCase.
Open

class Settings_Companies_CheckStatus_Action extends Settings_Vtiger_Basic_Action
{
    /**
     * Check registration status.
     *

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

     *

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

            }

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

            $result = false;

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

            $message = $e->getDisplayMessage();

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

            $message = '';

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

        }

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

        $response->emit();

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

            $responseType = 'success';

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

            'success' => $result ?? false,

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

    public function process(App\Request $request): void

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

            if ($error = $registration->getError()) {

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

    {

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

        } catch (\App\Exceptions\AppException $e) {

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

     * Check registration status.

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

                throw new \App\Exceptions\AppException($error);

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

            'type' => $responseType

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

    /**

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

            $registration = new \App\YetiForce\Register();

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

            $responseType = 'error';

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

        $response->setResult([

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

        try {

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

            $result = $registration->check();

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

        $response = new Vtiger_Response();

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

            'message' => $message ?? '',

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

class Settings_Companies_CheckStatus_Action extends Settings_Vtiger_Basic_Action

There are no issues that match your filters.

Category
Status