Passed
Push — master ( 807219...75274e )
by Aimeos
04:19
created

Standard::body()   A

Complexity

Conditions 3
Paths 9

Size

Total Lines 45
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 14
nc 9
nop 1
dl 0
loc 45
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2022
6
 * @package Client
7
 * @subpackage Html
8
 */
9
10
11
namespace Aimeos\Client\Html\Catalog\Count;
12
13
14
/**
15
 * Default implementation of catalog count HTML client.
16
 *
17
 * @package Client
18
 * @subpackage Html
19
 */
20
class Standard
21
	extends \Aimeos\Client\Html\Common\Client\Factory\Base
22
	implements \Aimeos\Client\Html\Common\Client\Factory\Iface
23
{
24
	/** client/html/catalog/count/subparts
25
	 * List of HTML sub-clients rendered within the catalog count section
26
	 *
27
	 * The output of the frontend is composed of the code generated by the HTML
28
	 * clients. Each HTML client can consist of serveral (or none) sub-clients
29
	 * that are responsible for rendering certain sub-parts of the output. The
30
	 * sub-clients can contain HTML clients themselves and therefore a
31
	 * hierarchical tree of HTML clients is composed. Each HTML client creates
32
	 * the output that is placed inside the container of its parent.
33
	 *
34
	 * At first, always the HTML code generated by the parent is printed, then
35
	 * the HTML code of its sub-clients. The order of the HTML sub-clients
36
	 * determines the order of the output of these sub-clients inside the parent
37
	 * container. If the configured list of clients is
38
	 *
39
	 *  array( "subclient1", "subclient2" )
40
	 *
41
	 * you can easily change the order of the output by reordering the subparts:
42
	 *
43
	 *  client/html/<clients>/subparts = array( "subclient1", "subclient2" )
44
	 *
45
	 * You can also remove one or more parts if they shouldn't be rendered:
46
	 *
47
	 *  client/html/<clients>/subparts = array( "subclient1" )
48
	 *
49
	 * As the clients only generates structural HTML, the layout defined via CSS
50
	 * should support adding, removing or reordering content by a fluid like
51
	 * design.
52
	 *
53
	 * @param array List of sub-client names
54
	 * @since 2014.03
55
	 */
56
	private $subPartPath = 'client/html/catalog/count/subparts';
57
58
	/** client/html/catalog/count/tree/name
59
	 * Name of the tree part used by the catalog count client implementation
60
	 *
61
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Tree\Myname".
62
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
63
	 *
64
	 * @param string Last part of the client class name
65
	 * @since 2014.03
66
	 */
67
68
	/** client/html/catalog/count/supplier/name
69
	 * Name of the supplier part used by the catalog count client implementation
70
	 *
71
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Attribute\Myname".
72
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
73
	 *
74
	 * @param string Last part of the client class name
75
	 * @since 2018.07
76
	 */
77
78
	/** client/html/catalog/count/attribute/name
79
	 * Name of the attribute part used by the catalog count client implementation
80
	 *
81
	 * Use "Myname" if your class is named "\Aimeos\Client\Html\Catalog\Count\Attribute\Myname".
82
	 * The name is case-sensitive and you should avoid camel case names like "MyName".
83
	 *
84
	 * @param string Last part of the client class name
85
	 * @since 2014.03
86
	 */
87
	private $subPartNames = ['tree', 'supplier', 'attribute'];
88
89
90
	/**
91
	 * Returns the sub-client given by its name.
92
	 *
93
	 * @param string $type Name of the client type
94
	 * @param string|null $name Name of the sub-client (Default if null)
95
	 * @return \Aimeos\Client\Html\Iface Sub-client object
96
	 */
97
	public function getSubClient( string $type, string $name = null ) : \Aimeos\Client\Html\Iface
98
	{
99
		/** client/html/catalog/count/decorators/excludes
100
		 * Excludes decorators added by the "common" option from the catalog count html client
101
		 *
102
		 * Decorators extend the functionality of a class by adding new aspects
103
		 * (e.g. log what is currently done), executing the methods of the underlying
104
		 * class only in certain conditions (e.g. only for logged in users) or
105
		 * modify what is returned to the caller.
106
		 *
107
		 * This option allows you to remove a decorator added via
108
		 * "client/html/common/decorators/default" before they are wrapped
109
		 * around the html client.
110
		 *
111
		 *  client/html/catalog/count/decorators/excludes = array( 'decorator1' )
112
		 *
113
		 * This would remove the decorator named "decorator1" from the list of
114
		 * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via
115
		 * "client/html/common/decorators/default" to the html client.
116
		 *
117
		 * @param array List of decorator names
118
		 * @since 2014.05
119
		 * @see client/html/common/decorators/default
120
		 * @see client/html/catalog/count/decorators/global
121
		 * @see client/html/catalog/count/decorators/local
122
		 */
123
124
		/** client/html/catalog/count/decorators/global
125
		 * Adds a list of globally available decorators only to the catalog count html client
126
		 *
127
		 * Decorators extend the functionality of a class by adding new aspects
128
		 * (e.g. log what is currently done), executing the methods of the underlying
129
		 * class only in certain conditions (e.g. only for logged in users) or
130
		 * modify what is returned to the caller.
131
		 *
132
		 * This option allows you to wrap global decorators
133
		 * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client.
134
		 *
135
		 *  client/html/catalog/count/decorators/global = array( 'decorator1' )
136
		 *
137
		 * This would add the decorator named "decorator1" defined by
138
		 * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client.
139
		 *
140
		 * @param array List of decorator names
141
		 * @since 2014.05
142
		 * @see client/html/common/decorators/default
143
		 * @see client/html/catalog/count/decorators/excludes
144
		 * @see client/html/catalog/count/decorators/local
145
		 */
146
147
		/** client/html/catalog/count/decorators/local
148
		 * Adds a list of local decorators only to the catalog count html client
149
		 *
150
		 * Decorators extend the functionality of a class by adding new aspects
151
		 * (e.g. log what is currently done), executing the methods of the underlying
152
		 * class only in certain conditions (e.g. only for logged in users) or
153
		 * modify what is returned to the caller.
154
		 *
155
		 * This option allows you to wrap local decorators
156
		 * ("\Aimeos\Client\Html\Catalog\Decorator\*") around the html client.
157
		 *
158
		 *  client/html/catalog/count/decorators/local = array( 'decorator2' )
159
		 *
160
		 * This would add the decorator named "decorator2" defined by
161
		 * "\Aimeos\Client\Html\Catalog\Decorator\Decorator2" only to the html client.
162
		 *
163
		 * @param array List of decorator names
164
		 * @since 2014.05
165
		 * @see client/html/common/decorators/default
166
		 * @see client/html/catalog/count/decorators/excludes
167
		 * @see client/html/catalog/count/decorators/global
168
		 */
169
170
		return $this->createSubClient( 'catalog/count/' . $type, $name );
171
	}
172
173
174
	/**
175
	 * Returns the list of sub-client names configured for the client.
176
	 *
177
	 * @return array List of HTML client names
178
	 */
179
	protected function getSubClientNames() : array
180
	{
181
		return $this->context()->config()->get( $this->subPartPath, $this->subPartNames );
182
	}
183
184
185
	/** client/html/catalog/count/template-body
186
	 * Relative path to the HTML body template of the catalog count client.
187
	 *
188
	 * The template file contains the HTML code and processing instructions
189
	 * to generate the result shown in the body of the frontend. The
190
	 * configuration string is the path to the template file relative
191
	 * to the templates directory (usually in client/html/templates).
192
	 *
193
	 * You can overwrite the template file configuration in extensions and
194
	 * provide alternative templates. These alternative templates should be
195
	 * named like the default one but suffixed by
196
	 * an unique name. You may use the name of your project for this. If
197
	 * you've implemented an alternative client class as well, it
198
	 * should be suffixed by the name of the new class.
199
	 *
200
	 * @param string Relative path to the template creating code for the HTML page body
201
	 * @since 2014.03
202
	 * @see client/html/catalog/count/template-header
203
	 */
204
205
	/** client/html/catalog/count/template-header
206
	 * Relative path to the HTML header template of the catalog count client.
207
	 *
208
	 * The template file contains the HTML code and processing instructions
209
	 * to generate the HTML code that is inserted into the HTML page header
210
	 * of the rendered page in the frontend. The configuration string is the
211
	 * path to the template file relative to the templates directory (usually
212
	 * in client/html/templates).
213
	 *
214
	 * You can overwrite the template file configuration in extensions and
215
	 * provide alternative templates. These alternative templates should be
216
	 * named like the default one but suffixed by
217
	 * an unique name. You may use the name of your project for this. If
218
	 * you've implemented an alternative client class as well, it
219
	 * should be suffixed by the name of the new class.
220
	 *
221
	 * @param string Relative path to the template creating code for the HTML page head
222
	 * @since 2014.03
223
	 * @see client/html/catalog/count/template-body
224
	 */
225
}
226