x = $x; $this->y = $y; $this->handleEmptyAisles(); $this->handleShiftLeft(); } private function handleEmptyAisles() { if($this->isSeatOnRightSideFloor()){ $this->decreaseY(); } if ($this->isSeatInHorizontalCenter()) { $this->decreaseX(); } else if ($this->isSeatInEmpore()) { $this->setAsEmporeSeat(); } } private function handleShiftLeft(){ if($this->x == 9){ $this->y -=2; }else if($this->x == 10){ $this->y -=4; }else if($this->x == 11){ $this->y -= 6; }else if($this->x == 12){ $this->y -= 8; }else if($this->x == 13){ $this->y -= 13; }else if($this->x == 'E1'){ $this->y-=4; }else if($this->x == 'E2'){ $this->y-=3; }else if($this->x == 'E3'){ $this->y-=6; }else if($this->x == 'E4'){ $this->y-=10; }else if($this->x =='E5'){ $this->y-=14; }else if($this->x =='E6'){ $this->y-=18; } } private function isSeatInHorizontalCenter() { return $this->x < 16 && $this->x > 7; } private function decreaseX() { $this->x--; } private function isSeatOnRightSideFloor() { return $this->y > 13 && $this->x < 16; } private function decreaseY() { $this->y--; } private function isSeatInEmpore() { return $this->x >= 16; } private function setAsEmporeSeat() { $this->x = $this->x - 17; $this->x = 'E' . $this->x; if($this->y >= 19){ $this->y -= 2; } } public function getText(){ if(substr($this->x,0,1) === "E") { return "Empore Reihe " . substr($this->x, 1) . ", Platz " . $this->y; }else{ return "Erdgeschoss Reihe ".$this->x.", Platz ".$this->y; } } }