YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

Avoid using undefined variables such as '$dataValue' which will lead to PHP notices.
Open

        $dataValue['contents'] = $request->getByType('notePadContent', 'Text');
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$dataValue' which will lead to PHP notices.
Open

        $dataValue['lastSavedOn'] = date('Y-m-d H:i:s');
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

Avoid using undefined variables such as '$dataValue' which will lead to PHP notices.
Open

        $data = \App\Json::encode((object) $dataValue);
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.php by phpmd

UndefinedVariable

Since: 2.8.0

Detects when a variable is used that has not been defined before.

Example

class Foo
{
    private function bar()
    {
        // $message is undefined
        echo $message;
    }
}

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

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

        $response = new Vtiger_Response();
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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 '27', column '14').
Open

            throw new \App\Exceptions\NoPermittedForAdmin('LBL_PERMISSION_DENIED');
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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\Json' in method 'noteBookCreate'.
Open

        $data = \App\Json::encode((object) $dataValue);
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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\Json' in method 'noteBookCreate'.
Open

        $size = \App\Json::encode(['width' => $request->getInteger('width'), 'height' => $request->getInteger('height')]);
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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_Record_Model' in method 'checkPermission'.
Open

        $currentUserModel = Users_Record_Model::getCurrentUserModel();
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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\Db' in method 'noteBookCreate'.
Open

        $db = \App\Db::getInstance();
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.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 unused parameters such as '$request'.
Open

    public function checkPermission(App\Request $request)
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.php by phpmd

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

Variable $dataValue was undeclared, but array fields are being added to it.
Open

        $dataValue['contents'] = $request->getByType('notePadContent', 'Text');
Severity: Info
Found in modules/Vtiger/actions/NoteBook.php by phan

Call to undeclared method \App\Db::createCommand
Open

        $db->createCommand()
Severity: Critical
Found in modules/Vtiger/actions/NoteBook.php by phan

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

class Vtiger_NoteBook_Action extends \App\Controller\Action

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

        $db = \App\Db::getInstance();
Severity: Minor
Found in modules/Vtiger/actions/NoteBook.php by phpmd

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

The class Vtiger_NoteBook_Action is not named in CamelCase.
Open

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

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

        $currentUserModel = Users_Record_Model::getCurrentUserModel();

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

    public function noteBookCreate(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

    {

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

        $size = \App\Json::encode(['width' => $request->getInteger('width'), 'height' => $request->getInteger('height')]);

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

        $this->exposeMethod('noteBookCreate');

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

     * @throws \App\Exceptions\NoPermittedForAdmin

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

    }

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

        $dataValue['contents'] = $request->getByType('notePadContent', 'Text');

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

    {

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

        if (!$currentUserModel->isAdminUser()) {

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

        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

        $response = new Vtiger_Response();

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

    }

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

        $result['widgetId'] = $db->getLastInsertID('vtiger_module_dashboard_id_seq');

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

            ->insert('vtiger_module_dashboard', [

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

    }

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

        $dataValue['lastSavedOn'] = date('Y-m-d H:i:s');

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

        $data = \App\Json::encode((object) $dataValue);

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

                'blockid' => $request->getInteger('blockid'),

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

        $db->createCommand()

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

                'isdefault' => $request->getInteger('isdefault'),

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

     */

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

        $db = \App\Db::getInstance();

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

                'filterid' => 0,

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

                'linkid' => $request->getInteger('linkId'),

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

                'data' => $data,

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

        $result = [];

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

        $response->setResult($result);

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

                'title' => $request->getByType('notePadName', 'Text'),

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

                'size' => $size,

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

        $result['success'] = true;

Line exceeds 120 characters; contains 122 characters
Open

        $size = \App\Json::encode(['width' => $request->getInteger('width'), 'height' => $request->getInteger('height')]);

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

            ])->execute();

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

        $response->emit();

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

class Vtiger_NoteBook_Action extends \App\Controller\Action

There are no issues that match your filters.

Category
Status