YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
D
61%

Remove error control operator '@' on line 43.
Open

    public function getSrc()
    {
        $src = $this->get('src');
        if (empty($src)) {
            $src = $this->get('linkurl');
Severity: Minor
Found in modules/Vtiger/models/JsScript.php by phpmd

ErrorControlOperator

Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

Example

function foo($filePath) {
    $file = @fopen($filPath); // hides exceptions
    $key = @$array[$notExistingKey]; // assigns null to $key
}

Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

Avoid assigning values to variables in if clauses and the like (line '43', column '29').
Open

    public function getSrc()
    {
        $src = $this->get('src');
        if (empty($src)) {
            $src = $this->get('linkurl');
Severity: Minor
Found in modules/Vtiger/models/JsScript.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

class Vtiger_JsScript_Model extends \App\Base

The class Vtiger_JsScript_Model is not named in CamelCase.
Open

class Vtiger_JsScript_Model extends \App\Base
{
    const DEFAULT_TYPE = 'text/javascript';

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

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

        if ($this->has('base') && $fs = @filemtime($this->get('base'))) {
Severity: Minor
Found in modules/Vtiger/models/JsScript.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

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

     * Function to get the src attribute 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

            $src = $this->get('linkurl');

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 Vtiger_JsScript_Model instance

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

    public function getType()

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

     * Static Function to get an instance of Vtiger JsScript Model from a given vtlib\Link object.

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

    public static function getInstanceFromLinkObject(vtlib\Link $linkObj)

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

        foreach ($objectProperties as $properName => $propertyValue) {

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 string

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 $linkModel->setData($objectProperties);

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

        if (empty($type)) {

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

            $src = $src . '?s=' . $fs;

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

        $objectProperties = get_object_vars($linkObj);

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

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

        $linkModel = new self();

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

     * @return string

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

     * @param vtlib\Link $linkObj

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

    const DEFAULT_TYPE = 'text/javascript';

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

        if (empty($src)) {

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

    }

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

            $linkModel->{$properName} = $propertyValue;

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

        return $src;

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

     * Function to get the type attribute 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

        $src = $this->get('src');

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

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

        $type = $this->get('type');

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

            $type = self::DEFAULT_TYPE;

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 ($this->has('base') && $fs = @filemtime($this->get('base'))) {

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

     *

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

class Vtiger_JsScript_Model extends \App\Base

There are no issues that match your filters.

Category
Status