YetiForceCompany/YetiForceCRM

View on GitHub
include/runtime/cache/Connector.php

Summary

Maintainability
A
0 mins
Test Coverage
B
80%

Missing class import via use statement (line '20', column '28').
Open

            $this->connection = new Vtiger_Cache_Connector_Memory();
Severity: Minor
Found in include/runtime/cache/Connector.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

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

class Vtiger_Cache_Connector

A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 13 and the first side effect is on line 11.
Open

<?php

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

    protected function cacheKey($ns, $key)
Severity: Minor
Found in include/runtime/cache/Connector.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_Cache_Connector is not named in CamelCase.
Open

class Vtiger_Cache_Connector
{
    protected $connection;

    protected function __construct()
Severity: Minor
Found in include/runtime/cache/Connector.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

            $this->connection = new Vtiger_Cache_Connector_Memory();

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

        static $singleton = null;

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

        if (is_array($key)) {

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

        if ($singleton === null) {

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 get($namespace, $key)

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 has($namespace, $key)

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

    public static function getInstance()

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

    public function set($namespace, $key, $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

    public function flush()

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

    }

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

    protected function cacheKey($ns, $key)

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

        }

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

            $key = implode('-', $key);

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

        return $this->connection->get($this->cacheKey($namespace, $key));

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

    protected $connection;

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

    protected 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

        $this->connection->set($this->cacheKey($namespace, $key), $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

        $this->connection->flush();

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

    {

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

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

        if (!$this->connection) {

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

        return $ns . '-' . $key;

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

        return $this->get($namespace, $key) !== 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 $singleton;

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_Cache_Connector" is not in camel caps format
Open

class Vtiger_Cache_Connector

There are no issues that match your filters.

Category
Status