Vtiger_PDF_Model
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Vtiger_PDF_Model extends \App\Base
{
/**
* Template type standard.
*
The class Vtiger_PDF_Model has an overall complexity of 70 which is very high. The configured complexity threshold is 50. Open
class Vtiger_PDF_Model extends \App\Base
{
/**
* Template type standard.
*
- Exclude checks
File PDF.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Basic PDF Model Class.
*
Method checkUserPermissions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkUserPermissions()
{
$permissions = $this->get('template_members');
if (empty($permissions)) {
return true;
Function checkUserPermissions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function checkUserPermissions()
{
$permissions = $this->get('template_members');
if (empty($permissions)) {
return true;
- 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
Function getParser
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getParser()
{
if (!isset($this->textParser)) {
if (isset($this->variables['recordId'])) {
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- 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
Function getFieldFilterValueType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getFieldFilterValueType($fieldname)
{
$conditions = $this->get('conditions');
if (!empty($conditions) && \is_array($conditions)) {
foreach ($conditions as $filter) {
- 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
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Function getActiveTemplatesForRecord
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
{
if (!\App\Record::isExists($recordId)) {
return [];
}
- 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
Class "Vtiger_PDF_Model" has 29 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Vtiger_PDF_Model extends \App\Base
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Reduce the number of returns of this function 6, down to the maximum allowed 3. Open
public function checkUserPermissions()
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
The class Vtiger_PDF_Model has a coupling between objects value of 16. Consider to reduce the number of dependencies under 13. Open
class Vtiger_PDF_Model extends \App\Base
{
/**
* Template type standard.
*
- 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
The method getActiveTemplatesForRecord has a boolean flag argument $moduleName, which is a certain sign of a Single Responsibility Principle violation. Open
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '267', column '16'). Open
$row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
- 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 '339', column '29'). Open
$conditionStrategy = new VTJsonCondition();
- 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 '240', column '22'). Open
$dataReader = (new \App\Db\Query())->from(self::$baseTable)
- 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 'Vtiger_Module_Model' in method 'getModule'. Open
return Vtiger_Module_Model::getInstance($this->get('module_name'));
- 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\Cache' in method 'checkFiltersForRecord'. Open
return \App\Cache::staticGet(__METHOD__, $key);
- 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\Json' in method 'checkFiltersForRecord'. Open
$test = \App\Json::isEmpty($this->getRaw('conditions'));
- 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\Zip' in method 'zipAndDownload'. Open
$zip = \App\Zip::createFile($zipPath);
- 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\Purifier' in method 'getName'. Open
return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));
- 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\Cache' in method 'checkFiltersForRecord'. Open
if (\App\Cache::staticHas(__METHOD__, $key)) {
- 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 getParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->textParser = \App\TextParser::getInstance($this->get('module_name'));
}
- 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\Cache' in method 'getInstanceById'. Open
$pdf = \App\Cache::get($cache, $recordId);
- 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\TextParser' in method 'getParser'. Open
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- 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\Record' in method 'getActiveTemplatesForRecord'. Open
$moduleName = \App\Record::getType($recordId);
- 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\Cache' in method 'getInstanceById'. Open
if (\App\Cache::has($cache, $recordId)) {
- 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 getParameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$parameters['margin-top'] = '';
$parameters['margin-right'] = '';
$parameters['margin-bottom'] = '';
$parameters['margin-left'] = '';
- 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 assigning values to variables in if clauses and the like (line '112', column '33'). Open
public function get($key)
{
if ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {
return json_decode($value, true);
}
- 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_Loader' in method 'getTemplatesByModule'. Open
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $moduleName);
- 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 getInstanceById uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
if ($row) {
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);
$pdf = new $handlerClass();
- 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\Record' in method 'getActiveTemplatesForRecord'. Open
if (!\App\Record::isExists($recordId)) {
- 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\Cache' in method 'getInstanceById'. Open
\App\Cache::save($cache, $recordId, $pdf);
- 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\File' in method 'getPath'. Open
return \App\Fields\File::createTempFile($prefix, 'pdf');
- 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\Cache' in method 'checkFiltersForRecord'. Open
\App\Cache::staticSave(__METHOD__, $key, $test);
- 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\TextParser' in method 'getParser'. Open
$this->textParser = \App\TextParser::getInstance($this->get('module_name'));
- 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\Purifier' in method 'getName'. Open
return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));
- 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 'getInstanceById'. Open
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);
- 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 'checkFiltersForRecord'. Open
Vtiger_Loader::includeOnce('~/modules/com_vtiger_workflow/VTJsonCondition.php');
- 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 'checkFiltersForRecord'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
- 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 'Users_Record_Model' in method 'checkUserPermissions'. Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- 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 "recordId" 3 times. Open
if (isset($this->variables['recordId'])) {
- 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 "module_name" 6 times. Open
return Vtiger_Module_Model::getInstance($this->get('module_name'));
- 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 "conditions" 5 times. Open
if ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {
- 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 "page_format" 3 times. Open
$parameters['page_format'] = $this->get('page_format');
- 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 method getInstance
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$this->textParser = \App\TextParser::getInstance($this->get('module_name'));
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser->setParams(['pdf' => $this]);
- Exclude checks
Default value for string
$moduleName
can't be false
Open
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::get()
takes string
defined at /code/app/Cache.php:61
Open
$pdf = \App\Cache::get($cache, $recordId);
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
return $this->textParser;
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser->setLanguage($this->get('language'));
- Exclude checks
Call to method getInstanceById
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- Exclude checks
Call to method setContent
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
return $str ? $this->getParser()->setContent($str)->parse()->getContent() : '';
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser->setType('pdf');
- Exclude checks
Argument 1 (moduleName)
is ?string
but \Vtiger_PDF_Model::getTemplatesByModule()
takes string
defined at /code/modules/Vtiger/models/PDF.php:238
Open
$templates = $this->getTemplatesByModule($moduleName);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
- Exclude checks
Argument 1 (condition)
is string
but \VTJsonCondition::evaluate()
takes array
defined at /code/modules/com_vtiger_workflow/VTJsonCondition.php:22
Open
$test = $conditionStrategy->evaluate($conditions, $recordModel);
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
\App\Cache::save($cache, $recordId, $pdf);
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
if (!isset($this->textParser)) {
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser = null;
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser = $this->getParser();
- Exclude checks
Saw unextractable annotation for comment '* @return <number> - Record Id'</number>
Open
* @return <Number> - Record Id
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new \App\Db\Query())->from(self::$baseTable)
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser->useExtension = true;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
$this->textParser = \App\TextParser::getInstance($this->get('module_name'));
- Exclude checks
Reference to undeclared property \Vtiger_PDF_Model->textParser
Open
} elseif (($this->variables['recordId'] ?? null) !== $this->textParser->record) {
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::has()
takes string
defined at /code/app/Cache.php:74
Open
if (\App\Cache::has($cache, $recordId)) {
- Exclude checks
Returning type false
but getFieldFilterValueType()
is declared to return string
Open
return false;
- Exclude checks
Return type of getParser()
is undeclared type \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
public function getParser()
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_PDF_Model extends \App\Base
- Exclude checks
The class Vtiger_PDF_Model is not named in CamelCase. Open
class Vtiger_PDF_Model extends \App\Base
{
/**
* Template type standard.
*
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Template type dynamic.
- 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
protected $variables = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Number> - Record Id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Purifier::encodeHtml(App\Purifier::decodeHtml($displayName));
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $baseTable = 'a_yf_pdf';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWatermarkType()
- 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
return parent::get($key);
- 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
* @param string $moduleName - name of the module
- 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 const TEMPLATE_TYPE_STANDARD = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Fuction to get the Name of the 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
* @return mixed
- 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
* @return mixed
- 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
* @var string
- 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
* Table index.
- 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
return $this->get('pdfid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->variables[$key] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getVariable(string $key)
- 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
* @var int
- 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 to picklist assignment array.
- 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
* @return bool true or false
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkActiveTemplates($recordId, $moduleName, $view)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
protected $viewToPicklistValue = ['Detail' => 'PLL_DETAILVIEW', 'List' => 'PLL_LISTVIEW', 'RelatedList' => 'PLL_RELATEDLISTVIEW'];
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Sets custom variable.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets custom variable.
- 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
* Table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- 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
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the id of the record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Variables.
- 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
/**
- 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
* Custom columns.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Vtiger_Module_Model::getInstance($this->get('module_name'));
- 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 setVariable(string $key, $value)
- 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
* @param int $recordId - id of a record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Template type summary.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- 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
}
- 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
* @return string - Entity Name of the record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return key value.
- 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
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return false|object
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = $this->getActiveTemplatesForRecord($recordId, $view, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public const TEMPLATE_TYPE_DYNAMIC = 2;
- 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
return [0 => 'PLL_TEXT', 1 => 'PLL_IMAGE'];
- 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 ('conditions' === $key && ($value = parent::get($key)) && !\is_array($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $key
- 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
* @var int
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $baseIndex = 'pdfid';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this
- 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
* Template type standard.
- 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 const TEMPLATE_TYPE_SUMMARY = 1;
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId()
- 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
* Return raw key value.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return module instance or false.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModule()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if pdf templates are avauble for this record, user and view.
- 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
* Function to get watermark type.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function get($key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return json_decode($value, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed
- 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 getRaw($key)
- 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
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$template->isVisible($view) || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {
- 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
$conditions = $this->get('conditions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], [self::$baseIndex => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkFiltersForRecord($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
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = $this->getTemplatesByModule($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates = [];
- 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
public static function getInstanceById(int $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
* @return bool
- 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
* Function to check filters for record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = $this->getId() . '_' . $recordId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $templates;
- 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
$row = (new \App\Db\Query())->from(self::$baseTable)->where([self::$baseIndex => $recordId])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $row['module_name']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFieldFilterValueType($fieldname)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$test = \App\Json::isEmpty($this->getRaw('conditions'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $view
- 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 static function getTemplatesByModule($moduleName)
- 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 ($row) {
- 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
$dataReader = (new \App\Db\Query())->from(self::$baseTable)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['module_name' => $moduleName, 'status' => 1])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdf = new $handlerClass();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has($cache, $recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $fieldname
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $viewToPicklistValue = ['Detail' => 'PLL_DETAILVIEW', 'List' => 'PLL_LISTVIEW', 'RelatedList' => 'PLL_RELATEDLISTVIEW'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $customColumns = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$displayName = $this->get('primary_name');
- 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
* @param string $moduleName
- 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 (!\App\Record::isExists($recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = \App\Record::getType($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $templates;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName - module name for which template was created
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdf->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templates[$pdf->getId()] = $pdf;
- 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
return $pdf ? clone $pdf : $pdf;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdf = \App\Cache::get($cache, $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($conditions as $filter) {
- 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
return $filter['valuetype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function deleteConditions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if is visible for provided view.
- 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
return \in_array($this->viewToPicklistValue[$view], $visibility);
- 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
* @return array
- 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
* Get PDF instance by id.
- 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
\App\Cache::save($cache, $recordId, $pdf);
- 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
'conditions' => '',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$moduleName) {
- 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
* Returns template records by module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|Vtiger_PDF_Model
- 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
}
- 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
*/
- 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
return parent::get($key);
- 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
return $this->variables[$key] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $view - modules view - Detail or List
- 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[$id]);
- 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
$templates = $this->getTemplatesByModule($moduleName);
- 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
/**
- 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
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return available templates for 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
public function getActiveTemplatesForModule($moduleName, $view)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($templates[$id]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array of template record models
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $templates;
- 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 ($fieldname == $filter['fieldname']) {
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$visibility = explode(',', $this->get('visibility'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getActiveTemplatesForRecord($recordId, $view, $moduleName = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
if (!$template->isVisible($view) || !$template->checkFiltersForRecord($recordId) || !$template->checkUserPermissions()) {
- 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
* Return available templates for module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- 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
*
- 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 ($templates as $id => &$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
if (!$template->isVisible($view) || !$template->checkUserPermissions()) {
- 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
$handlerClass = Vtiger_Loader::getComponentClassName('Model', 'PDF', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cache = __CLASS__;
- 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
* Function returns valuetype of the field filter.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($conditions) && \is_array($conditions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($templates) > 0) {
- 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
$pdf = new $handlerClass();
- 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
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update(self::$baseTable, [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isVisible($view)
- 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 ($templates as $id => $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
$pdf->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pdf = 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
* @param string $view
- 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 (\App\Cache::staticHas(__METHOD__, $key)) {
- 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
* @param string $view
- 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove conditions for current record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Cache::staticGet(__METHOD__, $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditionStrategy = new VTJsonCondition();
- 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
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$getTypes[$valueType[0]][] = $valueType[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['header_height'] = $this->get('header_height');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-right'] = $this->get('margin_right');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-right'] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get page orientation.
- 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
$groups = array_intersect($getTypes['Groups'], $currentUser->getGroups());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// metadata
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('page_format');
- 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
$this->textParser = \App\TextParser::getInstance($this->get('module_name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->get('language')) {
- 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
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 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
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-top'] = '';
- 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
$parameters['keywords'] = $this->parseVariables($this->get('meta_keywords'));
- 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 getParser()
- 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 checkUserPermissions()
- 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 getParameters()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == $this->get('margin_chkbox')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['title'] = $this->parseVariables($this->get('meta_title'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'P';
- 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
Vtiger_Loader::includeOnce('~/modules/com_vtiger_workflow/VTJsonCondition.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticSave(__METHOD__, $key, $test);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions = explode(',', $permissions);
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
$accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roles[] = $currentUser->getRole();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['page_orientation'] = $this->getOrientation();
- 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
return 'L';
- 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
* @return string - body 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
$parameters['margin-left'] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === (int) $this->get('metatags_status')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['subject'] = $this->parseVariables($this->get('meta_subject'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $parameters;
- 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
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$orientation = $this->get('page_orientation');
- 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
return $this->get('header_content');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('body_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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleGroups = array_keys(\App\Fields\Owner::getInstance($this->get('module_name'), $currentUser)->getAccessibleGroupForModule());
- 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
* Returns page format.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getOrientation()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - header content
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getBody()
- 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
$this->textParser->setLanguage($this->get('language'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $test;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if user has permissions to 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
$parameters = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['author'] = $this->parseVariables($this->get('meta_author'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFormat()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get body 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
public function getFooter()
- 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
$getTypes = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$test) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\array_key_exists('Groups', $getTypes)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions = $this->get('template_members');
- 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
return 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHeader()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get body content.
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$this->textParser = \App\TextParser::getInstanceById($this->variables['recordId'], $this->get('module_name'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$test = $conditionStrategy->evaluate($conditions, $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['page_format'] = $this->get('page_format');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-left'] = $this->get('margin_left');
- 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
return $this->get('footer_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
if (!isset($this->textParser)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$conditions = htmlspecialchars_decode($this->getRaw('conditions'));
- 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 (array_intersect($getTypes['RoleAndSubordinates'], array_filter($roles))) {
- 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
* Returns array of template parameters understood by the pdf engine.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string page format
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - body 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
if (\in_array('Users:' . $currentUser->getId(), $permissions)) { // check user id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array('Roles:' . $currentUser->getRole(), $permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roles = $currentUser->getParentRoles();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 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
} else {
- 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
$currentUser = Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$valueType = explode(':', $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (array_intersect($groups, $accessibleGroups)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\array_key_exists('RoleAndSubordinates', $getTypes)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// margins
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get header 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
if (empty($permissions)) {
- 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
$parameters['margin-top'] = $this->get('margin_top');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['creator'] = 'YetiForce CRM';
- 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
foreach ($permissions as $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['footer_height'] = $this->get('footer_height');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-bottom'] = $this->get('margin_bottom');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parameters['margin-bottom'] = '';
- 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 ('PLL_LANDSCAPE' === $orientation) {
- 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
* Gets TextParser.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \App\TextParser
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($this->variables['recordId'])) {
- 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
* @param string $salt
- 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
unlink($file['path']);
- 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
$this->textParser = $this->getParser();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets path.
- 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 parseVariables(string $str)
- 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fileNames as $file) {
- 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 getPath(string $prefix = '')
- 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
$zip->download('PdfZipFile_' . time());
- 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
return $str ? $this->getParser()->setContent($str)->parse()->getContent() : '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Fields\File::createTempFile($prefix, 'pdf');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->textParser;
- 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
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->textParser->setParams(['pdf' => $this]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->textParser->useExtension = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Attach current record to email.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $fileNames
- 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
$this->textParser->setType('pdf');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->textParser = null;
- 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 static function attachToEmail($salt)
- 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 static function zipAndDownload(array $fileNames)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip = \App\Zip::createFile($zipPath);
- 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
* @throws \App\Exceptions\NoPermitted
- 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
$zipPath = 'cache' . DIRECTORY_SEPARATOR . 'pdf' . DIRECTORY_SEPARATOR;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $prefix
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse variables.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $str
- 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
header('location: index.php?module=OSSMail&view=Compose&pdf_path=' . $salt);
- 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
$zipPath .= basename($tmpFileName);
- 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
} elseif (($this->variables['recordId'] ?? null) !== $this->textParser->record) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Compress files and send to browser.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$zip->addFile($file['path'], $file['name']);
- 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
{
- 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
$tmpFileName = tempnam($zipPath, 'PDFZIP' . time());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fileNames as $file) {
- Exclude checks
Class name "Vtiger_PDF_Model" is not in camel caps format Open
class Vtiger_PDF_Model extends \App\Base
- Exclude checks