Completed
Push — master ( 3ef6ac...8b656c )
by Matt
11s
created

main_module   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 33
ccs 0
cts 21
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B main() 0 26 3
1
<?php
2
/**
3
 *
4
 * Advertisement management. An extension for the phpBB Forum Software package.
5
 *
6
 * @copyright (c) 2017 phpBB Limited <https://www.phpbb.com>
7
 * @license GNU General Public License, version 2 (GPL-2.0)
8
 *
9
 */
10
11
namespace phpbb\admanagement\acp;
12
13
/**
14
 * Advertisement management ACP module.
15
 */
16
class main_module
17
{
18
	public $page_title;
19
	public $tpl_name;
20
	public $u_action;
21
22
	public function main($id, $mode)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $mode is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
	{
24
		global $config, $request, $template, $user;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
25
26
		$user->add_lang_ext('phpbb/admanagement', 'common');
27
		$this->tpl_name = 'acp_admanagement';
28
		$this->page_title = $user->lang('ACP_ADMANAGEMENT_TITLE');
29
		add_form_key('phpbb/admanagement');
30
31
		if ($request->is_set_post('submit'))
32
		{
33
			if (!check_form_key('phpbb/admanagement'))
34
			{
35
				trigger_error('FORM_INVALID', E_USER_WARNING);
36
			}
37
38
			$config->set('acme_demo_goodbye', $request->variable('acme_demo_goodbye', 0));
39
40
			trigger_error($user->lang('ACP_DEMO_SETTING_SAVED') . adm_back_link($this->u_action));
41
		}
42
43
		$template->assign_vars(array(
44
			'U_ACTION'				=> $this->u_action,
45
			'ACME_DEMO_GOODBYE'		=> $config['acme_demo_goodbye'],
46
		));
47
	}
48
}
49