YetiForceCompany/YetiForceCRM

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

Summary

Maintainability
A
0 mins
Test Coverage
F
39%

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

    public function getHref()
    {
        $href = $this->get('href');
        if (empty($href)) {
            $href = $this->get('linkurl');
Severity: Minor
Found in modules/Vtiger/models/CssScript.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 '74', column '29').
Open

    public function getHref()
    {
        $href = $this->get('href');
        if (empty($href)) {
            $href = $this->get('linkurl');
Severity: Minor
Found in modules/Vtiger/models/CssScript.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_CssScript_Model extends \App\Base

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/CssScript.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_CssScript_Model is not named in CamelCase.
Open

class Vtiger_CssScript_Model extends \App\Base
{
    const DEFAULT_REL = 'stylesheet';
    const DEFAULT_MEDIA = 'all';
    const DEFAULT_TYPE = 'text/css';
Severity: Minor
Found in modules/Vtiger/models/CssScript.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

     * Function to get the media attribute value.

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

     * Function to get the href attribute value.

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

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

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

    const DEFAULT_MEDIA = 'all';

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

    const DEFAULT_REL = 'stylesheet';

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

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

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

     * @return string

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

    const LESS_REL = 'stylesheet/less';

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

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

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

     */

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

    const DEFAULT_TYPE = 'text/css';

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

        if ($this->has('base') && $fs = @filemtime($this->get('base'))) {

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

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

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

     * Function to get the rel attribute value.

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

            $href = $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

        }

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

    public function getType()

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

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

    public function getRel()

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

        return $href;

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

    public function getMedia()

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

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

            $href = $href . '?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

        if (empty($href)) {

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

        if (empty($media)) {

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

            $media = self::DEFAULT_MEDIA;

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

     *

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

            $rel = self::DEFAULT_REL;

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

        return $rel;

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

        if (empty($rel)) {

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

     * 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

    {

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

        $linkModel = 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

     *

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

        $objectProperties = get_object_vars($linkObj);

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

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

     * Function to get the instance of CSS Script model from a given vtlib\Link object.

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

        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

    }

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_CssScript_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

    {

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

class Vtiger_CssScript_Model extends \App\Base

There are no issues that match your filters.

Category
Status