mirror of
https://github.com/TheAlgorithms/PHP.git
synced 2025-07-09 19:16:19 +02:00
44 lines
741 B
PHP
44 lines
741 B
PHP
<?php
|
|
|
|
namespace DataStructures\InvertBinaryTree;
|
|
|
|
class BinaryTree
|
|
{
|
|
private ?BinaryTree $left = null;
|
|
private ?BinaryTree $right = null;
|
|
private $value;
|
|
|
|
public function setLeft(?BinaryTree $left)
|
|
{
|
|
$this->left = $left;
|
|
return $this;
|
|
}
|
|
|
|
public function getLeft(): ?BinaryTree
|
|
{
|
|
return $this->left;
|
|
}
|
|
|
|
public function setRight(?BinaryTree $right)
|
|
{
|
|
$this->right = $right;
|
|
return $this;
|
|
}
|
|
|
|
public function getRight(): ?BinaryTree
|
|
{
|
|
return $this->right;
|
|
}
|
|
|
|
public function setValue($value)
|
|
{
|
|
$this->value = $value;
|
|
return $this;
|
|
}
|
|
|
|
public function getValue()
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|