1.2.722. More Than One Level Of Indentation¶
According to PHP Object Calisthenics, one level of indentation is sufficient.
It helps to abide by the Single Responsibility rule and increase reuse.
<?php
class foo {
function multipleLevels($array) {
$return = array();
foreach($array as $b) {
// This is a second level of indentation
if ($this->check($b)) { continue; }
$return[] = $b;
}
return $return;
}
function oneLevel($array) {
$return = array_filter($array, array($this, 'check'));
return $return;
}
}
?>
1.2.722.1. Connex PHP features¶
1.2.722.1.1. Specs¶
Short name |
Structures/OneLevelOfIndentation |
Rulesets |
|
Exakat since |
0.8.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Slow (1 hour) |
Precision |
Very high |
Available in |