include/runtime/cache/Connector.php
Missing class import via use statement (line '20', column '28'). Open
Open
$this->connection = new Vtiger_Cache_Connector_Memory();
- Read upRead up
- Exclude checks
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
Open
class Vtiger_Cache_Connector
- Exclude checks
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
Open
<?php
- Exclude checks
Avoid variables with short names like $ns. Configured minimum length is 3. Open
Open
protected function cacheKey($ns, $key)
- Read upRead up
- Exclude checks
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
Open
class Vtiger_Cache_Connector
{
protected $connection;
protected function __construct()
- Read upRead up
- Exclude checks
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
Open
$this->connection = new Vtiger_Cache_Connector_Memory();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
static $singleton = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (is_array($key)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($singleton === null) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function get($namespace, $key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function has($namespace, $key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public static function getInstance()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function set($namespace, $key, $value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function flush()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected function cacheKey($ns, $key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$key = implode('-', $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->connection->get($this->cacheKey($namespace, $key));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected $connection;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
protected function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->connection->set($this->cacheKey($namespace, $key), $value);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->connection->flush();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$singleton = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (!$this->connection) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $ns . '-' . $key;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $this->get($namespace, $key) !== false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return $singleton;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Class name "Vtiger_Cache_Connector" is not in camel caps format Open
Open
class Vtiger_Cache_Connector
- Exclude checks