*/ public function __construct($name, $gameCode, $action) { $this->init($name, $gameCode, $action); } public function init($name, $gameCode, $action) { // Shit, but it should work for now switch ($action) { case 'identify': $this->identify($name, $gameCode); break; default: echo "Action not found"; die(); } } protected function identify($name, $gameCode) { $this->findOrCreateGame($name, $gameCode); // $this->addUserToGame($name, $gameCode); } public function findOrCreateGame($name, $gameCode) { // For now always create a new game $this->game = $this->createGame($name, $gameCode); $this->showWelcome($gameCode); } public function showWelcome() { include "welcome.php"; } public function createGame($name, $gameCode) { return new Game($name, $gameCode); } }