public function invalidate(string $api_session = null)
    {
        if (empty($api_session) === false && is_string($api_session) === true) {
            $session = Model\Session::where('code', $api_session)->first();
            if ($session !== null) {
                $session->delete();
            }
        } elseif (empty($_SESSION['api_session']) === false && is_string($_SESSION['api_session']) === true) {
            $session = Model\Session::where('code', $_SESSION['api_session'])->first();
            if ($session !== null) {
                $session->delete();
            }
        } elseif (empty($_GET['api_session']) === false && is_string($_GET['api_session']) === true) {
            $session = Model\Session::where('code', $_GET['api_session'])->first();
            if ($session !== null) {
                $session->delete();
            }
        }
        $this->details = false;
        $_SESSION['api_session'] = null;
        $_GET['api_session'] = null;
    }