PluginProbe
WP Coder – Insert & Manage Code Snippets / 4.1
WP Coder – Insert & Manage Code Snippets v4.1
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
wp-coder / classes / Publisher / Singleton.php

Singleton.php in WP Coder – Insert & Manage Code Snippets 4.1, at classes/Publisher/Singleton.php

28 lines 469 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPCoder\Publisher;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class Singleton {
8 private static $instance;
9 private array $value = [];
10
11 private function __construct() {}
12
13 public static function getInstance() {
14 if (null === static::$instance) {
15 static::$instance = new static();
16 }
17
18 return static::$instance;
19 }
20
21 public function setValue($key, $value) {
22 $this->value[$key] = $value;
23 }
24
25 public function getValue(): array {
26 return $this->value;
27 }
28 }