Completed
Push — master ( 5f1ca1...a7b5ff )
by Henry
04:31
created

modules/Contact/Contact.php (1 issue)

Severity

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\Modules\Contact;
3
4
use Redaxscript\Module;
5
6
/**
7
 * dead simple contact form
8
 *
9
 * @since 4.0.0
10
 *
11
 * @package Redaxscript
12
 * @category Modules
13
 * @author Henry Ruhs
14
 */
15
16
class Contact extends Module\Module
17
{
18
	/**
19
	 * array of the module
20
	 *
21
	 * @var array
22
	 */
23
24
	protected static $_moduleArray =
25
	[
26
		'name' => 'Contact',
27
		'alias' => 'Contact',
28
		'author' => 'Redaxmedia',
29
		'description' => 'Dead simple contact form',
30
		'version' => '4.5.0',
31
		'license' => 'MIT'
32
	];
33
34
	/**
35
	 * routeHeader
36
	 *
37
	 * @since 4.0.0
38
	 */
39
40
	public function routeHeader() : void
41
	{
42
		if ($this->_request->getPost('Redaxscript\Modules\Contact\Form'))
43
		{
44
			$this->_request->set('routerBreak', true);
0 ignored issues
show
true is of type boolean, but the function expects a string|array|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45
		}
46
	}
47
48
	/**
49
	 * routeContent
50
	 *
51
	 * @since 4.0.0
52
	 */
53
54
	public function routeContent() : void
55
	{
56
		if ($this->_request->getPost('Redaxscript\Modules\Contact\Form'))
57
		{
58
			$controller = new Controller($this->_registry, $this->_request, $this->_language, $this->_config);
59
			echo $controller->process();
60
		}
61
	}
62
63
	/**
64
	 * render
65
	 *
66
	 * @since 4.0.0
67
	 *
68
	 * @return string
69
	 */
70
71
	public function render() : string
72
	{
73
		$form = new Form($this->_registry, $this->_language);
74
		return $form->render();
75
	}
76
}
77