YetiForceCompany/YetiForceCRM

View on GitHub
modules/Calendar/actions/Invitees.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Missing class import via use statement (line '50', column '16').
Open

        $rows = (new \App\RecordSearch($value, $modules, 10))->search();
Severity: Minor
Found in modules/Calendar/actions/Invitees.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 '25', column '14').
Open

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
Severity: Minor
Found in modules/Calendar/actions/Invitees.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 '64', column '19').
Open

        $response = new Vtiger_Response();
Severity: Minor
Found in modules/Calendar/actions/Invitees.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 '\App\Record' in method 'find'.
Open

                $label = \App\Record::getLabel($row['crmid']);
Severity: Minor
Found in modules/Calendar/actions/Invitees.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\Language' in method 'find'.
Open

                    'category' => \App\Language::translate($row['setype'], $row['setype']),
Severity: Minor
Found in modules/Calendar/actions/Invitees.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\ModuleHierarchy' in method 'find'.
Open

        $modules = array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(4), \App\ModuleHierarchy::getModulesByLevel(0)));
Severity: Minor
Found in modules/Calendar/actions/Invitees.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\ModuleHierarchy' in method 'find'.
Open

        $modules = array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(4), \App\ModuleHierarchy::getModulesByLevel(0)));
Severity: Minor
Found in modules/Calendar/actions/Invitees.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 'Users_Privileges_Model' in method 'checkPermission'.
Open

        $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
Severity: Minor
Found in modules/Calendar/actions/Invitees.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\Language' in method 'find'.
Open

                    'fullLabel' => \App\Language::translate($row['setype'], $row['setype']) . ': ' . $label,
Severity: Minor
Found in modules/Calendar/actions/Invitees.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\Privilege' in method 'find'.
Open

            if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {
Severity: Minor
Found in modules/Calendar/actions/Invitees.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

Define a constant instead of duplicating this literal "crmid" 3 times.
Open

            if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {
Severity: Critical
Found in modules/Calendar/actions/Invitees.php by sonar-php

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.

Define a constant instead of duplicating this literal "setype" 6 times.
Open

            if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {
Severity: Critical
Found in modules/Calendar/actions/Invitees.php by sonar-php

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.

Argument 1 (mixed) is string but \Users_Privileges_Model::hasModulePermission() takes int defined at /code/modules/Users/models/Privileges.php:101
Open

        if (!$userPrivilegesModel->hasModulePermission($moduleName)) {
Severity: Minor
Found in modules/Calendar/actions/Invitees.php by phan

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

class Calendar_Invitees_Action extends \App\Controller\Action

The class Calendar_Invitees_Action is not named in CamelCase.
Open

class Calendar_Invitees_Action extends \App\Controller\Action
{
    use \App\Controller\ExposeMethod;

    /**
Severity: Minor
Found in modules/Calendar/actions/Invitees.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

    use \App\Controller\ExposeMethod;

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

     */

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

        $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();

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

            return [];

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

        $matchingRecords = [];

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

                    'fullLabel' => \App\Language::translate($row['setype'], $row['setype']) . ': ' . $label,

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

        parent::__construct();

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

                    'id' => $row['crmid'],

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

     *

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 (empty($modules)) {

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

     * Find a records for invitations in CRM.

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

                    'label' => $label,

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

        if (!$userPrivilegesModel->hasModulePermission($moduleName)) {

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

        $rows = (new \App\RecordSearch($value, $modules, 10))->search();

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

            if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {

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

                $label = \App\Record::getLabel($row['crmid']);

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

     * Function to check permission.

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

    }

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

     * Construct.

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

        $this->exposeMethod('find');

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

        foreach ($rows as $row) {

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 = 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

                $matchingRecords[] = [

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

                    'module' => $row['setype'],

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

     */

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

        $modules = array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(4), \App\ModuleHierarchy::getModulesByLevel(0)));

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

     * @throws \App\Exceptions\NoPermitted

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

            throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 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 find(App\Request $request)

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

        $value = $request->getByType('value', 'Text');

Line exceeds 120 characters; contains 131 characters
Open

        $modules = array_keys(array_merge(\App\ModuleHierarchy::getModulesByLevel(4), \App\ModuleHierarchy::getModulesByLevel(0)));

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

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

                    'category' => \App\Language::translate($row['setype'], $row['setype']),

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

        $response->setResult($matchingRecords);

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

class Calendar_Invitees_Action extends \App\Controller\Action

There are no issues that match your filters.

Category
Status