AVLNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 4
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 5
1
<?php
2
/**
3
 * DataStructures for PHP
4
 *
5
 * @link      https://github.com/SiroDiaz/DataStructures
6
 * @copyright Copyright (c) 2017 Siro Díaz Palazón
7
 * @license   https://github.com/SiroDiaz/DataStructures/blob/master/README.md (MIT License)
8
 */
9
namespace DataStructures\Trees\Nodes;
10
11
use DataStructures\Trees\Nodes\BSTNode;
12
13
/**
14
 * AVLNode
15
 * 
16
 * AVLNode is the container class that represent a node inside a AVL tree.
17
 * It is like BST node but has an adicional attribute: height. Height is used
18
 * to know when to balance the AVL tree.
19
 *
20
 * @author Siro Diaz Palazon <[email protected]>
21
 */
22 View Code Duplication
class AVLNode extends BSTNode {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    public $height; // the node height
24
25
    public function __construct($key, $data, $parent = null, $left = null, $right = null) {
26
        parent::__construct($key, $data, $parent, $left, $right);
27
        $this->height = 0;
28
    }
29
}