public function run()
 {
     //Dependency injection
     $this->m_DatabaseConnection = new \DatabaseConnection();
     $this->m_Login = new model\LoginModel($this->m_DatabaseConnection);
     $this->v_Login = new view\LoginView($this->m_Login);
     $this->c_Login = new controller\LoginController($this->m_Login, $this->v_Login);
     $this->m_Registration = new model\RegistrationModel();
     $this->m_RegistrationDAL = new model\RegistrationDAL($this->m_DatabaseConnection);
     $this->v_Registration = new view\RegistrationView($this->m_Registration, $this->m_RegistrationDAL);
     $this->c_Registration = new controller\RegistrationController($this->v_Registration, $this->m_Registration, $this->m_RegistrationDAL);
     //Controller must be run first since state is changed
     if ($this->c_Registration->userWantToRegister()) {
         $viewToRender = $this->v_Registration;
         $this->registerNewUser = true;
         if ($this->c_Registration->userWantToRegisterNewUser()) {
             $this->c_Registration->doRegistration();
         }
     } else {
         $viewToRender = $this->v_Login;
         $this->c_Login->doControl();
         $this->loggedIn = $this->m_Login->isLoggedIn($this->v_Login->getUserClient());
     }
     //Generate output
     $v_DateTime = new view\DateTimeView();
     $v_Layout = new view\LayoutView();
     $v_Layout->render($this->registerNewUser, $this->loggedIn, $viewToRender, $v_DateTime);
 }
 /**
  * @throws \Exception
  */
 public function run()
 {
     try {
         if ($this->navView->userWantsToDoPubsAndBeers()) {
             $html = $this->doPub();
         } elseif ($this->navView->userWantsToDoAdmin()) {
             $html = $this->doAdmin();
         }
         $this->layoutView->render($html);
     } catch (\Exception $e) {
         error_log($e->getMessage() . "\n", 3, \Settings::ERROR_LOG);
         if (\Settings::DEBUG_MODE) {
             throw $e;
         } else {
             // show generic error view here
             echo $e->getMessage();
         }
     }
 }