Panel   A
last analyzed

Complexity

Total Complexity 35

Size/Duplication

Total Lines 596
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Test Coverage

Coverage 98.21%

Importance

Changes 0
Metric Value
wmc 35
lcom 1
cbo 7
dl 0
loc 596
ccs 219
cts 223
cp 0.9821
rs 9.6
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
B render() 0 43 6
F _hasPermission() 0 46 11
B _renderContent() 0 86 4
B _renderAccess() 0 84 4
B _renderSystem() 0 71 4
A _renderProfile() 0 28 1
B _renderNotification() 0 64 3
A _renderLogout() 0 27 1
1
<?php
2
namespace Redaxscript\Admin\View\Helper;
3
4
use Redaxscript\Admin;
5
use Redaxscript\Html;
6
use Redaxscript\Module;
7
use Redaxscript\Validator;
8
use function array_key_exists;
9
use function array_replace_recursive;
10
11
/**
12
 * helper class to create the admin panel
13
 *
14
 * @since 4.0.0
15
 *
16
 * @package Redaxscript
17
 * @category View
18
 * @author Henry Ruhs
19
 */
20
21
class Panel extends Admin\View\ViewAbstract
22
{
23
	/**
24
	 * options of the panel
25
	 *
26
	 * @var array
27
	 */
28
29
	protected $_optionArray =
30
	[
31
		'className' =>
32
		[
33
			'list' =>
34
			[
35
				'panel' => 'rs-admin-fn-dropdown rs-admin-list-panel',
36
				'content' => 'rs-admin-fn-content-panel rs-admin-list-panel-children',
37
				'access' => 'rs-admin-fn-content-panel rs-admin-list-panel-children',
38
				'system' => 'rs-admin-fn-content-panel rs-admin-list-panel-children',
39
				'notification' => 'rs-admin-fn-content-panel rs-admin-list-panel-children rs-admin-list-notification'
40
			],
41
			'item' =>
42
			[
43
				'content' => 'rs-admin-item-panel',
44
				'access' => 'rs-admin-item-panel',
45
				'system' => 'rs-admin-item-panel',
46
				'profile' => 'rs-admin-item-panel',
47
				'notification' => 'rs-admin-item-panel',
48
				'logout' => 'rs-admin-item-panel rs-admin-item-panel-logout'
49
			],
50
			'link' =>
51
			[
52
				'view' => 'rs-admin-link-panel rs-admin-link-panel-view',
53
				'new' => 'rs-admin-link-panel rs-admin-link-panel-new',
54
				'system' => 'rs-admin-link-panel rs-admin-link-panel-system',
55
				'profile' => 'rs-admin-link-panel rs-admin-link-panel-profile',
56
				'logout' => 'rs-admin-link-panel rs-admin-link-panel-logout'
57
			],
58
			'label' =>
59
			[
60
				'content' => 'rs-admin-fn-toggle-panel rs-admin-label-panel rs-admin-label-panel-content',
61
				'access' => 'rs-admin-fn-toggle-panel rs-admin-label-panel rs-admin-label-panel-access',
62
				'system' => 'rs-admin-fn-toggle-panel rs-admin-label-panel rs-admin-label-panel-system',
63
				'notification' => 'rs-admin-fn-toggle-panel rs-admin-label-panel rs-admin-label-panel-notification'
64
			],
65
			'note' =>
66
			[
67
				'success' => 'rs-admin-is-success',
68
				'warning' => 'rs-admin-is-warning',
69
				'error' => 'rs-admin-is-error',
70
				'info' => 'rs-admin-is-info'
71
			],
72
			'text' => 'rs-admin-text-panel-group',
73
			'input' => 'rs-admin-fn-status-panel',
74
			'sup' => 'rs-admin-sup-panel-notification'
75
		]
76
	];
77
78
	/**
79
	 * init the class
80
	 *
81
	 * @since 4.0.0
82
	 *
83
	 * @param array $optionArray options of the panel
84
	 *
85
	 * @return self
86 8
	 */
87
88 8
	public function init(array $optionArray = []) : self
89 8
	{
90
		$this->_optionArray = array_replace_recursive($this->_optionArray, $optionArray);
91
		return $this;
92
	}
93
94
	/**
95
	 * render the view
96
	 *
97
	 * @since 4.0.0
98
	 *
99 8
	 * @return string
100
	 */
101 8
102 8
	public function render() : string
103
	{
104
		$output = Module\Hook::trigger('adminPanelStart');
105
		$outputItem = null;
106 8
107 8
		/* html element */
108
109 8
		$listElement = new Html\Element();
110
		$listElement->init('ul',
111
		[
112
			'class' => $this->_optionArray['className']['list']['panel']
113
		]);
114 8
115
		/* collect item output */
116 2
117
		if ($this->_hasPermission('contents'))
118 8
		{
119
			$outputItem .= $this->_renderContent();
120 2
		}
121
		if ($this->_hasPermission('access'))
122 8
		{
123
			$outputItem .= $this->_renderAccess();
124 1
		}
125
		if ($this->_hasPermission('system'))
126 8
		{
127
			$outputItem .= $this->_renderSystem();
128 1
		}
129
		if ($this->_hasPermission('profile'))
130 8
		{
131
			$outputItem .= $this->_renderProfile();
132 1
		}
133
		if ($this->_hasPermission('notification'))
134 8
		{
135
			$outputItem .= $this->_renderNotification();
136
		}
137
		$outputItem .= $this->_renderLogout();
138 8
139 8
		/* collect output */
140 8
141
		$output .= $listElement->append($outputItem);
142
		$output .= Module\Hook::trigger('adminPanelEnd');
143
		return $output;
144
	}
145
146
	/**
147
	 * has the permission
148
	 *
149
	 * @since 4.0.0
150
	 *
151
	 * @param string $type
152
	 *
153 8
	 * @return bool
154
	 */
155 8
156 8
	protected function _hasPermission(string $type = null) : bool
157 8
	{
158
		$permissionArray = [];
159 2
		$accessValidator = new Validator\Access();
160
		if ($this->_registry->get('categoriesEdit'))
161 8
		{
162
			$permissionArray['categories'] = $permissionArray['contents'] = true;
163
		}
164
		if ($this->_registry->get('articlesEdit'))
165 8
		{
166
			$permissionArray['articles'] = $permissionArray['contents'] = true;
167
		}
168
		if ($this->_registry->get('extrasEdit'))
169 8
		{
170
			$permissionArray['extras'] = $permissionArray['contents'] = true;
171
		}
172
		if ($this->_registry->get('commentsEdit'))
173 8
		{
174
			$permissionArray['comments'] = $permissionArray['contents'] = true;
175 2
		}
176
		if ($this->_registry->get('usersEdit'))
177 8
		{
178
			$permissionArray['users'] = $permissionArray['access'] = true;
179
		}
180
		if ($this->_registry->get('groupsEdit'))
181 8
		{
182
			$permissionArray['groups'] = $permissionArray['access'] = true;
183 1
		}
184
		if ($this->_registry->get('modulesEdit'))
185 8
		{
186
			$permissionArray['modules'] = $permissionArray['system'] = true;
187 1
		}
188
		if ($this->_registry->get('settingsEdit'))
189 8
		{
190
			$permissionArray['settings'] = $permissionArray['system'] = true;
191 1
		}
192
		if ($this->_registry->get('myId'))
193 8
		{
194
			$permissionArray['profile'] = true;
195 1
		}
196
		if ($accessValidator->validate(1, $this->_registry->get('myGroups')))
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_registry->get('myGroups') targeting Redaxscript\Registry::get() can also be of type array; however, Redaxscript\Validator\Access::validate() does only seem to accept null|string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
197 8
		{
198
			$permissionArray['notification'] = true;
199
		}
200
		return array_key_exists($type, $permissionArray);
201
	}
202
203
	/**
204
	 * render the content
205
	 *
206
	 * @since 4.0.0
207
	 *
208 2
	 * @return string|null
209
	 */
210 2
211 2
	protected function _renderContent() : ?string
212
	{
213
		$output = null;
214 2
		$parameterRoute = $this->_registry->get('parameterRoute');
215
		$contentArray =
216
		[
217
			'categories',
218
			'articles',
219
			'extras',
220
			'comments'
221
		];
222 2
223
		/* html element */
224 2
225 2
		$element = new Html\Element();
226
		$listElement = $element
227 2
			->copy()
228
			->init('ul',
229 2
			[
230 2
				'class' => $this->_optionArray['className']['list']['content']
231
			]);
232 2
		$itemElement = $element->copy()->init('li');
233 2
		$linkElement = $element->copy()->init('a');
234
		$textElement = $element
235 2
			->copy()
236
			->init('span',
237
			[
238 2
				'class' => $this->_optionArray['className']['text']
239 2
			]);
240
		$labelElement = $element
241 2
			->copy()
242
			->init('label',
243
			[
244 2
				'class' => $this->_optionArray['className']['label']['content'],
245
				'for' => self::class . '\Content'
246 2
			])
247 2
			->text($this->_language->get('contents'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('contents') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
248
		$inputElement = $element
249 2
			->copy()
250 2
			->init('input',
251 2
			[
252
				'id' => self::class . '\Content',
253
				'class' => $this->_optionArray['className']['input'],
254
				'type' => 'radio',
255
				'name' => self::class . '\Panel'
256
			]);
257 2
258
		/* process contents */
259 2
260 2
		foreach ($contentArray as $type)
261
		{
262 2
			$tableNew = $this->_registry->get($type . 'New');
263
			if ($this->_hasPermission($type))
264 2
			{
265 2
				$listElement->append(
266
					$itemElement
267 2
						->copy()
268 2
						->html(
269
							$textElement
270 2
								->copy()
271 2
								->append(
272 2
									$linkElement
273 2
										->copy()
274
										->addClass($this->_optionArray['className']['link']['view'])
275 2
										->attr('href', $parameterRoute . 'admin/view/' . $type)
276 1
										->text($this->_language->get($type))
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get($type) targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
277 1
								)
278 1
								->append($tableNew ? $linkElement
0 ignored issues
show
Bug introduced by redaxmedia
It seems like $tableNew ? $linkElement...age->get('new')) : null can also be of type object<Redaxscript\Html\Element>; however, Redaxscript\Html\HtmlAbstract::append() does only seem to accept null|string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
279 2
									->copy()
280
									->addClass($this->_optionArray['className']['link']['new'])
281
									->attr('href', $parameterRoute . 'admin/new/' . $type)
282
									->text($this->_language->get('new')) : null
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('new') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
283
								)
284
						)
285
				);
286
			}
287
		}
288
289 2
		/* collect output */
290 2
291 2
		$output .= $itemElement
292 2
			->copy()
293
			->addClass($this->_optionArray['className']['item']['content'])
294
			->html($inputElement . $labelElement . $listElement);
295
		return $output;
296
	}
297
298
	/**
299
	 * render the access
300
	 *
301
	 * @since 4.0.0
302
	 *
303 2
	 * @return string|null
304
	 */
305 2
306 2
	protected function _renderAccess() : ?string
307
	{
308
		$output = null;
309 2
		$parameterRoute = $this->_registry->get('parameterRoute');
310
		$accessArray =
311
		[
312
			'users',
313
			'groups'
314
		];
315 2
316
		/* html element */
317 2
318 2
		$element = new Html\Element();
319
		$listElement = $element
320 2
			->copy()
321
			->init('ul',
322 2
			[
323 2
				'class' => $this->_optionArray['className']['list']['access']
324
			]);
325 2
		$itemElement = $element->copy()->init('li');
326 2
		$linkElement = $element->copy()->init('a');
327
		$textElement = $element
328 2
			->copy()
329
			->init('span',
330
			[
331 2
				'class' => $this->_optionArray['className']['text']
332 2
			]);
333
		$labelElement = $element
334 2
			->copy()
335
			->init('label',
336
			[
337 2
				'class' => $this->_optionArray['className']['label']['access'],
338
				'for' => self::class . '\Access'
339 2
			])
340 2
			->text($this->_language->get('access'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('access') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
341
		$inputElement = $element
342 2
			->copy()
343 2
			->init('input',
344 2
			[
345
				'id' => self::class . '\Access',
346
				'class' => $this->_optionArray['className']['input'],
347
				'type' => 'radio',
348
				'name' => self::class . '\Panel'
349
			]);
350 2
351
		/* process access */
352 2
353 2
		foreach ($accessArray as $type)
354
		{
355 2
			$tableNew = $this->_registry->get($type . 'New');
356
			if ($this->_hasPermission($type))
357 2
			{
358 2
				$listElement->append(
359
					$itemElement
360 2
						->copy()
361 2
						->html(
362
							$textElement
363 2
								->copy()
364 2
								->append(
365 2
									$linkElement
366 2
										->copy()
367
										->addClass($this->_optionArray['className']['link']['view'])
368 2
										->attr('href', $parameterRoute . 'admin/view/' . $type)
369 1
										->text($this->_language->get($type))
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get($type) targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
370 1
								)
371 1
								->append($tableNew ? $linkElement
0 ignored issues
show
Bug introduced by redaxmedia
It seems like $tableNew ? $linkElement...age->get('new')) : null can also be of type object<Redaxscript\Html\Element>; however, Redaxscript\Html\HtmlAbstract::append() does only seem to accept null|string, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
372 2
									->copy()
373
									->addClass($this->_optionArray['className']['link']['new'])
374
									->attr('href', $parameterRoute . 'admin/new/' . $type)
375
									->text($this->_language->get('new')) : null
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('new') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
376
								)
377
						)
378
				);
379
			}
380
		}
381
382 2
		/* collect output */
383 2
384 2
		$output .= $itemElement
385 2
			->copy()
386
			->addClass($this->_optionArray['className']['item']['access'])
387
			->html($inputElement . $labelElement . $listElement);
388
		return $output;
389
	}
390
391
	/**
392
	 * render the system
393
	 *
394
	 * @since 4.0.0
395
	 *
396 1
	 * @return string|null
397
	 */
398 1
399 1
	protected function _renderSystem() : ?string
400
	{
401
		$output = null;
402 1
		$parameterRoute = $this->_registry->get('parameterRoute');
403
		$systemArray =
404
		[
405
			'modules',
406
			'settings'
407
		];
408 1
409
		/* html element */
410 1
411 1
		$element = new Html\Element();
412
		$listElement = $element
413 1
			->copy()
414
			->init('ul',
415 1
			[
416
				'class' => $this->_optionArray['className']['list']['system']
417 1
			]);
418 1
		$itemElement = $element->copy()->init('li');
419
		$linkElement = $element
420 1
			->copy()
421
			->init('a',
422
			[
423 1
				'class' => $this->_optionArray['className']['link']['system'],
424 1
			]);
425
		$labelElement = $element
426 1
			->copy()
427
			->init('label',
428
			[
429 1
				'class' => $this->_optionArray['className']['label']['system'],
430
				'for' => self::class . '\System'
431 1
			])
432 1
			->text($this->_language->get('system'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('system') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
433
		$inputElement = $element
434 1
			->copy()
435 1
			->init('input',
436 1
			[
437
				'id' => self::class . '\System',
438
				'class' => $this->_optionArray['className']['input'],
439
				'type' => 'radio',
440
				'name' => self::class . '\Panel'
441
			]);
442 1
443
		/* process system */
444 1
445
		foreach ($systemArray as $type)
446 1
		{
447
			if ($this->_hasPermission($type))
448 1
			{
449 1
				$listElement->append(
450
					$itemElement
451 1
						->copy()
452 1
						->html(
453 1
							$linkElement
454
								->copy()
455
								->attr('href', $type === 'settings' ? $parameterRoute . 'admin/edit/settings' : $parameterRoute . 'admin/view/' . $type)
456
								->text($this->_language->get($type))
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get($type) targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
457
						)
458
				);
459
			}
460
		}
461
462 1
		/* collect output */
463 1
464 1
		$output .= $itemElement
465 1
			->copy()
466
			->addClass($this->_optionArray['className']['item']['system'])
467
			->html($inputElement . $labelElement . $listElement);
468
		return $output;
469
	}
470
471
	/**
472
	 * render the profile
473
	 *
474
	 * @since 4.0.0
475
	 *
476 1
	 * @return string
477
	 */
478 1
479 1
	protected function _renderProfile() : string
480
	{
481
		$parameterRoute = $this->_registry->get('parameterRoute');
482
		$myId = $this->_registry->get('myId');
483 1
484
		/* html element */
485 1
486 1
		$element = new Html\Element();
487
		$itemElement = $element
488 1
			->copy()
489
			->init('li',
490
			[
491 1
				'class' => $this->_optionArray['className']['item']['profile']
492 1
			]);
493
		$linkElement = $element
494 1
			->copy()
495 1
			->init('a',
496
			[
497 1
				'href' => $parameterRoute . 'admin/edit/users/' . $myId,
498
				'class' => $this->_optionArray['className']['link']['profile']
499
			])
500
			->text($this->_language->get('profile'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('profile') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
501 1
502 1
		/* collect item output */
503
504
		$output = $itemElement->html($linkElement);
505
		return $output;
506
	}
507
508
	/**
509
	 * render the notification
510
	 *
511
	 * @since 4.0.0
512
	 *
513 1
	 * @return string|null
514
	 */
515 1
516 1
	protected function _renderNotification() : ?string
517 1
	{
518
		$output = null;
519
		$adminNotification = new Notification($this->_language);
520
		$adminNotification->init(
521 1
		[
522
			'className' =>
523
			[
524 1
				'list' => $this->_optionArray['className']['list']['notification']
525
			]
526
		]);
527
		$metaArray = $adminNotification->getMetaArray();
528 1
529
		/* html element */
530 1
531 1
		$element = new Html\Element();
532
		$itemElement = $element
533 1
			->copy()
534
			->init('li',
535
			[
536 1
				'class' => $this->_optionArray['className']['item']['notification']
537 1
			]);
538
		$labelElement = $element
539 1
			->copy()
540
			->init('label',
541
			[
542 1
				'class' => $this->_optionArray['className']['label']['notification'],
543
				'for' => self::class . '\Notification'
544 1
			])
545 1
			->text($this->_language->get('notification'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('notification') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
546
		$inputElement = $element
547 1
			->copy()
548 1
			->init('input',
549 1
			[
550
				'id' => self::class . '\Notification',
551 1
				'class' => $this->_optionArray['className']['input'],
552
				'type' => 'radio',
553
				'name' => self::class . '\Panel',
554 1
				'checked' => 'checked'
555 1
			]);
556
		$supElement = $element
557 1
			->copy()
558
			->init('sup',
559 1
			[
560
				'class' => $this->_optionArray['className']['sup']
561
			])
562
			->text($metaArray['total']);
563 1
564
		/* process meta */
565 1
566
		foreach ($metaArray as $key => $value)
567 1
		{
568
			$supElement->addClass($this->_optionArray['className']['note'][$key]);
569
		}
570
		$labelElement->append($supElement);
571 1
572
		/* collect item output */
573 1
574
		if ($metaArray['total'])
575 1
		{
576
			$output = $itemElement->html($inputElement . $labelElement . $adminNotification->render());
577
		}
578
		return $output;
579
	}
580
581
	/**
582
	 * render the logout
583
	 *
584
	 * @since 4.0.0
585
	 *
586 8
	 * @return string
587
	 */
588 8
589
	protected function _renderLogout() : string
590
	{
591
		$parameterRoute = $this->_registry->get('parameterRoute');
592 8
593
		/* html element */
594 8
595 8
		$element = new Html\Element();
596
		$itemElement = $element
597 8
			->copy()
598
			->init('li',
599
			[
600 8
				'class' => $this->_optionArray['className']['item']['logout']
601 8
			]);
602
		$linkElement = $element
603 8
			->copy()
604 8
			->init('a',
605
			[
606 8
				'href' => $parameterRoute . 'logout',
607
				'class' => $this->_optionArray['className']['link']['logout']
608
			])
609
			->text($this->_language->get('logout'));
0 ignored issues
show
Bug introduced by Henry Ruhs
It seems like $this->_language->get('logout') targeting Redaxscript\Language::get() can also be of type array; however, Redaxscript\Html\Element::text() does only seem to accept string|integer|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
610 8
611 8
		/* collect item output */
612
613
		$output = $itemElement->html($linkElement);
614
		return $output;
615
	}
616
}
617