BSTNode   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 15
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
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\Interfaces\BinaryNodeInterface;
12
13
/**
14
 * BSTNode
15
 *
16
 * BSTNode Contains all attributes that represent the node for BST
17
 *
18
 * @author Siro Diaz Palazon <[email protected]>
19
 */
20
class BSTNode implements BinaryNodeInterface {
21
    public $key;    // key used to insert, remove and retrieve
22
    public $data;   // associated data
23
    public $parent; // the parent node
24
    public $left;   // left subtree
25
    public $right;  // right subtree
26
27
    public function __construct($key, $data, $parent = null, $left = null, $right = null) {
28
        $this->key = $key;
29
        $this->data = $data;
30
        $this->parent = $parent;
31
        $this->left = $left;
32
        $this->right = $right;
33
    }
34
}