public function startApp() { $lv = new LayoutView(); if ($this->LayoutView->userWantsToPlay()) { $gm = new GameModel($this->userDAL, $this->SessionManager); $this->View = new GameView($gm); if ($this->View->userChoseScissors()) { $result = $gm->playGame(choice::$scissors); } else { if ($this->View->userChosePaper()) { $result = $gm->playGame(choice::$paper); } else { if ($this->View->userChoseRock()) { $result = $gm->playGame(choice::$rock); } } } } else { $this->SessionManager->SessionUnsetGameSessions(); $loggedinUsername = $this->SessionManager->SessionGetLoggedInUser(); $userStats = $this->userDAL->getUserStats($loggedinUsername); $userProfilePic = $this->userDAL->getProfilePicUrl($loggedinUsername); $this->View = new StartView($userStats, $this->SessionManager, $userProfilePic); if ($this->View->userWantsToSubmitPic()) { if ($this->View->userPicUrlValid()) { $this->userDAL->changeUserPic($this->View->getPicUrlInput(), $loggedinUsername); $this->View->setImageChangeSuccessMessage(); } else { $this->View->setImageChangeFailureMessage(); } } else { if ($this->View->userChoseGameMode()) { $this->SessionManager->SessionRoundsToWin($this->View->getHowManyRoundsToBePlayed()); header("location:?game"); } } } return $this->View; }