YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/actions/Meeting.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '60', column '19').
Open

        $response = new Vtiger_Response();
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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_Module_Model' in method 'process'.
Open

            $moduleModel = Vtiger_Module_Model::getInstance($request->getModule());
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

        $meeting = \App\MeetingService::getInstance();
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

            \App\Log::error($e->__toString());
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

    public function process(App\Request $request)
    {
        $meeting = \App\MeetingService::getInstance();
        $url = '';
        $date = date('Y-m-d');
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

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

            $this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $moduleName);
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

    public function process(App\Request $request)
    {
        $meeting = \App\MeetingService::getInstance();
        $url = '';
        $date = date('Y-m-d');
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

The method checkPermission uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $moduleName);
            $permission = $this->record->isEditable();
        }
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

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

            $this->record = \Vtiger_Record_Model::getCleanInstance($moduleName);
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

Call to method error from undeclared class \App\Log
Open

            \App\Log::error($e->__toString());
Severity: Critical
Found in modules/Vtiger/actions/Meeting.php by phan

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

class Vtiger_Meeting_Action extends \App\Controller\Action

The class Vtiger_Meeting_Action is not named in CamelCase.
Open

class Vtiger_Meeting_Action extends \App\Controller\Action
{
    /**
     * Record model instance.
     *
Severity: Minor
Found in modules/Vtiger/actions/Meeting.php by phpmd

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

        $response->setResult(['success' => !empty($url), 'url' => $url]);

Line exceeds 120 characters; contains 124 characters
Open

        if (!$permission || !$fieldModel || !$fieldModel->isEditable() || !\App\MeetingService::getInstance()->isActive()) {

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

            $room = $meeting->generateRoomName((string) $request->getByType('roomName', \App\Purifier::TEXT, ''));

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

            $this->record = \Vtiger_Record_Model::getCleanInstance($moduleName);

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

            throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);

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)

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

    protected $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

        $meeting = \App\MeetingService::getInstance();

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

     * @var Vtiger_Record_Model

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

        if ($request->isEmpty('record', true)) {

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

    }

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

            if ($request->has('exp') && ($expFieldName = $request->getByType('expField', \App\Purifier::ALNUM))

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

            }

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

        if (!$permission || !$fieldModel || !$fieldModel->isEditable() || !\App\MeetingService::getInstance()->isActive()) {

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

            ) {

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

            $moduleModel = Vtiger_Module_Model::getInstance($request->getModule());

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

            $url = $meeting->getUrl(['room' => $room, 'exp' => strtotime($date . ' 23:59:59')]);

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

            \App\Log::error($e->__toString());

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

        }

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

                && ($expField = $moduleModel->getFieldByName($expFieldName)) && $expField->isActiveField()

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

        } catch (\Throwable $e) {

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

    public function checkPermission(App\Request $request)

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

            $permission = $this->record->isEditable();

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

        } else {

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

        $url = '';

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

        $date = date('Y-m-d');

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

                $date = $request->getByType('exp', \App\Purifier::DATE_USER_FORMAT, true);

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

     * Record model instance.

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

    {

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

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

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

     *

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

        $fieldModel = $this->record->getField($request->getByType('fieldName', \App\Purifier::ALNUM));

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

        $moduleName = $request->getModule();

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

            $permission = $this->record->isCreateable();

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

class Vtiger_Meeting_Action extends \App\Controller\Action

There are no issues that match your filters.

Category
Status