File "Singleton.php"

Full Path: /home/romayxjt/public_html/wp-content/plugins/fluentform/app/Services/Spout/Common/Singleton.php
File size: 706 bytes
MIME-type: text/x-php
Charset: utf-8

<?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 private function __wakeup() {}
    final private function __clone() {}
}