File patTemplate.php
has 856 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
Function dump
has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring. Open
public function dump()
{
echo "<style type=\"text/css\">\n";
echo ".text {font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000}\n";
echo ".mid {font-family: Verdana, Arial, sans-serif; font-size: 12px; color: #000000}\n";
- 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 startElementHandler
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 createParser
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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
PatTemplate
has 46 functions (exceeds 20 allowed). Consider refactoring. Open
class PatTemplate
{
/**
* Constructor
*
Method dump
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dump()
{
echo "<style type=\"text/css\">\n";
echo ".text {font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000}\n";
echo ".mid {font-family: Verdana, Arial, sans-serif; font-size: 12px; color: #000000}\n";
Method startElementHandler
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
The class PatTemplate has an overall complexity of 198 which is very high. The configured complexity threshold is 50. Open
class PatTemplate
{
/**
* Constructor
*
- Exclude checks
The class PatTemplate has 31 non-getter- and setter-methods. Consider refactoring PatTemplate to keep number of methods under 25. Open
class PatTemplate
{
/**
* Constructor
*
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
The class PatTemplate has 31 public methods. Consider refactoring PatTemplate to keep number of public methods under 10. Open
class PatTemplate
{
/**
* Constructor
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function getTemplateContent
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$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 getParsedTemplate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function getParsedTemplate($name = '')
{
$name = strtoupper($name);
// if a name was given, parse only this template
- 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 addRows
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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 createParser
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
Function getVars
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getVars($template)
{
$vars = array();
// parse all vars
if (is_array($this->variables[$template])) {
- 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 getTemplateContent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$name];
Function displayParsedTemplate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function displayParsedTemplate($name = '')
{
$name = strtoupper($name);
// if a name was given, parse and display it
- 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 parseDependencies
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function parseDependencies($name, &$temp, $mode = 'w')
{
$name = strtoupper($name);
if (is_array($this->dependencies[$name])) {
for ($i = 0, $iMax = count($this->dependencies[$name]); $i < $iMax; ++$i) {
- 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 class PatTemplate has 46 public methods and attributes. Consider reducing the number of public items to less than 45. Open
class PatTemplate
{
/**
* Constructor
*
- Read upRead up
- Exclude checks
ExcessivePublicCount
Since: 0.1
A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.
Example
public class Foo {
public $value;
public $something;
public $var;
// [... more more public attributes ...]
public function doWork() {}
public function doMoreWork() {}
public function doWorkAgain() {}
// [... more more public methods ...]
}
Source https://phpmd.org/rules/codesize.html#excessivepubliccount
Method getParsedTemplate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getParsedTemplate($name = '')
{
$name = strtoupper($name);
// if a name was given, parse only this template
Function getVar
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getVar($template, $var)
{
// should the var from a different template be used
if (stristr($var, '.')) {
list($template, $var) = explode('.', $var);
- 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 deeply nested control flow statements. Open
for ($k = 0, $kMax = count($unused); $k <= $kMax; ++$k) {
{
echo " <tr>\n";
echo ' <td class="text">' . $unused[$k] . "</td>\n";
echo " </tr>\n";
Avoid deeply nested control flow statements. Open
if ($matches[1][$k] !== '' && !isset($this->variables[$name][$matches[1][$k]])
&& !isset($this->globals[$matches[1][$k]])
) {
$unused[] = $matches[0][$k];
}
Function parseStandardTemplate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseStandardTemplate($name, $mode = 'w')
{
$name = strtoupper($name);
// get a copy of the plain content
- 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 parseIterativeTemplate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 endElementHandler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function endElementHandler($fname, $tagname, $line)
{
array_pop($this->whitespace);
switch ($tagname) {
- 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 deeply nested control flow statements. Open
for ($k = 0, $kMax = count($matches[0]); $k <= $kMax; ++$k) {
if ($matches[1][$k] !== '' && !isset($this->variables[$name][$matches[1][$k]])
&& !isset($this->globals[$matches[1][$k]])
) {
$unused[] = $matches[0][$k];
Method startElementHandler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
Function addVars
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addVars($template, $variables, $prefix = '')
{
// Are there variables?
if (!is_array($variables)) {
return false;
- 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 addVar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addVar($template, $name, $value)
{
$template = strtoupper($template);
$name = strtoupper($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 parseAttributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function parseAttributes($string)
{
// Check for trailing slash, if tag was an empty XML Tag
if (substr($string, -1) === '/') {
$string = substr($string, 0, strlen($string) - 1);
- 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 $arr;
Avoid too many return
statements within this method. Open
return $this->plain_templates[$name];
Avoid too many return
statements within this method. Open
return $this->getParsedTemplate($this->templates[0]);
Function stripUnusedVars
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function stripUnusedVars($name, &$template)
{
switch ($this->getAttribute($name, 'unusedvars')) {
case 'comment':
$template = preg_replace('/(' . $this->tag_start . '[^a-z{}]+' . $this->tag_end . ')/', "<!-- \\1 -->", $template);
- 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 createParser() has 109 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- Exclude checks
The class PatTemplate has 1716 lines of code. Current threshold is 1000. Avoid really long classes. Open
class PatTemplate
{
/**
* Constructor
*
- Exclude checks
The method dump() has an NPath complexity of 1141. The configured NPath complexity threshold is 200. Open
public function dump()
{
echo "<style type=\"text/css\">\n";
echo ".text {font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000}\n";
echo ".mid {font-family: Verdana, Arial, sans-serif; font-size: 12px; color: #000000}\n";
- 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 dump() has 201 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function dump()
{
echo "<style type=\"text/css\">\n";
echo ".text {font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000}\n";
echo ".mid {font-family: Verdana, Arial, sans-serif; font-size: 12px; color: #000000}\n";
- Exclude checks
The method startElementHandler() has 164 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- Exclude checks
The method startElementHandler() has an NPath complexity of 974. The configured NPath complexity threshold is 200. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 createParser() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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 dump() has a Cyclomatic Complexity of 28. The configured cyclomatic complexity threshold is 10. Open
public function dump()
{
echo "<style type=\"text/css\">\n";
echo ".text {font-family: Verdana, Arial, sans-serif; font-size: 10px; color: #000000}\n";
echo ".mid {font-family: Verdana, Arial, sans-serif; font-size: 12px; color: #000000}\n";
- 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 startElementHandler() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 getTemplateContent() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$name];
- 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
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
for ($k = 0, $kMax = count($unused); $k <= $kMax; ++$k) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$depth' which will lead to PHP notices. Open
$this->setConditionVar($this->template_names[$depth], 'PAT_ROW_VAR mod 2');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
$unused[] = $matches[0][$k];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
for ($k = 0, $kMax = count($unused); $k <= $kMax; ++$k) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
unset($unused);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
echo ' <td class="text">' . $unused[$k] . "</td>\n";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arr' which will lead to PHP notices. Open
return $arr;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$new_vars' which will lead to PHP notices. Open
$this->addVars($template, $new_vars);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$attributes' which will lead to PHP notices. Open
$attributes[strtolower($pair[0])] = $pair[1];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$new_vars' which will lead to PHP notices. Open
$new_vars[$prefix . $key][$i] = $value;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$attributes' which will lead to PHP notices. Open
return $attributes;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
$unused[] = $matches[0][$k];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
if (is_array($unused) && count($unused) > 0) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
if (is_array($unused) && count($unused) > 0) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
if (is_array($unused) && count($unused) > 0) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
if (is_array($unused) && count($unused) > 0) {
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$lineno' which will lead to PHP notices. Open
die("Error in template '" . $fname . "': unkown closing tag in line " . $lineno);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$matches' which will lead to PHP notices. Open
unset($matches);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
echo ' <td class="text">' . $unused[$k] . "</td>\n";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$unused' which will lead to PHP notices. Open
unset($unused);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$arr' which will lead to PHP notices. Open
$arr[$this->templates[$i]] = $this->getParsedTemplate($this->templates[$i]);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Remove error control operator '@' on line 629. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 629. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 976. Open
public function loadTemplate($name)
{
$name = strtoupper($name);
// prepend basedirname, if it exists
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 976. Open
public function loadTemplate($name)
{
$name = strtoupper($name);
// prepend basedirname, if it exists
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The method createParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->last_keep[] = false;
// handle start Element
$this->startElementHandler($fname, $tagname, $attributes, $line, $lineno);
- 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 '658', column '34'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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
The method createParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->dataHandler($fname, $line, $lineno);
}
- 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
The method createParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->last_opened[] = $tagname;
}
- 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 '590', column '26'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 assigning values to variables in if clauses and the like (line '629', column '34'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 assigning values to variables in if clauses and the like (line '669', column '33'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 assigning values to variables in if clauses and the like (line '683', column '29'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 assigning values to variables in if clauses and the like (line '606', column '25'). Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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
The method createParser uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->dataHandler($fname, $line, $lineno);
}
- 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 '1162', column '17'). Open
public function getVars($template)
{
$vars = array();
// parse all vars
if (is_array($this->variables[$template])) {
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
array_push($this->whitespace, $this->whitespace[count($this->whitespace) - 1]);
}
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$filename = '[part of ' . $fname . ']';
}
- 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
The method getParsedTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
// The template uses dependencies, then start with the root template
if ($this->uses_dependencies) {
return $this->getParsedTemplate($this->templates[0]);
} // Only one template => parse and return it
- 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
The method parseTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->parseStandardTemplate($template, $mode);
}
- 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
The method displayParsedTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$templates = $this->getParsedTemplate();
for ($i = 0; $i < $this->cnt_templates; ++$i) {
echo $templates[$this->templates[$i]];
}
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->template_data[$this->depth - 1] .= $this->tag_start . 'TMPL:' . $this->template_names[$this->depth] . $this->tag_end . "\n";
// Tell the parent template, that it has to parse the child template, before parsing
// itself
$this->addDependency($this->template_names[$this->depth - 1], $this->template_names[$this->depth]);
- 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
The method setPlainContent uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$this->plain_templates[$template] = $content;
}
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
die("Error in template '" . $fname . "': missing requiredvars attribute for simple condition template in line " . $lineno);
}
- 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 '1557', column '17'). Open
public function getVar($template, $var)
{
// should the var from a different template be used
if (stristr($var, '.')) {
list($template, $var) = explode('.', $var);
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
$attributes['type'] = 'STANDARD';
$this->template_types[$this->depth] = 'STANDARD';
}
- 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
The method getParsedTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
for ($i = 0; $i < $this->cnt_templates; ++$i) {
$arr[$this->templates[$i]] = $this->getParsedTemplate($this->templates[$i]);
}
- 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
The method displayParsedTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
// if the template uses dependencies, start with the root template
if ($this->uses_dependencies) {
echo $this->getParsedTemplate($this->templates[0]);
} // Only one template => parse and return it
- 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
The method startElementHandler uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
// Filename including full path
$external = $this->basedir !== '' ? $this->basedir . '/' . $filename : $filename;
// Open the file and read all the content
- 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
The method addRows uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
for ($i = 0; $i < $cnt_rows; ++$i) {
if (is_array($rows[$i])) {
// Get key and value
// while (list($key, $value) = each($rows[$i])) {
- 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 '976', column '18'). Open
public function loadTemplate($name)
{
$name = strtoupper($name);
// prepend basedirname, if it exists
- 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
The method getVar uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$val = $this->variables[$template][$var];
}
- 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
The method dump uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// display template Data
echo " <tr>\n";
echo " <td class=\"mid\" valign=\"top\"><b>Template Data:</b></td>\n";
echo " <td class=\"text\" valign=\"top\">\n";
- 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
The method createParser() contains an exit expression. Open
die("Couldn't open file '" . $fname . "' for reading!");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method readTemplatesFromFile() contains an exit expression. Open
die("Error in template '" . $file . "': </" . $open_tag . '> still open at end of file.');
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method createParser() contains an exit expression. Open
die("Error in template '" . $fname . "': no opening tag found for </" . $tagname . '> in line ' . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method createParser() contains an exit expression. Open
die("Error in template '" . $fname . "': closing </" . $tagname . '> does not match opened <' . $last_opened . '> in line ' . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': unkown Tag in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method startElementHandler() contains an exit expression. Open
die("Couldn't open file '" . $external . "' for reading in template " . $fname . ' line ' . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': missing requiredvars attribute for simple condition template in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': missing src attribute for link in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$newvars'. Open
$newvars = array();
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The method loadTemplate() contains an exit expression. Open
die("Couldn't open template '" . $name . "' (file: '" . $fname . "') for reading.");
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused parameters such as '$line'. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': missing conditionvar for template in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$depth'. Open
$this->setConditionVar($this->template_names[$depth], 'PAT_ROW_VAR mod 2');
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': missing name for template in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
The method startElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': missing condition attribute for template in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused parameters such as '$line'. Open
public function endElementHandler($fname, $tagname, $line)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
The method endElementHandler() contains an exit expression. Open
die("Error in template '" . $fname . "': unkown closing tag in line " . $lineno);
- Read upRead up
- Exclude checks
ExitExpression
Since: 0.2
An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.
Example
class Foo {
public function bar($param) {
if ($param === 42) {
exit(23);
}
}
}
Source https://phpmd.org/rules/design.html#exitexpression
Avoid unused local variables such as '$lineno'. Open
die("Error in template '" . $fname . "': unkown closing tag in line " . $lineno);
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$fname'. Open
public function dataHandler($fname, $data)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (is_array($unused) && count($unused) > 0) {
echo " <tr>\n";
echo " <td class=\"mid\" valign=\"top\"><b>Unused variables</b></td>\n";
echo " <td class=\"text\" valign=\"top\">\n";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 99.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (is_array($unused) && count($unused) > 0) {
echo " <tr>\n";
echo " <td class=\"mid\" valign=\"top\"><b>Unused variables</b></td>\n";
echo " <td class=\"text\" valign=\"top\">\n";
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 99.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class PatTemplate
- Exclude checks
Avoid variables with short names like $fp. Configured minimum length is 3. Open
$fp = fopen($pname, 'r');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
CASE keyword must be followed by a single space Open
case 'strip':
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TYPE_STANDARD' but found 'patTEMPLATE_TYPE_STANDARD' Open
define('patTEMPLATE_TYPE_STANDARD', 'STANDARD');
- Exclude checks
CASE keyword must be followed by a single space Open
case 'rtrim':
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TAG_START' but found 'patTEMPLATE_TAG_START' Open
define('patTEMPLATE_TAG_START', '{');
- Exclude checks
CASE keyword must be followed by a single space Open
case 'nbsp':
- Exclude checks
CASE keyword must be followed by a single space Open
case 'ltrim':
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
CASE keyword must be followed by a single space Open
case 'ignore':
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TYPE_ODDEVEN' but found 'patTEMPLATE_TYPE_ODDEVEN' Open
define('patTEMPLATE_TYPE_ODDEVEN', 'ODDEVEN');
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TYPE_CONDITION' but found 'patTEMPLATE_TYPE_CONDITION' Open
define('patTEMPLATE_TYPE_CONDITION', 'CONDITION');
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TYPE_SIMPLECONDITION' but found 'patTEMPLATE_TYPE_SIMPLECONDITION' Open
define('patTEMPLATE_TYPE_SIMPLECONDITION', 'SIMPLECONDITION');
- Exclude checks
CASE keyword must be followed by a single space Open
case 'trim':
- Exclude checks
CASE keyword must be followed by a single space Open
case 'comment':
- Exclude checks
Constants must be uppercase; expected 'PATTEMPLATE_TAG_END' but found 'patTEMPLATE_TAG_END' Open
define('patTEMPLATE_TAG_END', '}');
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$this->template_data[$this->depth - 1] .= $this->tag_start . 'TMPL:' . $this->template_names[$this->depth] . $this->tag_end . "\n";
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
echo ".head {font-family: Verdana, Arial, sans-serif; font-size: 16px; font-weight: bold; color: #000000}\n";
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
* When "tex" is used the PatTemplate markings used for variables are changed as LaTex makes use of the default PatTemplate markings.
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
die("Error in template '" . $fname . "': missing condition attribute for template in line " . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
echo ' <td class="text" valign="top">Amount of subtemplates: ' . $this->cnt_subtemplates[$name] . "</td>\n";
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
* The Dependency tells a template, which templates have to be parsed before parsing the current template, because they are its children.
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
die("Error in template '" . $fname . "': missing requiredvars attribute for simple condition template in line " . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$this->addDependency($this->template_names[$this->depth - 1], $this->template_names[$this->depth]);
- Exclude checks
Line exceeds 120 characters; contains 170 characters Open
echo ' <td class="text" valign="top"><pre>' . htmlspecialchars($this->getPlainSubTemplate($name, $condition)) . "</pre></td>\n";
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$template = preg_replace('/(' . $this->tag_start . '[^a-z{}]+' . $this->tag_end . ')/', "<!-- \\1 -->", $template);
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
echo ' <td class="text"><b>' . $this->tag_start . $key . $this->tag_end . "</b></td>\n";
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$this->setAttribute($this->template_names[$this->depth], 'requiredvars', explode(',', $requiredvars));
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$template = preg_replace('/(' . $this->tag_start . '[^a-z{}]+' . $this->tag_end . ')/', $this->getAttribute($name, 'unusedvars'), $template);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
preg_match_all($this->regex_get_all_vars, $this->getPlainSubTemplate($name, $condition), $matches);
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
die("Error in template '" . $fname . "': closing </" . $tagname . '> does not match opened <' . $last_opened . '> in line ' . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
die("Couldn't open file '" . $external . "' for reading in template " . $fname . ' line ' . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$this->template_data[$this->depth - 1] .= $this->tag_start . $placeholder . $this->tag_end;
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$template = preg_replace('/(' . $this->tag_start . '[^a-z{}]+' . $this->tag_end . ')/', '', $template);
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
die("Error in template '" . $fname . "': no opening tag found for </" . $tagname . '> in line ' . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$this->setPlainContent($this->template_names[$this->depth], $this->template_data[$this->depth], $this->template_condition[$this->depth]);
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$template = preg_replace('/(' . $this->tag_start . '[^a-z{}]+' . $this->tag_end . ')/', ' ', $template);
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$fname = $this->basedir !== '' ? $this->basedir . '/' . $this->source[$name][filename] : $this->source[$name][filename];
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
die("Error in template '" . $fname . "': missing conditionvar for template in line " . $lineno);
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$fname = $this->basedir !== '' ? $this->basedir . '/' . $this->filenames[$name] : $this->filenames[$name];
- Exclude checks
Expected 1 space after closing brace; newline found Open
}
- Exclude checks
Expected 1 space after closing brace; newline found Open
}
- Exclude checks
The variable $open_tag is not named in camelCase. Open
public function readTemplatesFromFile($file)
{
// Tag depth
$this->depth = -1;
// Names, extracted from the Tags
- 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 $last_opened is not named in camelCase. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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 $last_opened is not named in camelCase. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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 $last_opened is not named in camelCase. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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 $open_tag is not named in camelCase. Open
public function readTemplatesFromFile($file)
{
// Tag depth
$this->depth = -1;
// Names, extracted from the Tags
- 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 $last_opened is not named in camelCase. Open
public function createParser($fname)
{
// Store filename of the first file that has to be opened
// If basedir is set, prepend basedir
$pname = $this->basedir !== '' ? $this->basedir . '/' . $fname : $fname;
- 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 $open_tag is not named in camelCase. Open
public function readTemplatesFromFile($file)
{
// Tag depth
$this->depth = -1;
// Names, extracted from the Tags
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $tmpl_type is not named in camelCase. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 $new_vars is not named in camelCase. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $tmpl_type is not named in camelCase. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 $condition_found is not named in camelCase. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$name];
- 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 $tmpl_name is not named in camelCase. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 $cnt_rows is not named in camelCase. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $tmpl_name is not named in camelCase. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 $tmpl_type is not named in camelCase. Open
public function startElementHandler($fname, $tagname, $attributes, $line, $lineno)
{
// check for whitespace attribute
if ($attributes['whitespace']) {
array_push($this->whitespace, strtolower($attributes['whitespace']));
- 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 $cnt_rows is not named in camelCase. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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 $new_vars is not named in camelCase. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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 $condition_found is not named in camelCase. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$name];
- 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 $PAT_ROW_VAR is not named in camelCase. Open
public function parseIterativeTemplate($name, $mode)
{
$name = strtoupper($name);
$temp = '';
- 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 $condition_found is not named in camelCase. Open
public function getTemplateContent($name)
{
$name = strtoupper($name);
$index = $this->iteration[$name];
- 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 $cnt_rows is not named in camelCase. Open
public function addRows($template, $rows, $prefix = '')
{
// Store the vars in this array
$newvars = array();
- 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();
}
}