Method process
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$moduleName = $this->record->getModuleName();
$dateTime = $request->getByType('dateTime', 'dateTimeInUserFormat');
$dateTime = \App\Fields\DateTime::formatToDb($dateTime);
The class Vtiger_RecordActivity_View has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Vtiger_RecordActivity_View extends Vtiger_Index_View
{
/**
* Record model instance.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '29', column '14'). Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
- 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 '54', column '23'). Open
$recordModel = new ModTracker_Record_Model();
- 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 '39', column '23'). Open
$currentTime = (new \DateTimeField(date('Y-m-d H:i:s')))->getDisplayFullDateTimeValue();
- 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 '45', column '17'). Open
$query = (new \App\Db\Query())
- 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 '65', column '19'). Open
$response = new Vtiger_Response();
- 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 assigning values to variables in if clauses and the like (line '28', column '108'). Open
public function checkPermission(App\Request $request)
{
if ($request->isEmpty('record', true) || !\App\Config::performance('recordActivityNotifier', false) || !($this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule()))->isViewable() || !$this->record->getModule()->isTrackingEnabled() || !$this->record->getModule()->isPermitted('RecordActivityNotifier')) {
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
}
- Read upRead up
- Exclude checks
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
Avoid using static access to class '\App\Language' in method 'process'. Open
$response->setResult(['title' => \App\Language::translate('LBL_ATTENTION'), 'dateTime' => $currentTime, 'text' => $content]);
- 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
Avoid using static access to class '\App\Config' in method 'checkPermission'. Open
if ($request->isEmpty('record', true) || !\App\Config::performance('recordActivityNotifier', false) || !($this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule()))->isViewable() || !$this->record->getModule()->isTrackingEnabled() || !$this->record->getModule()->isPermitted('RecordActivityNotifier')) {
- 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
Avoid using static access to class '\App\User' in method 'process'. Open
->andWhere(['<>', 'vtiger_modtracker_basic.whodid', \App\User::getCurrentUserRealId()])
- 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
Avoid using static access to class 'Vtiger_Record_Model' in method 'checkPermission'. Open
if ($request->isEmpty('record', true) || !\App\Config::performance('recordActivityNotifier', false) || !($this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule()))->isViewable() || !$this->record->getModule()->isTrackingEnabled() || !$this->record->getModule()->isPermitted('RecordActivityNotifier')) {
- 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
Avoid using static access to class '\App\Fields\DateTime' in method 'process'. Open
$dateTime = \App\Fields\DateTime::formatToDb($dateTime);
- 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
Avoid using static access to class 'ModTracker' in method 'process'. Open
$actions = ModTracker::getAllActionsTypes();
- 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
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('UPDATES', $updates);
- Exclude checks
Argument 1 (value)
is string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$currentTime = (new \DateTimeField(date('Y-m-d H:i:s')))->getDisplayFullDateTimeValue();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SOURCE_MODULE_NAME', 'ModTracker');
- Exclude checks
Call to method getCurrentUserRealId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
->andWhere(['<>', 'vtiger_modtracker_basic.whodid', \App\User::getCurrentUserRealId()])
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_RecordActivity_View extends Vtiger_Index_View
- Exclude checks
The class Vtiger_RecordActivity_View is not named in CamelCase. Open
class Vtiger_RecordActivity_View extends Vtiger_Index_View
{
/**
* Record model instance.
*
- 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
public function process(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setEmitType(\Vtiger_Response::$EMIT_JSON);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Record model instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($request->isEmpty('record', true) || !\App\Config::performance('recordActivityNotifier', false) || !($this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule()))->isViewable() || !$this->record->getModule()->isTrackingEnabled() || !$this->record->getModule()->isPermitted('RecordActivityNotifier')) {
- Exclude checks
Line exceeds 120 characters; contains 360 characters Open
if ($request->isEmpty('record', true) || !\App\Config::performance('recordActivityNotifier', false) || !($this->record = Vtiger_Record_Model::getInstanceById($request->getInteger('record'), $request->getModule()))->isViewable() || !$this->record->getModule()->isTrackingEnabled() || !$this->record->getModule()->isPermitted('RecordActivityNotifier')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTime = $request->getByType('dateTime', 'dateTimeInUserFormat');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->orderBy(['vtiger_modtracker_basic.id' => SORT_ASC])->limit(5);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->setData($row)->setParent($row['crmid'], $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isSessionExtend(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkPermission(App\Request $request)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTime = (new \DateTimeField(date('Y-m-d H:i:s')))->getDisplayFullDateTimeValue();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->setResult(['title' => \App\Language::translate('LBL_ATTENTION'), 'dateTime' => $currentTime, 'text' => $content]);
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$response->setResult(['title' => \App\Language::translate('LBL_ATTENTION'), 'dateTime' => $currentTime, 'text' => $content]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = new Vtiger_Response();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermittedToRecord('ERR_NO_PERMISSIONS_FOR_THE_RECORD', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$updates = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response->emit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $record;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTime = \App\Fields\DateTime::formatToDb($dateTime);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($actions[ModTracker::$SHOW_HIDDEN_DATA]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = $viewer->view('RecordActivityContent.tpl', 'ModTracker', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $this->record->getModuleName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SOURCE_MODULE_NAME', 'ModTracker');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var Vtiger_Record_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['<>', 'vtiger_modtracker_basic.whodid', \App\User::getCurrentUserRealId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = new ModTracker_Record_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($updates) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_modtracker_basic.crmid' => $this->record->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$updates[$recordModel->getId()] = $recordModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_modtracker_basic')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['>=', 'vtiger_modtracker_basic.changedon', $dateTime])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer = $this->getViewer($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['vtiger_modtracker_basic.status' => array_keys($actions)])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actions = ModTracker::getAllActionsTypes();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('UPDATES', $updates);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Class name "Vtiger_RecordActivity_View" is not in camel caps format Open
class Vtiger_RecordActivity_View extends Vtiger_Index_View
- Exclude checks