PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.9.14
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.9.14
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / includes / Registry.php

Registry.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.9.14, at includes/Registry.php

63 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Global registry for WCPOS.
4 *
5 * - stores instances of classes that may be required to remove_action or remove_filter.
6 *
7 * @author Paul Kilmurray <paul@kilbot.com>
8 *
9 * @see https://wcpos.com
10 * @package WCPOS\WooCommercePOS
11 */
12
13 namespace WCPOS\WooCommercePOS;
14
15 /**
16 * Registry class.
17 */
18 class Registry {
19 /**
20 * Singleton instance.
21 *
22 * @var Registry
23 */
24 private static $instance = null;
25
26 /**
27 * Storage for the registry.
28 *
29 * @var array
30 */
31 private $storage = array();
32
33 /**
34 * Gets the singleton instance of the registry.
35 */
36 public static function get_instance() {
37 if ( null === self::$instance ) {
38 self::$instance = new self();
39 }
40
41 return self::$instance;
42 }
43
44 /**
45 * Registers a new instance.
46 *
47 * @param string $key The registry key.
48 * @param object $object The object to store.
49 */
50 public function set( $key, $object ): void {
51 $this->storage[ $key ] = $object;
52 }
53
54 /**
55 * Retrieves an instance by key.
56 *
57 * @param string $key The registry key.
58 */
59 public function get( $key ) {
60 return $this->storage[ $key ] ?? null;
61 }
62 }
63