/**
  * Sets if cookie is defined to non-default theme.
  */
 public static function load_cookie()
 {
     $theme_name = filter_input(INPUT_COOKIE, self::get_cookie_name());
     if (!$theme_name) {
         return;
     }
     $theme = wp_get_theme($theme_name);
     if ($theme->exists() && $theme->get('Name') !== get_option('current_theme') && $theme->is_allowed()) {
         self::$theme = $theme;
     }
 }
<?php

/*
Plugin Name: Toolbar Theme Switcher
Plugin URI: https://github.com/Rarst/toolbar-theme-switcher
Description: Adds toolbar menu that allows users to switch theme for themselves.
Author: Andrey "Rarst" Savchenko
Version: 1.5
Author URI: http://www.rarst.net/
Text Domain: toolbar-theme-switcher
Domain Path: /lang
License: MIT
*/
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
Toolbar_Theme_Switcher::on_load();