Completed
Push — development ( 2d042e...b2c933 )
by Dylan David
01:38
created

TreeNode   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 4
1
<?php
2
3
namespace Ptypes;
4
5
use Ptypes\Exceptions\InvalidArgument;
6
7
class TreeNode
8
{
9
	public $data;
10
	public $value;
11
	public $left;
12
	public $right;
13
	
14
	public function __construct($value, $data=null)
15
	{
16
		if(gettype($value) != "integer" && gettype($value) != "int" && gettype($value) != "double")
17
		{
18
			throw new InvalidArgument("Expected a number, got: " . gettype($value) . "!");
19
		}
20
		$this->value = $value;
21
		$this->data = $data;
22
		$this->left = null;
23
		$this->right = null;
24
	}
25
}