__construct accesses the super-global variable $_POST. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
__construct accesses the super-global variable $_POST. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
Function getTemplatePath
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getTemplatePath($templateName, $moduleName = ''): string
{
$moduleName = str_replace(':', '/', $moduleName);
$cacheKey = $templateName . $moduleName;
if (\App\Cache::has('ViewerTemplatePath', $cacheKey)) {
- 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 view
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- 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 getTemplatePath
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTemplatePath($templateName, $moduleName = ''): string
{
$moduleName = str_replace(':', '/', $moduleName);
$cacheKey = $templateName . $moduleName;
if (\App\Cache::has('ViewerTemplatePath', $cacheKey)) {
Method __construct
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
Method view
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
Function __construct
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- 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
The method view() has an NPath complexity of 250. The configured NPath complexity threshold is 200. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- 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 getTemplatePath() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public function getTemplatePath($templateName, $moduleName = ''): string
{
$moduleName = str_replace(':', '/', $moduleName);
$cacheKey = $templateName . $moduleName;
if (\App\Cache::has('ViewerTemplatePath', $cacheKey)) {
- 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
The method view() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- 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 19 to the 15 allowed. Open
public function view($templateName, $moduleName = '', $fetch = false)
- 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
Refactor this function to reduce its Cognitive Complexity from 17 to the 15 allowed. Open
public function getTemplatePath($templateName, $moduleName = ''): string
- 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 method view has a boolean flag argument $fetch, which is a certain sign of a Single Responsibility Principle violation. Open
public function view($templateName, $moduleName = '', $fetch = 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
Avoid using static access to class '\App\Cache' in method 'view'. Open
\App\Cache::save('ViewerTemplateExists', $templatePath, $templateFound, \App\Cache::LONG);
- 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 'getTemplatePath'. Open
\App\Cache::save('ViewerTemplatePath', $cacheKey, $intermediateFallBackFileName, \App\Cache::LONG);
- 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 'view'. Open
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- 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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
self::$currentLayout = \App\Layout::getActiveLayout();
}
- 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\Layout' in method '__construct'. Open
self::$currentLayout = \App\Layout::getActiveLayout();
- 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\Request' in method '__construct'. Open
$this->log("URI: $debugViewerURI, TYPE: " . \App\Request::_getServer('REQUEST_METHOD'));
- 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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$debugViewerURI = \App\Request::_getServer('REQUEST_URI');
}
- 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 'getTemplatePath'. Open
return \App\Cache::get('ViewerTemplatePath', $cacheKey);
- 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 view uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$templateFound = $this->templateExists($templatePath);
\App\Cache::save('ViewerTemplateExists', $templatePath, $templateFound, \App\Cache::LONG);
}
- 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\Config' in method '__construct'. Open
if (App\Config::performance('LOAD_CUSTOM_FILES')) {
- 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\Request' in method '__construct'. Open
$debugViewerURI = parse_url(\App\Request::_getServer('REQUEST_URI'), PHP_URL_PATH);
- 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 'getTemplatePath'. Open
self::$completeTemplatePath = \App\Cache::get('ViewerCompleteTemplatePath', $cacheKey);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method '__construct'. Open
self::$debugViewer = App\Config::debug('DEBUG_VIEWER');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'view'. Open
$this->error_reporting = App\Config::debug('SMARTY_ERROR_REPORTING');
- 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 'getTemplatePath'. Open
\App\Cache::save('ViewerTemplatePath', $cacheKey, $filePath, \App\Cache::LONG);
- 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 'getTemplatePath'. Open
\App\Cache::save('ViewerCompleteTemplatePath', $cacheKey, self::$completeTemplatePath, \App\Cache::LONG);
- 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 'getTemplatePath'. Open
\App\Cache::save('ViewerCompleteTemplatePath', $cacheKey, self::$completeTemplatePath, \App\Cache::LONG);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'view'. Open
if (!empty(App\Config::debug('SMARTY_ERROR_REPORTING'))) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method '__construct'. Open
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- 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\Request' in method '__construct'. Open
$debugViewerURI = \App\Request::_getServer('REQUEST_URI');
- 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 'getTemplatePath'. Open
if (\App\Cache::has('ViewerTemplatePath', $cacheKey)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method '__construct'. Open
if (App\Config::performance('LOAD_CUSTOM_FILES')) {
- 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 'view'. Open
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
- 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 "ViewerCompleteTemplatePath" 3 times. Open
self::$completeTemplatePath = \App\Cache::get('ViewerCompleteTemplatePath', $cacheKey);
- 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 "ViewerTemplateExists" 3 times. Open
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
- 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 "ViewerTemplatePath" 4 times. Open
if (\App\Cache::has('ViewerTemplatePath', $cacheKey)) {
- 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.
Default value for \type
$delimiter
can't be string
Open
protected function log($message, $delimiter = '\n')
- Exclude checks
Call to undeclared method \Vtiger_Viewer::getTemplateDir
Open
foreach ($this->getTemplateDir() as $templateDir) {
- Exclude checks
Call to undeclared method \Vtiger_Viewer::fetch
Open
return $this->fetch($templatePath);
- Exclude checks
Argument 1 (message)
is string
but \Vtiger_Viewer::log()
takes \type
defined at /code/include/runtime/Viewer.php:31
Open
$this->log("VIEW: $templatePathToLog, FOUND: " . ($templateFound ? '1' : '0'));
- Exclude checks
Argument 1 (message)
is string
but \Vtiger_Viewer::log()
takes \type
defined at /code/include/runtime/Viewer.php:31
Open
$this->log(sprintf('DATA: %s, TYPE: %s', $key, $valueType));
- Exclude checks
Parameter $delimiter
has undeclared type \type
Open
protected function log($message, $delimiter = '\n')
- Exclude checks
Suspicious type \type
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
file_put_contents($file, $message . $delimiter, FILE_APPEND);
- Exclude checks
Call to undeclared method \Vtiger_Viewer::templateExists
Open
$templateFound = $this->templateExists($templatePath);
- Exclude checks
Class extends undeclared class \Smarty
Open
class Vtiger_Viewer extends \Smarty
- Exclude checks
Parameter $message
has undeclared type \type
Open
protected function log($message, $delimiter = '\n')
- Exclude checks
Saw possibly unextractable annotation for a fragment of comment '* @param string - $media Layout/Media name':
after string,
did not see an element name (will guess based on comment order) Open
* @param string - $media Layout/Media name
- Exclude checks
Reference to undeclared property \Vtiger_Viewer->tpl_vars
Open
foreach ($this->tpl_vars as $key => $smarty_variable) {
- Exclude checks
Call to undeclared method \Vtiger_Viewer::display
Open
$this->display($templatePath);
- Exclude checks
Returning type false
but getInstance()
is declared to return \Vtiger_Viewer
Open
return self::$instance;
- Exclude checks
Call to undeclared method \Vtiger_Viewer::setTemplateDir
Open
$this->setTemplateDir(array_unique($templateDir));
- Exclude checks
Returning type false
but view()
is declared to return string
Open
return false;
- Exclude checks
Assigning \Vtiger_Viewer
to property but \Vtiger_Viewer::$instance
is false
Open
self::$instance = $instance;
- Exclude checks
Call to undeclared method \Vtiger_Viewer::setCompileDir
Open
$this->setCompileDir($compileDir);
- Exclude checks
Reference to undeclared class \Smarty
Open
parent::__construct();
- Exclude checks
Argument 1 (message)
is string
but \Vtiger_Viewer::log()
takes \type
defined at /code/include/runtime/Viewer.php:31
Open
$this->log("URI: $debugViewerURI, TYPE: " . \App\Request::_getServer('REQUEST_METHOD'));
- Exclude checks
Reference to undeclared property \Vtiger_Viewer->error_reporting
Open
$this->error_reporting = App\Config::debug('SMARTY_ERROR_REPORTING');
- Exclude checks
Reference to undeclared property \Vtiger_Viewer->debugging
Open
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Exclude checks
Returning type true
but view()
is declared to return string
Open
return true;
- Exclude checks
Avoid excessively long variable names like $intermediateFallBackFileName. Keep variable name length under 20. Open
$intermediateFallBackFileName = 'modules/' . $fallBackModuleName . '/' . $templateName;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_Viewer extends \Smarty
- Exclude checks
The class Vtiger_Viewer is not named in CamelCase. Open
class Vtiger_Viewer extends \Smarty
{
const DEFAULTLAYOUT = 'basic';
const DEFAULTTHEME = 'twilight';
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
public static $completeTemplatePath;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constructor - Sets the templateDir and compileDir for the Smarty files.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$file = __DIR__ . '/../../cache/logs/viewer-debug.log';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents($file, $message . $delimiter, FILE_APPEND);
- Exclude checks
Spaces must 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 static $debugViewer = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* log message into the file if in debug mode.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param type $delimiter
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Complete template 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
static $file = 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
* @param type $message
- Exclude checks
Spaces must 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 (null === $file) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$debugViewer) {
- Exclude checks
Spaces must 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 - $media Layout/Media 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
$THISDIR = __DIR__;
- Exclude checks
Spaces must 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 - Default Layout Name
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
\App\Cache::save('ViewerTemplatePath', $cacheKey, $intermediateFallBackFileName, \App\Cache::LONG);
- 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
$templatePath = $this->getTemplatePath($templateName, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $currentLayout;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $instance = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (App\Config::performance('LOAD_CUSTOM_FILES')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($_POST)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getLayoutName()
- Exclude checks
Spaces must 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::has('ViewerTemplatePath', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('AppComponents' === $moduleName && file_exists($templateDir . "components/$templateName")) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Fall back lookup on actual module, in case where parent module doesn't contain actual module within in (directory structure)
- Exclude checks
Spaces must 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 html data
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Determine type of value being pased.
- 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
"$baseModuleName/Vtiger",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fallBackOrder as $fallBackModuleName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('ViewerTemplatePath', $cacheKey, $filePath, \App\Cache::LONG);
- Exclude checks
Spaces must 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 bool $fetch
- Exclude checks
Spaces must 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 $templateName
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
\App\Cache::save('ViewerCompleteTemplatePath', $cacheKey, self::$completeTemplatePath, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('ViewerTemplatePath', $cacheKey, $intermediateFallBackFileName, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const DEFAULTLAYOUT = 'basic';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templateDir[] = $THISDIR . '/../../layouts/' . self::$currentLayout;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
mkdir($compileDir, 0755, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the current layout name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(self::$currentLayout)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::DEFAULTLAYOUT;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - Module specific template path if exists, otherwise default template path for the given template name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$completeTemplatePath = \App\Cache::get('ViewerCompleteTemplatePath', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filePath = "modules/$moduleName/$templateName";
- 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// We need to use {$variable nofilter} to overcome double escaping
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$debugViewer && false === $debugViewerURI) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->log("URI: $debugViewerURI, TYPE: " . \App\Request::_getServer('REQUEST_METHOD'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = str_replace(':', '/', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filePath = "components/$templateName";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($moduleName) && file_exists(self::$completeTemplatePath)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleHierarchyParts = explode('/', $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
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct($media = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templateDir[] = $THISDIR . '/../../custom/layouts/' . self::$currentLayout;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (App\Config::performance('LOAD_CUSTOM_FILES')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Escape all {$variable} to overcome XSS
- 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
* @return string - Current layout name if not empty, otherwise Default layout name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
* @return string - Module specific template path if exists, otherwise default template path for the given template name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"$actualModuleName",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (file_exists(self::$completeTemplatePath)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to display/fetch the smarty file contents.
- 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
const DEFAULTTHEME = 'twilight';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function log($message, $delimiter = '\n')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$currentLayout = \App\Layout::getActiveLayout();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templateDir[] = $THISDIR . '/../../custom/layouts/' . self::getDefaultLayoutName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugViewerURI .= '?' . http_build_query($_POST);
- Exclude checks
Spaces must 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 self::$currentLayout;
- Exclude checks
Spaces must 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 getDefaultLayoutName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the module specific template path for a given 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
self::$completeTemplatePath = $templateDir . "modules/$moduleName/$templateName";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$intermediateFallBackFileName = 'modules/' . $fallBackModuleName . '/' . $templateName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filePath = "modules/Vtiger/$templateName";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $filePath;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('ViewerTemplateExists', $templatePath, $templateFound, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templatePathToLog = $templatePath;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($moduleName) && 0 !== strpos($templatePath, "modules/$qualifiedModuleName/")) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$valueType = 'literal';
- Exclude checks
Spaces must 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 \App\Cache::get('ViewerTemplatePath', $cacheKey);
- Exclude checks
Spaces must 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(App\Config::debug('SMARTY_ERROR_REPORTING'))) {
- Exclude checks
Spaces must 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->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$compileDir = '';
- Exclude checks
Spaces must 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
\App\Cache::save('ViewerCompleteTemplatePath', $cacheKey, self::$completeTemplatePath, \App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templatePathToLog = "modules/$qualifiedModuleName/$templateName > $templatePath";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->tpl_vars as $key => $smarty_variable) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_object($smarty_variable->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
return self::$instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Turn-it on to analyze the data pushed to templates for the request.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $intermediateFallBackFileName;
- Exclude checks
Spaces must 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 view($templateName, $moduleName = '', $fetch = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->log("VIEW: $templatePathToLog, FOUND: " . ($templateFound ? '1' : '0'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// END
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::$instance) {
- Exclude checks
Spaces must 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 (!empty($media)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setTemplateDir(array_unique($templateDir));
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
// Fall back lookup on actual module, in case where parent module doesn't contain actual module within in (directory structure)
- Exclude checks
Spaces must 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 (self::$debugViewer) {
- Exclude checks
Spaces must 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->log(sprintf('DATA: %s, TYPE: %s', $key, $valueType));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!file_exists($compileDir)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugViewerURI = parse_url(\App\Request::_getServer('REQUEST_URI'), PHP_URL_PATH);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to return for default layout 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 getTemplatePath($templateName, $moduleName = ''): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = $templateName . $moduleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos($moduleName, '/')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$completeTemplatePath = $templateDir . DIRECTORY_SEPARATOR . $intermediateFallBackFileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('ViewerCompleteTemplatePath', $cacheKey, self::$completeTemplatePath, \App\Cache::LONG);
- Exclude checks
Spaces must 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->fetch($templatePath);
- Exclude checks
Spaces must 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->setCompileDir($compileDir);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static $debugViewerURI = false;
- 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
foreach ($this->getTemplateDir() as $templateDir) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseModuleName = $moduleHierarchyParts[0];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// FOR SECURITY
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fallBackOrder = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$debugViewerURI = \App\Request::_getServer('REQUEST_URI');
- Exclude checks
Spaces must 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 $templateName
- Exclude checks
Spaces must 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::has('ViewerTemplateExists', $templatePath)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::getDefaultLayoutName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Logging
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qualifiedModuleName = str_replace(':', '/', $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actualModuleName = $moduleHierarchyParts[\count($moduleHierarchyParts) - 1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// In case we found a fallback template, log both lookup and target template resolved to.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->error_reporting = App\Config::debug('SMARTY_ERROR_REPORTING');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templateDir = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$currentLayout = $media;
- Exclude checks
Spaces must 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
$compileDir = $THISDIR . '/../../cache/templates_c/' . self::$currentLayout;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$templateDir[] = $THISDIR . '/../../layouts/' . self::getDefaultLayoutName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$debugViewer = App\Config::debug('DEBUG_VIEWER');
- Exclude checks
Spaces must 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
$templateFound = $this->templateExists($templatePath);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$valueType = \get_class($smarty_variable->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
$valueType = 'array';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fetch) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($templateFound) {
- Exclude checks
Spaces must 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 true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $media Layout/Media
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Viewer instance
- Exclude checks
Spaces must 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->display($templatePath);
- 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
} elseif (\is_array($smarty_variable->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
* Static function to get the Instance of the Class Object.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$instance = $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance($media = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self($media);
- Exclude checks
Class name "Vtiger_Viewer" is not in camel caps format Open
class Vtiger_Viewer extends \Smarty
- Exclude checks
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $smarty_variable is not named in camelCase. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $smarty_variable is not named in camelCase. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $smarty_variable is not named in camelCase. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $smarty_variable is not named in camelCase. Open
public function view($templateName, $moduleName = '', $fetch = false)
{
$templatePath = $this->getTemplatePath($templateName, $moduleName);
if (\App\Cache::has('ViewerTemplateExists', $templatePath)) {
$templateFound = \App\Cache::get('ViewerTemplateExists', $templatePath);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $THISDIR is not named in camelCase. Open
public function __construct($media = '')
{
parent::__construct();
$this->debugging = App\Config::debug('DISPLAY_DEBUG_VIEWER');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}