# fluentform/6.2.10/app/Services/Spout/Common/Singleton.php

Fluent Forms – Customizable Contact Forms, Survey, Quiz, &amp; Conversational Form Builder, version 6.2.10. 42 lines.

- Page: https://pluginprobe.com/plugins/fluentform/6.2.10/code/app/Services/Spout/Common/Singleton.php
- Raw: https://pluginprobe.com/plugins/fluentform/6.2.10/raw/app/Services/Spout/Common/Singleton.php
- Modified: 2025-09-23T11:23:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluentform/6.2.10/code/app/Services/Spout/Common/Singleton.php#L10-L20`.

```php
<?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() {}
}

```
