Method getDetailViewLinks
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDetailViewLinks(array $linkParams): array
{
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$moduleName = $recordModel->getModuleName();
Function getDetailViewLinks
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getDetailViewLinks(array $linkParams): array
{
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$moduleName = $recordModel->getModuleName();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Consider simplifying this complex logical expression. Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_BASIC',
'linklabel' => 'LBL_SET_RECORD_STATUS',
'linkurl' => '#',
The method getDetailViewLinks() has an NPath complexity of 4536. The configured NPath complexity threshold is 200. Open
public function getDetailViewLinks(array $linkParams): array
{
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$moduleName = $recordModel->getModuleName();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getDetailViewLinks() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10. Open
public function getDetailViewLinks(array $linkParams): array
{
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$moduleName = $recordModel->getModuleName();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed. Open
public function getDetailViewLinks(array $linkParams): array
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Avoid using static access to class '\App\Privilege' in method 'getDetailViewLinks'. Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- 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\Privilege' in method 'getDetailViewLinks'. Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- 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 'getDetailViewLinks'. Open
$stateColors = App\Config::search('LIST_ENTITY_STATE_COLOR');
- 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 'Calendar_Module_Model' in method 'getDetailViewLinks'. Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- 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\Mail' in method 'getDetailViewLinks'. Open
if ($recordModel->isEditable() && \App\Mail::checkInternalMailClient()) {
- 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\Privilege' in method 'getDetailViewLinks'. Open
if (!$recordModel->isReadOnly() && !$recordModel->isEmpty('location') && App\Privilege::isPermitted('OpenStreetMap')) {
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$linkModelList['DETAIL_VIEW_EXTENDED'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_EXTENDED',
'linklabel' => 'LBL_MOVE_TO_TRASH',
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=State&state=Trash&record=' . $recordModel->getId() . '")',
'linkicon' => 'fas fa-trash-alt',
- 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\Language' in method 'getDetailViewLinks'. Open
'title' => \App\Language::translate('LBL_MOVE_TO_TRASH'),
- 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\Language' in method 'getDetailViewLinks'. Open
'title' => \App\Language::translate('LBL_DELETE_RECORD_COMPLETELY'),
- 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\Privilege' in method 'getDetailViewLinks'. Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_BASIC',
'linklabel' => 'LBL_SET_RECORD_STATUS',
'linkurl' => '#',
'linkdata' => ['url' => $recordModel->getActivityStateModalUrl()],
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$linkModelList['DETAIL_VIEW_ADDITIONAL'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_ADDITIONAL',
'linklabel' => 'LBL_SEND_CALENDAR',
'linkdata' => ['url' => "index.php?module={$moduleName}&view=SendInvitationModal&record={$recordId}"],
'linkicon' => 'yfi-send-invitation',
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$linkModelList['DETAIL_VIEW_EXTENDED'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_EXTENDED',
'linklabel' => 'LBL_DELETE_RECORD_COMPLETELY',
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=Delete&record=' . $recordModel->getId() . '")',
'linkicon' => 'fas fa-eraser',
- 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_Link_Model' in method 'getDetailViewLinks'. Open
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'DETAIL_VIEW_BASIC',
'linklabel' => 'LBL_SHOW_LOCATION',
'linkurl' => 'javascript:Vtiger_Index_Js.showLocation(this)',
'linkdata' => ['location' => $recordModel->getDisplayValue('location')],
- 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
Define a constant instead of duplicating this literal "location" 3 times. Open
if (!$recordModel->isReadOnly() && !$recordModel->isEmpty('location') && App\Privilege::isPermitted('OpenStreetMap')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "LBL_MOVE_TO_TRASH" 3 times. Open
if ('LBL_MOVE_TO_TRASH' == $linkObject->linklabel) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "DETAIL_VIEW_EXTENDED" 8 times. Open
foreach ($linkModelList['DETAIL_VIEW_EXTENDED'] as $key => $linkObject) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "LBL_DELETE_RECORD_COMPLETELY" 3 times. Open
if ('LBL_DELETE_RECORD_COMPLETELY' == $linkObject->linklabel) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linklabel" 5 times. Open
'linklabel' => 'LBL_SET_RECORD_STATUS',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkclass" 5 times. Open
'linkclass' => 'btn-outline-dark btn-sm showModal closeCalendarRekord',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "DETAIL_VIEW_BASIC" 4 times. Open
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkdata" 3 times. Open
'linkdata' => ['url' => $recordModel->getActivityStateModalUrl()],
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkurl" 4 times. Open
'linkurl' => '#',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkicon" 5 times. Open
'linkicon' => 'fas fa-check',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linktype" 5 times. Open
'linktype' => 'DETAIL_VIEW_BASIC',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Class extends undeclared class \Vtiger_DetailView_Model
Open
class Calendar_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
Reference to undeclared class \Vtiger_DetailView_Model
Open
$linkModelList = parent::getDetailViewLinks($linkParams);
- Exclude checks
Call to undeclared method \Calendar_DetailView_Model::getModule
Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- Exclude checks
Call to undeclared method \Calendar_DetailView_Model::getRecord
Open
$recordModel = $this->getRecord();
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Calendar_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks
The class Calendar_DetailView_Model is not named in CamelCase. Open
class Calendar_DetailView_Model extends Vtiger_DetailView_Model
{
/** {@inheritdoc} */
public function getDetailViewLinks(array $linkParams): array
{
- 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
foreach ($linkModelList['DETAIL_VIEW_EXTENDED'] as $key => $linkObject) {
- 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
'linktype' => 'DETAIL_VIEW_ADDITIONAL',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'yfi-send-invitation',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'javascript:Vtiger_Index_Js.showLocation(this)',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm entityStateBtn',
- 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
'linklabel' => 'LBL_DELETE_RECORD_COMPLETELY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $linkModelList;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList = parent::getDetailViewLinks($linkParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $recordModel->getModuleName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => '#',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm showModal closeCalendarRekord',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList['DETAIL_VIEW_ADDITIONAL'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Line exceeds 120 characters; contains 194 characters Open
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=State&state=Trash&record=' . $recordModel->getId() . '")',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'DETAIL_VIEW_EXTENDED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = $this->getRecord();
- 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
'linktype' => 'DETAIL_VIEW_EXTENDED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($linkModelList['DETAIL_VIEW_EXTENDED'][$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => \App\Language::translate('LBL_DELETE_RECORD_COMPLETELY'),
- 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
if (!$recordModel->isReadOnly() && !$recordModel->isEmpty('location') && App\Privilege::isPermitted('OpenStreetMap')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$recordModel->isReadOnly() && $recordModel->privilegeToMoveToTrash() && 1 === $recordModel->get('reapeat')) {
- 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
$recordId = $recordModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$stateColors = App\Config::search('LIST_ENTITY_STATE_COLOR');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList['DETAIL_VIEW_EXTENDED'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_SEND_CALENDAR',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkdata' => ['url' => "index.php?module={$moduleName}&view=SendInvitationModal&record={$recordId}"],
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
if (!$recordModel->isReadOnly() && !$recordModel->isEmpty('location') && App\Privilege::isPermitted('OpenStreetMap')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($linkModelList['DETAIL_VIEW_EXTENDED'] as $key => $linkObject) {
- 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
'linkdata' => ['url' => $recordModel->getActivityStateModalUrl()],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkdata' => ['location' => $recordModel->getDisplayValue('location')],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'title' => \App\Language::translate('LBL_MOVE_TO_TRASH'),
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDetailViewLinks(array $linkParams): array
- Exclude checks
Line exceeds 120 characters; contains 430 characters Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($linkModelList['DETAIL_VIEW_EXTENDED'][$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_MOVE_TO_TRASH',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=Delete&record=' . $recordModel->getId() . '")',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList['DETAIL_VIEW_BASIC'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm js-show-modal',
- 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
'style' => empty($stateColors['Trash']) ? '' : "background: {$stateColors['Trash']};",
- Exclude checks
Line exceeds 120 characters; contains 183 characters Open
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=Delete&record=' . $recordModel->getId() . '")',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'DETAIL_VIEW_BASIC',
- 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
if (!$recordModel->isReadOnly() && $recordModel->privilegeToDelete() && 1 === $recordModel->get('reapeat')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-eraser',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-check',
- 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
'linktype' => 'DETAIL_VIEW_BASIC',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-outline-dark btn-sm'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_SET_RECORD_STATUS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->isEditable() && \App\Mail::checkInternalMailClient()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-map-marker-alt',
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
if (!$recordModel->isReadOnly() && $recordModel->privilegeToMoveToTrash() && 1 === $recordModel->get('reapeat')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('LBL_MOVE_TO_TRASH' == $linkObject->linklabel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'javascript:Calendar_Detail_Js.deleteRecord("index.php?module=' . $recordModel->getModuleName() . '&action=State&state=Trash&record=' . $recordModel->getId() . '")',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-trash-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->isEditable() && $this->getModule()->isPermitted('DetailView') && \App\Privilege::isPermitted($moduleName, 'ActivityComplete', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityCancel', $recordId) && \App\Privilege::isPermitted($moduleName, 'ActivityPostponed', $recordId) && \in_array($recordModel->get('activitystatus'), Calendar_Module_Model::getComponentActivityStateLabel('current'))) {
- 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
'linklabel' => 'LBL_SHOW_LOCATION',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('LBL_DELETE_RECORD_COMPLETELY' == $linkObject->linklabel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$linkModelList['DETAIL_VIEW_EXTENDED'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Class name "Calendar_DetailView_Model" is not in camel caps format Open
class Calendar_DetailView_Model extends Vtiger_DetailView_Model
- Exclude checks