public static function init() { session_start(); if (!isset($_SESSION['username'])) { $login_view = new LoginView(); $login_view->init_view(); } else { echo 'Something went wrong'; } if (isset($_POST['username'])) { $login = new Login($_POST['username'], $_POST['password']); try { $login->data_processing(); } catch (Exception $ex) { echo 'Failed: ', $ex->getMessage(); } } }