class-wpml-ls-dependencies-factory.php
3.37 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
class WPML_LS_Dependencies_Factory {
/* @var SitePress $sitepress */
private $sitepress;
/* @var array $parameters */
private $parameters;
/* @var WPML_LS_Templates $templates */
private $templates;
/* @var WPML_LS_Slot_Factory $slot_factory */
private $slot_factory;
/* @var WPML_LS_Settings $settings */
private $settings;
/* @var WPML_LS_Model_Build $model_build */
private $model_build;
/* @var WPML_LS_Inline_Styles $inline_styles */
private $inline_styles;
/* @var WPML_LS_Render $render */
private $render;
/* @var WPML_LS_Admin_UI $admin_ui */
private $admin_ui;
/** @var WPML_LS_Shortcodes */
private $shortcodes;
/** @var WPML_LS_Actions */
private $actions;
/**
* WPML_LS_Dependencies_Factory constructor.
*
* @param SitePress $sitepress
* @param array $parameters
*/
public function __construct( SitePress $sitepress, array $parameters = [] ) {
$this->sitepress = $sitepress;
$this->parameters = $parameters;
}
/**
* @return SitePress
*/
public function sitepress() {
return $this->sitepress;
}
/**
* @param string $key
*
* @return mixed
*/
public function parameter( $key ) {
return isset( $this->parameters[ $key ] ) ? $this->parameters[ $key ] : null;
}
/**
* @return WPML_LS_Templates
*/
public function templates() {
if ( ! $this->templates ) {
$this->templates = new WPML_LS_Templates();
}
return $this->templates;
}
/**
* @return WPML_LS_Slot_Factory
*/
public function slot_factory() {
if ( ! $this->slot_factory ) {
$this->slot_factory = new WPML_LS_Slot_Factory();
}
return $this->slot_factory;
}
/**
* @return WPML_LS_Settings
*/
public function settings() {
if ( ! $this->settings ) {
$this->settings = new WPML_LS_Settings( $this->templates(), $this->sitepress(), $this->slot_factory() );
}
return $this->settings;
}
/**
* @return WPML_LS_Model_Build
*/
public function model_build() {
if ( ! $this->model_build ) {
$this->model_build = new WPML_LS_Model_Build( $this->settings(), $this->sitepress(), $this->parameter( 'css_prefix' ) );
}
return $this->model_build;
}
/**
* @return WPML_LS_Inline_Styles
*/
public function inline_styles() {
if ( ! $this->inline_styles ) {
$this->inline_styles = new WPML_LS_Inline_Styles( $this->templates(), $this->settings(), $this->model_build() );
}
return $this->inline_styles;
}
/**
* @return WPML_LS_Render
*/
public function render() {
if ( ! $this->render ) {
$this->render = new WPML_LS_Render( $this->templates(), $this->settings(), $this->model_build(), $this->inline_styles(), $this->sitepress() );
}
return $this->render;
}
/**
* @return WPML_LS_Admin_UI
*/
public function admin_ui() {
if ( ! $this->admin_ui ) {
$this->admin_ui = new WPML_LS_Admin_UI( $this->templates(), $this->settings(), $this->render(), $this->inline_styles(), $this->sitepress() );
}
return $this->admin_ui;
}
/**
* @return WPML_LS_Shortcodes
*/
public function shortcodes() {
if ( ! $this->shortcodes ) {
$this->shortcodes = new WPML_LS_Shortcodes( $this->settings(), $this->render(), $this->sitepress() );
}
return $this->shortcodes;
}
/**
* @return WPML_LS_Shortcodes
*/
public function actions() {
if ( ! $this->actions ) {
$this->actions = new WPML_LS_Actions( $this->settings(), $this->render(), $this->sitepress() );
}
return $this->actions;
}
}