The method verifyTree() has an NPath complexity of 143616. The configured NPath complexity threshold is 200. Open
private function verifyTree(&$errors, $root = null)
{
$meta = $this->getClassMetadata();
$em = $this->getEntityManager();
$config = $this->listener->getConfiguration($em, $meta->name);
- 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 childrenQueryBuilder() has an NPath complexity of 210. The configured NPath complexity threshold is 200. Open
public function childrenQueryBuilder($node = null, $direct = false, $sortByField = null, $direction = 'ASC', $includeNode = false)
{
$meta = $this->getClassMetadata();
$config = $this->listener->getConfiguration($this->getEntityManager(), $meta->name);
- 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
Missing class import via use statement (line '292', column '27'). Open
throw new \InvalidArgumentException("Node is not related to this repository");
- 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
Missing class import via use statement (line '778', column '27'). Open
throw new \Gedmo\Exception\RuntimeException('Transaction failed', null, $e);
- 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
The method recover uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$count = 1;
foreach ($this->getChildren(null, true) as $root) {
$doRecover($root, $count);
}
- 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 getLeafsQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($meta->hasField($sortByField) && in_array(strtolower($direction), array('asc', 'desc'))) {
$qb->orderBy('node.'.$sortByField, $direction);
} else {
throw new InvalidArgumentException("Invalid sort options specified: field - {$sortByField}, direction - {$direction}");
- 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 getNextSiblingsQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$qb->andWhere($qb->expr()->isNull('node.'.$config['parent']));
}
- 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 '614', column '17'). Open
public function moveDown($node, $number = 1)
{
$result = false;
$meta = $this->getClassMetadata();
if ($node instanceof $meta->name) {
- 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 reorder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Node is not related to this repository");
}
- 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 moveDown uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Node is not related to this repository");
}
- 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 '1114', column '21'). Open
private function verifyTree(&$errors, $root = null)
{
$meta = $this->getClassMetadata();
$em = $this->getEntityManager();
$config = $this->listener->getConfiguration($em, $meta->name);
- 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 childrenQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$left = $wrapped->getPropertyValue($config['left']);
$right = $wrapped->getPropertyValue($config['right']);
if ($left && $right) {
$qb->where($qb->expr()->lt('node.'.$config['right'], $right));
- 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 getLeafsQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Invalid sort options specified: field - {$sortByField}, direction - {$direction}");
}
- 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 getPrevSiblingsQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$qb->andWhere($qb->expr()->isNull('node.'.$config['parent']));
}
- 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 verify uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->verifyTree($errors);
}
- 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 childrenQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($meta->hasField($sortByField) && in_array(strtolower($direction), array('asc', 'desc'))) {
$qb->orderBy('node.'.$sortByField, $direction);
} else {
throw new InvalidArgumentException("Invalid sort options specified: field - {$sortByField}, direction - {$direction}");
- 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 removeFromTree uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Node is not related to this repository");
}
- 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 removeFromTree uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$qb = $this->getQueryBuilder();
$qb->update($config['useObjectClass'], 'node');
$qb->set('node.'.$config['parent'], ':pid');
$qb->setParameter('pid', $parentId);
- 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 verifyTree uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$errors[] = "index [{$i}], duplicate".($root ? ' on tree root: '.$rootId : '');
}
- 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 getLeafsQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Node is not related to this repository");
}
- 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 childrenQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($direct) {
$qb->where($qb->expr()->isNull('node.'.$config['parent']));
}
}
- 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 verifyTree uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$qb = $this->getQueryBuilder();
$qb->select($qb->expr()->count('node.'.$identifier))
->from($config['useObjectClass'], 'node')
->where($qb->expr()->lt('node.'.$config['left'], $left))
- 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 '649', column '17'). Open
public function moveUp($node, $number = 1)
{
$result = false;
$meta = $this->getClassMetadata();
if ($node instanceof $meta->name) {
- 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 getRootNodesQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$qb->orderBy('node.'.$config['left'], 'ASC');
}
- 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 childrenQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new \InvalidArgumentException("Node is not related to this repository");
}
- 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 moveUp uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Node is not related to this repository");
}
- 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 childrenQueryBuilder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new InvalidArgumentException("Invalid sort options specified: field - {$sortByField}, direction - {$direction}");
}
- 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
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $parent
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $parent
- Exclude checks
Missing parameter name Open
* @param $sibling
- Exclude checks
Missing parameter name Open
* @param $node
- Exclude checks
Missing parameter name Open
* @param $sibling
- Exclude checks
Variable "__isInitialized__" is not in valid camel caps format Open
if ($parent instanceof Proxy && !$parent->__isInitialized__) {
- Exclude checks
Missing function doc comment Open
public function verifyNode($node)
- Exclude checks