modules/Settings/RecordCollector/models/Module.php
Missing class import via use statement (line '30', column '19'). Open
Open
$iterator = new \DirectoryIterator(ROOT_DIRECTORY . '/app/RecordCollectors/');
- 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
Missing class import via use statement (line '29', column '17'). Open
Open
$links = (new \App\Db\Query())->select(['linklabel', 'linkicon'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR'])->createCommand()->queryAllByGroup(0);
- 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
Avoid using static access to class '\App\RecordCollector' in method 'getCollectors'. Open
Open
$collectorInstance = \App\RecordCollector::getInstance('App\RecordCollectors\\' . $file, 'Accounts');
- Read upRead up
- Exclude checks
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
Reference to instance property featured
from undeclared class \App\RecordCollectors\Base
Open
Open
$collectorInstance->featured = (bool) ($links[$file] ?? '');
- Exclude checks
Reference to instance property active
from undeclared class \App\RecordCollectors\Base
Open
Open
$collectorInstance->active = isset($links[$file]);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
Open
$links = (new \App\Db\Query())->select(['linklabel', 'linkicon'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR'])->createCommand()->queryAllByGroup(0);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
Open
class Settings_RecordCollector_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks
The class Settings_RecordCollector_Module_Model is not named in CamelCase. Open
Open
class Settings_RecordCollector_Module_Model extends Settings_Vtiger_Module_Model
{
/** @var array collectors */
private $collectors = [];
- 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
private $collectors = [];
- 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 $this->collectors;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$links = (new \App\Db\Query())->select(['linklabel', 'linkicon'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR'])->createCommand()->queryAllByGroup(0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Function fetching all collectors in system.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getCollectors(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$collectorInstance->featured = (bool) ($links[$file] ?? '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/** @var array collectors */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->collectors[$file] = $collectorInstance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
Open
$links = (new \App\Db\Query())->select(['linklabel', 'linkicon'])->from('vtiger_links')->where(['linktype' => 'EDIT_VIEW_RECORD_COLLECTOR'])->createCommand()->queryAllByGroup(0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$file = $item->getBasename('.php');
- 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
foreach ($iterator as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if ($item->isFile() && 'php' === $item->getExtension() && 'Base' != $file) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$collectorInstance->active = isset($links[$file]);
- 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 array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$iterator = new \DirectoryIterator(ROOT_DIRECTORY . '/app/RecordCollectors/');
- 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
$collectorInstance = \App\RecordCollector::getInstance('App\RecordCollectors\\' . $file, 'Accounts');
- Exclude checks
Class name "Settings_RecordCollector_Module_Model" is not in camel caps format Open
Open
class Settings_RecordCollector_Module_Model extends Settings_Vtiger_Module_Model
- Exclude checks