YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/models/Notebook.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%

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

        $row = (new \App\Db\Query())->from('vtiger_module_dashboard_widgets')
Severity: Minor
Found in modules/Vtiger/models/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 'getLastSavedDate'.
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Minor
Found in modules/Vtiger/models/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\Purifier' in method 'getLastSavedDate'.
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Minor
Found in modules/Vtiger/models/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 'getContent'.
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Minor
Found in modules/Vtiger/models/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\User' in method 'getUserInstance'.
Open

            ->where(['vtiger_links.linktype' => 'DASHBOARDWIDGET', 'vtiger_module_dashboard_widgets.id' => $widgetId, 'vtiger_module_dashboard_widgets.userid' => \App\User::getCurrentUserId()])
Severity: Minor
Found in modules/Vtiger/models/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\Purifier' in method 'getContent'.
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Minor
Found in modules/Vtiger/models/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

Call to undeclared method \Vtiger_Notebook_Model::setData
Open

            $self->setData($row);
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

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

        return App\Db::getInstance()->createCommand()->update('vtiger_module_dashboard_widgets', ['data' => $this->get('data')], ['id' => $this->get('id')])->execute();
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Return type of getUserInstance() is undeclared type \self
Open

    public static function getUserInstance($widgetId)
Severity: Minor
Found in modules/Vtiger/models/Notebook.php by phan

Call to method getCurrentUserId from undeclared class \App\User (Did you mean class \Tests\App\User)
Open

            ->where(['vtiger_links.linktype' => 'DASHBOARDWIDGET', 'vtiger_module_dashboard_widgets.id' => $widgetId, 'vtiger_module_dashboard_widgets.userid' => \App\User::getCurrentUserId()])
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Call to undeclared method \Vtiger_Notebook_Model::get
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Class extends undeclared class \Vtiger_Widget_Model
Open

class Vtiger_Notebook_Model extends Vtiger_Widget_Model
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Call to undeclared method \Vtiger_Notebook_Model::get
Open

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Call to undeclared method \App\Db\Query::from
Open

        $row = (new \App\Db\Query())->from('vtiger_module_dashboard_widgets')
Severity: Critical
Found in modules/Vtiger/models/Notebook.php by phan

Call to undeclared method \Vtiger_Notebook_Model::get
Open

        return App\Db::getInstance()->createCommand()->update('vtiger_module_dashboard_widgets', ['data' => $this->get('data')], ['id' => $this->get('id')])->execute();
Severity: Critical
Found in modules/Vtiger/models/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_Model extends Vtiger_Widget_Model

The class Vtiger_Notebook_Model is not named in CamelCase.
Open

class Vtiger_Notebook_Model extends Vtiger_Widget_Model
{
    public function getContent()
    {
        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));
Severity: Minor
Found in modules/Vtiger/models/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

    public function save(): bool

Line exceeds 120 characters; contains 193 characters
Open

            ->where(['vtiger_links.linktype' => 'DASHBOARDWIDGET', 'vtiger_module_dashboard_widgets.id' => $widgetId, 'vtiger_module_dashboard_widgets.userid' => \App\User::getCurrentUserId()])

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

            ->where(['vtiger_links.linktype' => 'DASHBOARDWIDGET', 'vtiger_module_dashboard_widgets.id' => $widgetId, 'vtiger_module_dashboard_widgets.userid' => \App\User::getCurrentUserId()])

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

        return $data['lastSavedOn'];

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

     * Function to get info about widget.

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

        }

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

        return $data['contents'];

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

    /**

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

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));

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

    public static function getUserInstance($widgetId)

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

            ->innerJoin('vtiger_links', 'vtiger_links.linkid = vtiger_module_dashboard_widgets.linkid')

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

        return $self;

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

            ->one();

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

     * Function to update the widget.

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

    public function getContent()

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

     * @param int $widgetId

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

     *

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

            $self->setData($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

     * @return \self

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

        $self = new self();

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

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

        $row = (new \App\Db\Query())->from('vtiger_module_dashboard_widgets')

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

        $data = \App\Json::decode(App\Purifier::decodeHtml($this->get('data')));

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

        return App\Db::getInstance()->createCommand()->update('vtiger_module_dashboard_widgets', ['data' => $this->get('data')], ['id' => $this->get('id')])->execute();

Line exceeds 120 characters; contains 168 characters
Open

        return App\Db::getInstance()->createCommand()->update('vtiger_module_dashboard_widgets', ['data' => $this->get('data')], ['id' => $this->get('id')])->execute();

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

    }

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

class Vtiger_Notebook_Model extends Vtiger_Widget_Model

There are no issues that match your filters.

Category
Status