Function process
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$pdfModuleName = $moduleName = $request->getModule();
- 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
Method process
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$pdfModuleName = $moduleName = $request->getModule();
The method process() has an NPath complexity of 104832. The configured NPath complexity threshold is 200. Open
public function process(App\Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$pdfModuleName = $moduleName = $request->getModule();
- 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 process() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10. Open
public function process(App\Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$pdfModuleName = $moduleName = $request->getModule();
- 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 35 to the 15 allowed. Open
public function process(App\Request $request)
- 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
The class Vtiger_PDF_View has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class Vtiger_PDF_View extends Vtiger_BasicModal_View
{
/** {@inheritdoc} */
public function checkPermission(App\Request $request)
{
- 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 '59', column '23'). Open
$eventHandler = new App\EventHandler();
- 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 '28', 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 '25', column '14'). Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 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
Avoid using static access to class '\App\Condition' in method 'process'. Open
\App\Condition::validAdvancedConditions($advancedConditions);
- 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
The method process uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
$records = \Vtiger_Mass_Action::getRecordsListFromRequest($request);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Condition' in method 'process'. Open
$viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
- 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 'checkPermission'. Open
if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
- 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\Pdf\InventoryColumns' in method 'process'. Open
$viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
- 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 assigning values to variables in if clauses and the like (line '40', column '7'). Open
public function process(App\Request $request)
{
$this->preProcess($request);
$viewer = $this->getViewer($request);
$pdfModuleName = $moduleName = $request->getModule();
- 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 '\Vtiger_Module_Model' in method 'process'. Open
$moduleModel = \Vtiger_Module_Model::getInstance($pdfModuleName);
- 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\Condition' in method 'process'. Open
$viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
$request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
$request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
));
- 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_Loader' in method 'process'. Open
$handlerClass = \Vtiger_Loader::getComponentClassName('Model', 'PDF', $pdfModuleName);
- 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_Mass_Action' in method 'process'. Open
$records = \Vtiger_Mass_Action::getRecordsListFromRequest($request);
- 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_RelationAjax_Action' in method 'process'. Open
$records = \Vtiger_RelationAjax_Action::getRecordsListFromRequest($request);
- 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 "record" 4 times. Open
if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
- 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.
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ACTIVE_DYNAMIC', $activeDynamic);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('STANDARD_TEMPLATES', $templates);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RELATED_MODULE', $pdfModuleName);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ORDER_BY', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CAN_CHANGE_SCHEME', $moduleModel->isPermitted('RecordPdfInventory'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RELATION_ID', $request->getInteger('relationId'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ENTITY_STATE', $request->isEmpty('entityState') ? '' : $request->getByType('entityState'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ALL_INVENTORY_COLUMNS', $allInventoryColumns);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('FROM_VIEW', $view);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SEARCH_KEY', $request->getByType('search_key', \App\Purifier::ALNUM));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SELECTED_IDS', $request->getArray('selected_ids', \App\Purifier::INTEGER));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ADVANCED_CONDITIONS', $advancedConditions);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('EXCLUDED_IDS', $request->getArray('excluded_ids', \App\Purifier::INTEGER));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('DYNAMIC_TEMPLATES', $dynamicTemplates);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('RECORD_ID', $recordId);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('OPERATOR', $request->getByType('operator'));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('CV_ID', $request->getByType('cvId', \App\Purifier::ALNUM));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('ACTIVE', $active);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('VIEW_NAME', $request->getByType('viewname', \App\Purifier::ALNUM));
- Exclude checks
Call to undeclared method \Vtiger_Viewer::assign
Open
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_PDF_View extends Vtiger_BasicModal_View
- Exclude checks
The class Vtiger_PDF_View is not named in CamelCase. Open
class Vtiger_PDF_View extends Vtiger_BasicModal_View
{
/** {@inheritdoc} */
public function checkPermission(App\Request $request)
{
- 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
Only one argument is allowed per line in a multi-line function call Open
$request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
- 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
$dynamicTemplates = $records = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'records' => $records,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'pdfModel' => $pdfModel,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allInventoryColumns[$name] = $field->get('label');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('FROM_VIEW', $view);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ORDER_BY', $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$advancedConditions = $request->has('advancedConditions') ? $request->getArray('advancedConditions') : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isRelatedView) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('PdfModalAfter');
- 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
$moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('DYNAMIC_TEMPLATES', $dynamicTemplates);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request->getByType('search_key', \App\Purifier::ALNUM), $request->getByType('operator')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ENTITY_STATE', $request->isEmpty('entityState') ? '' : $request->getByType('entityState'));
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
- 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
$isInventory = $moduleModel->isInventory();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($templates as $key => $template) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isTemplateActive && !$active) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ACTIVE_DYNAMIC', $activeDynamic);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SELECTED_IDS', $request->getArray('selected_ids', \App\Purifier::INTEGER));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($advancedConditions) {
- 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
foreach ($records as $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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('OPERATOR', $request->getByType('operator'));
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdfModuleName = $moduleName = $request->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$active = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ALL_INVENTORY_COLUMNS', $allInventoryColumns);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ACTIVE', $active);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('EXCLUDED_IDS', $request->getArray('excluded_ids', \App\Purifier::INTEGER));
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$viewer->assign('SEARCH_PARAMS', App\Condition::validSearchParams($pdfModuleName, $request->getArray('search_params'), false));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('ADVANCED_CONDITIONS', $advancedConditions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CV_ID', $request->getByType('cvId', \App\Purifier::ALNUM));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = $pdfModel->getActiveTemplatesForModule($pdfModuleName, $view);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('MODULE_NAME', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $request->isEmpty('record', true) ? null : $request->getInteger('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isRelatedView = ('RelatedList' === $view)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$records = \Vtiger_RelationAjax_Action::getRecordsListFromRequest($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$records = \Vtiger_Mass_Action::getRecordsListFromRequest($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
unset($templates[$key]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->view('ExportPDF.tpl', $pdfModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModuleActionPermission($moduleName, 'ExportPdf')) {
- Exclude checks
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
$handlerClass = \Vtiger_Loader::getComponentClassName('Model', 'PDF', $pdfModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setParams([
- 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 ($isInventory && \Vtiger_PDF_Model::TEMPLATE_TYPE_DYNAMIC === $template->get('type')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dynamicTemplates[] = $template;
- 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
$viewer->assign('SELECT_MODE', ($request->isEmpty('selectMode', true) || 'multi' === $request->getByType('selectMode')) ? 'checkbox' : 'radio');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->postProcess($request);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->preProcess($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
$records = [$recordId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!Users_Privileges_Model::getCurrentUserPrivilegesModel()->hasModuleActionPermission($moduleName, 'ExportPdf')) {
- 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
'viewInstance' => $this,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = \Vtiger_Module_Model::getInstance($pdfModuleName);
- 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 ($isInventory) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Condition::validAdvancedConditions($advancedConditions);
- 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
$active = $activeDynamic = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($recordId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$request->getByType('search_value', \App\Purifier::TEXT), $pdfModuleName,
- 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isRelatedView) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('PdfModalBefore');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RECORD_ID', $recordId);
- 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
$view = $request->getByType('fromview', \App\Purifier::STANDARD);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = $pdfModel->getActiveTemplatesForRecord($recordId, $view, $pdfModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allInventoryColumns = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('CAN_CHANGE_SCHEME', $moduleModel->isPermitted('RecordPdfInventory'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('STANDARD_TEMPLATES', $templates);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('VIEW_NAME', $request->getByType('viewname', \App\Purifier::ALNUM));
- 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('RELATED_MODULE', $pdfModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('RELATION_ID', $request->getInteger('relationId'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$request->isEmpty('record', true) && !\App\Privilege::isPermitted($moduleName, 'DetailView', $request->getInteger('record'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isTemplateActive && !$activeDynamic) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\NoPermitted('LBL_PERMISSION_DENIED', 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdfModuleName = $request->getByType('relatedModule', \App\Purifier::ALNUM);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdfModel = new $handlerClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler = new App\EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($template->checkFiltersForRecord((int) $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
$viewer->assign('ALPHABET_VALUE', App\Condition::validSearchValue(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewer->assign('SEARCH_KEY', $request->getByType('search_key', \App\Purifier::ALNUM));
- 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
$eventHandler->setModuleName($pdfModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isTemplateActive = $template->get('default');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activeDynamic = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\Vtiger_Inventory_Model::getInstance($pdfModuleName)->getFields() as $name => $field) {
- Exclude checks
Line exceeds 120 characters; contains 210 characters Open
$viewer->assign('SELECTED_INVENTORY_COLUMNS', ($recordId && !$isRelatedView) ? \App\Pdf\InventoryColumns::getInventoryColumnsForRecord($recordId, $pdfModuleName) : array_keys($allInventoryColumns));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Class name "Vtiger_PDF_View" is not in camel caps format Open
class Vtiger_PDF_View extends Vtiger_BasicModal_View
- Exclude checks