PluginProbe
Presto Player / 3.0.0-beta1
Presto Player v3.0.0-beta1
4.5.0 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 All 126 releases
presto-player / inc / Core.php
Core.php
55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PrestoPlayer;
4
5 class Core
6 {
7 /**
8 * The singleton instance.
9 *
10 * @var Core
11 */
12 private static $instance;
13
14 /**
15 * Retrieves (and if necessary creates) the API instance. Should not be called outside of plugin set-up.
16 *
17 * @internal
18 *
19 * @since 1.0.0
20 *
21 * @param Core $instance Only used for plugin initialization. Don't ever pass a value in user code.
22 *
23 * @return void
24 *
25 * @throws \BadMethodCallException Thrown when Avatar_Privacy_Core::set_instance after plugin initialization.
26 */
27 public static function set_instance(Core $instance)
28 {
29 if (null === self::$instance) {
30 self::$instance = $instance;
31 } else {
32 // throw new \BadMethodCallException(__METHOD__ . ' called more than once.');
33 }
34 }
35
36
37 /**
38 * Retrieves the plugin instance.
39 *
40 * @since 1.0.0
41 *
42 * @throws \BadMethodCallException Thrown when Avatar_Privacy_Core::get_instance is called before plugin initialization.
43 *
44 * @return Core
45 */
46 public static function get_instance()
47 {
48 if (null === self::$instance) {
49 throw new \BadMethodCallException(__METHOD__ . ' called without prior plugin intialization.');
50 }
51
52 return self::$instance;
53 }
54 }
55