Completed
Push — master ( 03fc7e...44f12a )
by Henry
15:26
created

includes/View/ResetForm.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace Redaxscript\View;
3
4
use Redaxscript\Html;
5
use Redaxscript\Module;
6
7
/**
8
 * children class to create the reset form
9
 *
10
 * @since 3.0.0
11
 *
12
 * @package Redaxscript
13
 * @category View
14
 * @author Henry Ruhs
15
 */
16
17
class ResetForm extends ViewAbstract
18
{
19
	/**
20
	 * render the view
21
	 *
22
	 * @since 3.0.0
23
	 *
24
	 * @return string
25
	 */
26
27 1
	public function render() : string
28
	{
29 1
		$output = Module\Hook::trigger('resetFormStart');
30
31
		/* html element */
32
33 1
		$titleElement = new Html\Element();
34
		$titleElement
35 1
			->init('h2',
36
			[
37 1
				'class' => 'rs-title-content'
38
			])
39 1
			->text($this->_language->get('password_reset'));
0 ignored issues
show
It seems like $this->_language->get('password_reset') 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...
40 1
		$formElement = new Html\Form($this->_registry, $this->_language);
41 1
		$formElement->init(
42
		[
43 1
			'form' =>
44
			[
45
				'class' => 'rs-js-validate rs-form-default rs-form-reset'
46
			],
47
			'button' =>
48
			[
49
				'submit' =>
50
				[
51 1
					'name' => get_class()
52
				]
53
			]
54
		],
55
		[
56 1
			'captcha' => 1
57
		]);
58
59
		/* create the form */
60
61
		$formElement
62 1
			->legend()
63 1
			->append('<li><ul>')
64 1
			->captcha('task')
65 1
			->append('</li></ul>')
66 1
			->hidden(
67
			[
68 1
				'name' => 'password',
69 1
				'value' => $this->_registry->get('thirdParameter')
70
			])
71 1
			->hidden(
72
			[
73 1
				'name' => 'id',
74 1
				'value' => $this->_registry->get('thirdSubParameter')
75
			])
76 1
			->captcha('solution')
77 1
			->token()
78 1
			->submit();
79
80
		/* collect output */
81
82 1
		$output .= $titleElement . $formElement;
83 1
		$output .= Module\Hook::trigger('resetFormEnd');
84 1
		return $output;
85
	}
86
}
87