Completed
Push — master ( 8b656c...88d06e )
by Matt
14s
created

main_module::main()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 18
ccs 0
cts 9
cp 0
crap 2
rs 9.4285
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()
23
	{
24
		global $phpbb_container;
1 ignored issue
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
		/** @var \phpbb\admanagement\controller\admin_controller $admin_controller */
27
		$admin_controller = $phpbb_container->get('phpbb.admanagement.admin.controller');
28
29
		// Make the $u_action url available in the admin controller
30
		$admin_controller->set_page_url($this->u_action);
31
32
		// Load a template from adm/style for our ACP page
33
		$this->tpl_name = 'manage_ads';
34
35
		// Set the page title for our ACP page
36
		$this->page_title = $admin_controller->get_page_title();
37
38
		$admin_controller->main();
39
	}
40
}
41