-
Notifications
You must be signed in to change notification settings - Fork 5
/
Aeria.php
executable file
·135 lines (122 loc) · 3.71 KB
/
Aeria.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
namespace Aeria;
use Aeria\Container\Container;
use Aeria\Container\Interfaces\ContainerInterface;
use Aeria\Config\ServiceProviders\ConfigProvider;
use Aeria\PostType\ServiceProviders\PostTypeProvider;
use Aeria\Taxonomy\ServiceProviders\TaxonomyProvider;
use Aeria\Field\ServiceProviders\FieldProvider;
use Aeria\Meta\ServiceProviders\MetaProvider;
use Aeria\OptionsPage\ServiceProviders\OptionsPageServiceProvider;
use Aeria\Kernel\ServiceProviders\KernelServiceProvider;
use Aeria\Action\ServiceProviders\ActionProvider;
use Aeria\Validator\ServiceProviders\ValidatorServiceProvider;
use Aeria\Router\ServiceProviders\RouterServiceProvider;
use Aeria\Query\ServiceProviders\QueryServiceProvider;
use Aeria\Updater\ServiceProviders\UpdaterServiceProvider;
use Aeria\Router\ServiceProviders\ControllerServiceProvider;
use Aeria\RenderEngine\ServiceProviders\RenderEngineServiceProvider;
/**
* Aeria is a lightweight and modular WP development tool.
*
* @category Action
*
* @author Caffeina Devs <[email protected]>
* @license https://github.com/caffeinalab/aeria/blob/master/LICENSE MIT license
*
* @see https://github.com/caffeinalab/aeria
*/
class Aeria extends Container
{
const VERSION = '3.2.17';
/**
* Constructs the Aeria container.
*
*
* @since Method available since Release 3.0.0
*/
public function __construct()
{
$this->registerBindings();
$this->registerServiceProviders();
}
/**
* Registers Aeria's bindings.
*
*
* @since Method available since Release 3.0.0
*/
protected function registerBindings()
{
static::setInstance($this);
$this->singleton('aeria', $this);
$this->bind(Container::class, $this);
}
/**
* Registers all the required ServiceProviders to the container.
*
*
* @since Method available since Release 3.0.0
*/
protected function registerServiceProviders() // : void
{
$this->register(new ConfigProvider());
$this->register(new PostTypeProvider());
$this->register(new TaxonomyProvider());
$this->register(new FieldProvider());
$this->register(new MetaProvider());
$this->register(new ActionProvider());
$this->register(new KernelServiceProvider());
$this->register(new ValidatorServiceProvider());
$this->register(new QueryServiceProvider());
$this->register(new RouterServiceProvider());
$this->register(new ControllerServiceProvider());
$this->register(new UpdaterServiceProvider());
$this->register(new OptionsPageServiceProvider());
$this->register(new RenderEngineServiceProvider());
}
/**
* Returns Aeria's version.
*
* @return string the version
*
* @since Method available since Release 3.0.0
*/
public static function version(): string
{
return self::VERSION;
}
/**
* Returns Aeria's instance.
*
* @return Aeria the instance
*
* @static
*
* @since Method available since Release 3.0.0
*/
public static function getInstance(): ContainerInterface
{
if (is_null(static::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
/**
* Sets Aeria's instance.
*
* @param ContainerInterface $container the container
*
* @return ContainerInterface the instance we've set
*
* @static
*
* @since Method available since Release 3.0.0
*/
public static function setInstance(
ContainerInterface $container
): ContainerInterface {
static::$instance = $container;
return static::$instance;
}
}