public function __construct($key, $value, BinaryTree $left, BinaryTree $right) { $this->key = $key; $this->value = $value; $this->left = $left; $this->right = $right; $this->height = 1 + max($left->height(), $right->height()); }