YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/views/TimeLineModal.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

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

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

The method postProcess has a boolean flag argument $display, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function postProcess(App\Request $request, $display = true)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

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

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

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

The method preProcess has a boolean flag argument $display, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function preProcess(App\Request $request, $display = true)

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

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

Avoid using static access to class '\App\Language' in method 'preProcess'.
Open

                <button type="button" class="close" data-dismiss="modal" title="' . \App\Language::translate('LBL_CLOSE') . '">

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 'checkPermission'.
Open

        if (!\App\Privilege::isPermitted($moduleName, 'TimeLineList') || !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {

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

        $request->set('type', Vtiger_HistoryRelation_Widget::getActions());

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

        $instance->record = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));

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 'checkPermission'.
Open

        if (!\App\Privilege::isPermitted($moduleName, 'TimeLineList') || !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {

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 'preProcess'.
Open

                <h5 class="modal-title">' . \App\Language::translate('LBL_TIMELINE', $request->getModule()) . ' </h5>

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

        $request->set('limit', App\Config::module('ModTracker', 'TIMELINE_IN_LISTVIEW_LIMIT'));

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

        $viewClassName = Vtiger_Loader::getComponentClassName('View', 'Detail', $moduleName);

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 "record" 3 times.
Open

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

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.

Avoid unused parameters such as '$display'.
Open

    public function postProcess(App\Request $request, $display = true)

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

Avoid unused parameters such as '$display'.
Open

    public function preProcess(App\Request $request, $display = true)

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

Default value for \type $display can't be true
Open

    public function preProcess(App\Request $request, $display = true)
Severity: Minor
Found in modules/Vtiger/views/TimeLineModal.php by phan

Parameter $display has undeclared type \type
Open

    public function preProcess(App\Request $request, $display = true)
Severity: Minor
Found in modules/Vtiger/views/TimeLineModal.php by phan

Call to method getInstance from undeclared class \Vtiger_DetailView_Model
Open

        $instance->record = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));
Severity: Critical
Found in modules/Vtiger/views/TimeLineModal.php by phan

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

class Vtiger_TimeLineModal_View extends Vtiger_BasicModal_View

The class Vtiger_TimeLineModal_View is not named in CamelCase.
Open

class Vtiger_TimeLineModal_View extends Vtiger_BasicModal_View
{
    /**
     * Checking permission.
     *

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

        $moduleName = $request->getModule();

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

     * The initial process.

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

    public function preProcess(App\Request $request, $display = true)

Line exceeds 120 characters; contains 127 characters
Open

                <button type="button" class="close" data-dismiss="modal" title="' . \App\Language::translate('LBL_CLOSE') . '">

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

        $request->set('type', Vtiger_HistoryRelation_Widget::getActions());

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

        }

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

    }

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

     * @param \App\Request $request

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

    public function postProcess(App\Request $request, $display = true)

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

     * @param \App\Request $request

Line exceeds 120 characters; contains 163 characters
Open

        if (!\App\Privilege::isPermitted($moduleName, 'TimeLineList') || !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {

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

    public function process(App\Request $request)

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

        $request->set('limit', App\Config::module('ModTracker', 'TIMELINE_IN_LISTVIEW_LIMIT'));

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

        $request->set('noMore', true);

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

     * @param mixed        $display

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

        echo '</div>';

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

        echo '<div class="modal-header">

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

    {

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

     * Proceess.

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

     * Checking permission.

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 type         $display

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

        parent::preProcess($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

     *

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

     * The final process.

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

    /**

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

        if (!\App\Privilege::isPermitted($moduleName, 'TimeLineList') || !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {

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

     * @throws \App\Exceptions\NoPermittedToRecord

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

        $viewClassName = Vtiger_Loader::getComponentClassName('View', 'Detail', $moduleName);

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

        $instance = new $viewClassName();

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

        parent::postProcess($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

        $this->preProcess($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

        $instance->record = Vtiger_DetailView_Model::getInstance($moduleName, $request->getInteger('record'));

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

        echo $instance->showRecentRelation($request);

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

        $this->postProcess($request);

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

class Vtiger_TimeLineModal_View extends Vtiger_BasicModal_View

There are no issues that match your filters.

Category
Status