Contact   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 60
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A routeHeader() 0 7 2
A routeContent() 0 8 2
A render() 0 5 1
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.1.1'
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
Documentation introduced by redaxmedia
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