BSTNode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 6
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\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
}