STRATO-apps/wordpress_03/app/wp-content/plugins/fluentform/app/Services/Spout/Common/Singleton.php

SHA-256: 48280423a41f7c01b29118374095e6452aa2bb8622e13c610afa768ada02cd79
<?php

namespace Box\Spout\Common;

/**
 * Class Singleton
 * Defines a class as a singleton.
 *
 * @package Box\Spout\Common
 */
trait Singleton
{
    protected static $instance;

    /**
     * @return static
     */
    final public static function getInstance()
    {
        return isset(static::$instance)
            ? static::$instance
            : static::$instance = new static;
    }

    /**
     * Singleton constructor.
     */
    final private function __construct()
    {
        $this->init();
    }

    /**
     * Initializes the singleton
     * @return void
     */
    protected function init() {}

    final public function __wakeup() {}
    final public function __clone() {}
}