src/Chippyash/SAccounts/Accountant.php
Method buildTree
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function buildTree(Node $tree, \DOMNode $node, Chart $chart, array $accountTypes)
{
//create current node
list($nominal, $type, $name, $id) = FFor::create()
->attributes(function () use ($node) {
Avoid too many return
statements within this method. Open
Open
return new IntType($attributes->getNamedItem('id')->nodeValue);
The class Accountant has a coupling between objects value of 27. Consider to reduce the number of dependencies under 13. Open
Open
class Accountant
{
/**@+
* Error strings
*/
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '63', column '28'). Open
Open
return new \DOMXPath($dom);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid variables with short names like $id. Configured minimum length is 3. Open
Open
list($nominal, $type, $name, $id) = FFor::create()
- 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;
}
}
}