# wp-coder/4.5/classes/Publisher/Singleton.php

WP Coder – Insert &amp; Manage Code Snippets, version 4.5. 28 lines.

- Page: https://pluginprobe.com/plugins/wp-coder/4.5/code/classes/Publisher/Singleton.php
- Raw: https://pluginprobe.com/plugins/wp-coder/4.5/raw/classes/Publisher/Singleton.php
- Modified: 2026-02-14T05:39:58+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/wp-coder/4.5/code/classes/Publisher/Singleton.php#L10-L20`.

```php
<?php

namespace WPCoder\Publisher;

defined( 'ABSPATH' ) || exit;

class Singleton {
	private static $instance;
	private array $value = [];

	private function __construct() {}

	public static function getInstance() {
		if (null === static::$instance) {
			static::$instance = new static();
		}

		return static::$instance;
	}

	public function setValue($key, $value) {
		$this->value[$key] = $value;
	}

	public function getValue(): array {
		return $this->value;
	}
}
```
