Overview

Namespaces

  • None
  • swag

Classes

  • H5pSwagifact
  • H5pUtil
  • SettingsPageController
  • ShortcodeUtil
  • swag\ArrayUtil
  • swag\Singleton
  • swag\WpUtil
  • SwagMapController
  • SwagPageController
  • Swagpath
  • SwagpathController
  • SwagpathSyncer
  • SwagPlugin
  • SwagPostItem
  • SwagTgmpaController
  • SwagTrack
  • SwagTrackController
  • SwagUser
  • Template
  • Xapi
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 
<?php

namespace swag;

/**
 * Singleton
 */
class Singleton {
    private static $instances=array();

    /**
     * Init.
     */
    public static function instance() {
        $class=get_called_class();

        if ($class=='swag\Singleton')
            throw new Exception("Singleton should not be used directly.");

        if (!isset(self::$instances[$class]))
            self::$instances[$class]=new $class;

        return self::$instances[$class];
    }
}
Swag API documentation generated by ApiGen