PluginProbe
WP Job Manager / 2.4.4
WP Job Manager v2.4.4
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.11.0 1.11.1 1.12.0 1.12.1 1.13.0 1.14.0 1.15.0 All 154 releases
wp-job-manager / includes / trait-singleton.php
trait-singleton.php
39 lines 610 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Singleton trait.
4 *
5 * @package wp-job-manager-alerts
6 */
7
8 namespace WP_Job_Manager;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 trait Singleton {
15
16 /**
17 * The single instance of the class.
18 *
19 * @var self
20 */
21 private static $instance = null;
22
23 /**
24 * Allows for accessing single instance of class. Class should only be constructed once per call.
25 *
26 * @since 2.2.0
27 * @static
28 * @return self Main instance.
29 */
30 public static function instance() {
31 if ( is_null( self::$instance ) ) {
32 self::$instance = new self();
33 }
34
35 return self::$instance;
36 }
37
38 }
39