YetiForceCompany/YetiForceCRM

View on GitHub
modules/Vtiger/inventoryfields/Comment.php

Summary

Maintainability
A
0 mins
Test Coverage
F
34%

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

    public function getListViewDisplayValue($value, array $rowData = [], bool $rawText = false)

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

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

    public function getDisplayValue($value, array $rowData = [], bool $rawText = false)

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

            throw new \App\Exceptions\Security("ERR_ILLEGAL_FIELD_VALUE||$columnName||$value", 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

Avoid using static access to class '\App\Purifier' in method 'getDBValue'.
Open

        return \App\Utils\Completions::encodeAll(\App\Purifier::decodeHtml($value));

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

        $conf = App\Config::module($this->getModuleName(), 'inventoryCommentIframeContent', null);

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

        return \App\Utils\Completions::encode(\App\Purifier::decodeHtml($value));

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\Utils\Completions' in method 'getListViewDisplayValue'.
Open

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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\Layout' in method 'getDisplayValue'.
Open

            return \App\Layout::truncateHtml($value, 'mini', 300);

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\Layout' in method 'getListViewDisplayValue'.
Open

        return $rawText ? $value : \App\Layout::truncateHtml($value, 'mini', 50);

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\Utils\Completions' in method 'getValue'.
Open

        return \App\Utils\Completions::encode(\App\Purifier::decodeHtml($value));

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\Layout' in method 'getDisplayValue'.
Open

        return $rawText ? $value : \App\Layout::truncateHtml($value, 'full');

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\Utils\Completions' in method 'getDBValue'.
Open

        return \App\Utils\Completions::encodeAll(\App\Purifier::decodeHtml($value));

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\Utils\Completions' in method 'getDisplayValue'.
Open

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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 decode from undeclared class \App\Utils\Completions
Open

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));
Severity: Critical
Found in modules/Vtiger/inventoryfields/Comment.php by phan

Call to method encodeAll from undeclared class \App\Utils\Completions
Open

        return \App\Utils\Completions::encodeAll(\App\Purifier::decodeHtml($value));
Severity: Critical
Found in modules/Vtiger/inventoryfields/Comment.php by phan

Call to method decode from undeclared class \App\Utils\Completions
Open

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));
Severity: Critical
Found in modules/Vtiger/inventoryfields/Comment.php by phan

Argument 1 (string) is \type but \App\Purifier::decodeHtml() takes string defined at /code/app/Purifier.php:604
Open

        return \App\Utils\Completions::encode(\App\Purifier::decodeHtml($value));

Call to method encode from undeclared class \App\Utils\Completions
Open

        return \App\Utils\Completions::encode(\App\Purifier::decodeHtml($value));
Severity: Critical
Found in modules/Vtiger/inventoryfields/Comment.php by phan

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

class Vtiger_Comment_InventoryField extends Vtiger_Basic_InventoryField

The class Vtiger_Comment_InventoryField is not named in CamelCase.
Open

class Vtiger_Comment_InventoryField extends Vtiger_Basic_InventoryField
{
    /** {@inheritdoc} */
    protected $type = 'Comment';
    /** {@inheritdoc} */

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

    /** {@inheritdoc} */

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

    protected $onlyOne = false;

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

        return $this->getParamsConfig()['height'] ?? 50;

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

    /**

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

    public function getValue($value)

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

    public function getEditTemplateName()

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

     */

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

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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

        return $rawText ? $value : \App\Layout::truncateHtml($value, 'mini', 50);

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

    public function getDBValue($value, ?string $name = '')

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

        return 'inventoryTypes/Comment.tpl';

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

            throw new \App\Exceptions\Security("ERR_ILLEGAL_FIELD_VALUE||$columnName||$value", 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

            $value = $this->getDefaultValue();

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

    protected $dbType = 'text';

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

    public function getWidth(): int

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

        if (!\is_string($value)) {

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

     *

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

        $value = \App\Utils\Completions::decode(\App\Purifier::purifyHtml($value));

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 \App\Utils\Completions::encode(\App\Purifier::decodeHtml($value));

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

    protected $type = 'Comment';

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

    /** {@inheritdoc} */

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

     *

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

     * Get isOpened param.

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

    public function isOpened(): bool

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

            return \App\Layout::truncateHtml($value, 'mini', 300);

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

    protected $columnName = 'comment';

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

    protected $params = ['width', 'height'];

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

    /** {@inheritdoc} */

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

        return $this->getParamsConfig()['isOpened'] ?? false;

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

    protected $defaultLabel = 'LBL_COMMENT';

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

    protected $colSpan = 0;

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

        return $this->getParamsConfig()['width'] ?? 100;

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

        return $rawText ? $value : \App\Layout::truncateHtml($value, 'full');

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

    }

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

    public function getHeight(): int

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

    }

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

        $conf = App\Config::module($this->getModuleName(), 'inventoryCommentIframeContent', null);

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

        if (!$rawText && false !== $conf) {

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

    /** {@inheritdoc} */

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

     * Get width.

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

     * @return int

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

     * @return bool

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

    public function getDisplayValue($value, array $rowData = [], bool $rawText = false)

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

    public function getListViewDisplayValue($value, array $rowData = [], bool $rawText = false)

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

        if ('' == $value) {

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

    protected $blocks = [2];

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

    protected $purifyType = \App\Purifier::HTML;

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

    public function validate($value, string $columnName, bool $isUserFormat, $originalValue = null)

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

        return \App\Utils\Completions::encodeAll(\App\Purifier::decodeHtml($value));

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

     * @return int

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 $isVisible = false;

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

     * Get height.

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

    {

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

class Vtiger_Comment_InventoryField extends Vtiger_Basic_InventoryField

There are no issues that match your filters.

Category
Status