forked from publishpress/PublishPress-Authors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFactory.php
54 lines (44 loc) · 1.09 KB
/
Factory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @package MultipleAuthors\
* @author PublishPress <[email protected]>
* @copyright Copyright (C) 2018 PublishPress. All rights reserved.
* @license GPLv2 or later
* @since 1.0.0
*/
namespace MultipleAuthors;
use MultipleAuthors\Classes\Legacy\LegacyPlugin;
defined('ABSPATH') or die('No direct script access allowed.');
if (!defined('MULTIPLE_AUTHORS_LOADED')) {
require_once __DIR__ . '/../../includes.php';
}
/**
* Class Factory
*/
abstract class Factory
{
/**
* @var Container
*/
protected static $container = null;
/**
* @return LegacyPlugin
*/
public static function getLegacyPlugin()
{
$container = self::get_container();
return $container['legacy_plugin'];
}
/**
* @return Container
*/
public static function get_container()
{
if (static::$container === null) {
$services = new Services();
static::$container = new Container();
static::$container->register($services);
}
return static::$container;
}
}