The function poly_compile() has an NPath complexity of 41668020. The configured NPath complexity threshold is 200. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 poly_compile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pente1 = 0;
}
- 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 poly_dump uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$s .= "0";
}
- 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 poly_compile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else { // infinite elevation of the edge
if (is_array($bords[$poly[$i]['y']])) {
array_push($bords[$poly[$i]['y']], $poly[$i]['x']);
}
$old_pente = 0;
- 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 unused local variables such as '$idx'. Open
foreach ($pairs as $idx => $pcoord) {
- 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 using count() function in for loops. Open
for ($i = 0, $j = count($points) - 1; $i < count($points); $j = $i++) {
$xi = $points[$i][0];
$yi = $points[$i][1];
$xj = $points[$j][0];
$yj = $points[$j][1];
- Read upRead up
- Exclude checks
CountInLoopExpression
Since: 2.7.0
Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.
Example
class Foo {
public function bar()
{
$array = array();
for ($i = 0; count($array); $i++) {
// ...
}
}
}
Source https://phpmd.org/rules/design.html#countinloopexpression
Variable "bord_lenght" is not in valid camel caps format Open
$bord_lenght = $max['x'];
- Exclude checks
Missing parameter name Open
* @param max[x] X resolution
- Exclude checks
Consider putting global function "poly_init" in a static class Open
function poly_init($max)
- Exclude checks
Missing parameter name Open
* @param poly points from the polygone
- Exclude checks
Missing parameter name Open
* @param max see poly_init
- Exclude checks
Missing parameter name Open
* @param max[y] Y resolution
- Exclude checks
Consider putting global function "poly_compile" in a static class Open
function poly_compile($poly, $max, $test = false)
- Exclude checks
Missing parameter name Open
* @param bool print or not a debug
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
for ($dy = $poly[$i - 1]['y'] + $dy_inc; $dy != $poly[0]['y']; $dy += $dy_inc) {
- Exclude checks
Missing parameter name Open
* @param poly1 first polygone as returned by poly_compile
- Exclude checks
Missing parameter name Open
* @param string List of points in x1;y1|... format (or /)
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
|| ($old_pente > 0 && $pente < 0)) {
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
if (($old_pente < 0 && $pente > 0) || ($old_pente > 0 && $pente < 0)) {
- Exclude checks
Missing parameter name Open
* @param array see above (poly_init)
- Exclude checks
Consider putting global function "poly_result" in a static class Open
function poly_result(&$poly1, &$poly2, $max)
- Exclude checks
Variable "bord_lenght" is not in valid camel caps format Open
$bords = array_fill(0, $bord_lenght, []); // building this array
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
$old_pente = $pente;
- Exclude checks
Missing parameter name Open
* @param array the polygone as output by poly_compile()
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
$old_pente = 0;
- Exclude checks
Missing parameter name Open
* @param max resolution as specified for poly_init
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
$dy_inc = ($poly[$i]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
- Exclude checks
Consider putting global function "poly_touch" in a static class Open
function poly_touch(&$poly1, &$poly2, $max)
- Exclude checks
Consider putting global function "convert_coordinates" in a static class Open
function convert_coordinates($coords, $sep = '|')
- Exclude checks
Consider putting global function "poly_get_max" in a static class Open
function poly_get_max(&$coords1, &$coords2)
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
$x += $pente * $dy_inc;
- Exclude checks
Missing parameter name Open
* @param string Format ('raw' text or 'html')
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
$dy += $dy_inc) {
- Exclude checks
Missing parameter name Open
* @param poly2 second ....
- Exclude checks
Missing parameter name Open
* @param max resolution as specified for poly_init
- Exclude checks
Missing parameter name Open
* @param poly1 first polygone as returned by poly_compile
- Exclude checks
Missing parameter name Open
* @param string The points separator for the list (| or /)
- Exclude checks
Consider putting global function "poly_dump" in a static class Open
function poly_dump(&$poly, $max, $format = 'raw')
- Exclude checks
Variable "bord_lenght" is not in valid camel caps format Open
if ($max['y'] > $bord_lenght) {
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
$x += $pente * $dy_inc;
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
if (($old_pente < 0 && $pente > 0) || ($old_pente > 0 && $pente < 0)) {
- Exclude checks
Missing parameter name Open
* @param poly2 second ....
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
$dy_inc = ($poly[0]['y'] - $poly[$i - 1]['y']) > 0 ? 1 : -1;
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
$old_pente = 0;
- Exclude checks
Variable "bord_lenght" is not in valid camel caps format Open
$bord_lenght = $max['y'];
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
for ($dy = $poly[$i - 1]['y'] + $dy_inc;
- Exclude checks
Missing parameter name Open
* @param array Coordinates of one polygon
- Exclude checks
Variable "old_pente" is not in valid camel caps format Open
if (($old_pente < 0 && $pente > 0)
- Exclude checks
Variable "dy_inc" is not in valid camel caps format Open
for ($dy = $poly[$i - 1]['y'] + $dy_inc; $dy != $poly[0]['y']; $dy += $dy_inc) {
- Exclude checks
The variable $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $bord_lenght is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $bord_lenght is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $bord_lenght is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $bord_lenght is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $old_pente is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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 $dy_inc is not named in camelCase. Open
function poly_compile($poly, $max, $test = false)
{
$res = poly_init($max);
// looking for EDGES
- 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();
}
}