Completed
Push — master ( 0ea243...da58d4 )
by Henry
10:25 queued 33s
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
 * 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' => 'Simple contact form',
30
		'version' => '4.0.0'
31
	];
32
33
	/**
34
	 * routeHeader
35
	 *
36
	 * @since 4.0.0
37
	 */
38
39
	public function routeHeader() : void
40
	{
41
		if ($this->_request->getPost('Redaxscript\Modules\Contact\Form'))
42
		{
43
			$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...
44
		}
45
	}
46
47
	/**
48
	 * routeContent
49
	 *
50
	 * @since 4.0.0
51
	 */
52
53
	public function routeContent() : void
54
	{
55
		if ($this->_request->getPost('Redaxscript\Modules\Contact\Form'))
56
		{
57
			$controller = new Controller($this->_registry, $this->_request, $this->_language, $this->_config);
58
			echo $controller->process();
59
		}
60
	}
61
62
	/**
63
	 * render
64
	 *
65
	 * @since 4.0.0
66
	 *
67
	 * @return string
68
	 */
69
70
	public function render() : string
71
	{
72
		$form = new Form($this->_registry, $this->_language);
73
		return $form->render();
74
	}
75
}
76