This commit is contained in:
Gnieark 2016-07-11 21:04:16 +02:00
parent 7b9346cb6b
commit 9d2bb1fc03

View File

@ -5,5 +5,38 @@ class Direction
private static $bottom = 1;
private static $left = 2;
private static $right = 3;
private $value;
public function __construct(){
$this->value = 0;
}
public function __toString(){
switch ($this->value){
case Direction::$top:
return "y+";
break;
case Direction::$bottom:
return "y-";
break;
case Direction::$left:
return "x-";
break;
case Direction::$right:
return "x+";
break;
}
}
public function opposite(){
$opposites = array(
Direction::$top => Direction::$bottom,
Direction::$bottom => Direction::$top,
Direction::$left => Direction::$right,
Direction::$right => Direction::$left
);
$opposite = new Direction();
$opposite->value = $opposites[$this->value];
}
}