# slider-blocks/1.0.0/includes/Traits/Singleton.php

GutSlider – All in One Slider and Carousel Blocks for Gutenberg, version 1.0.0. 23 lines.

- Page: https://pluginprobe.com/plugins/slider-blocks/1.0.0/code/includes/Traits/Singleton.php
- Raw: https://pluginprobe.com/plugins/slider-blocks/1.0.0/raw/includes/Traits/Singleton.php
- Modified: 2023-09-21T13:58:18+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/slider-blocks/1.0.0/code/includes/Traits/Singleton.php#L10-L20`.

```php
<?php
/**
 * Singleton Trait
 */
namespace GutSliders\Traits;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

trait Singleton {
    /**
     * Initialize the plugin
     */
    public static function init(){
        static $instance = false; 
        if( ! $instance ) {
            $instance = new self();
        }
        return $instance;
    }
}
```
