listener   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 1
cbo 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 6 1
A __construct() 0 6 1
A page_header() 0 7 1
1
<?php
2
3
/**
4
*
5
* @package phpBB Extension - Paypal
6
* @copyright (c) 2015 tas2580 (https://tas2580.net)
7
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
8
*
9
*/
10
11
namespace tas2580\paypal\event;
12
13
/**
14
* @ignore
15
*/
16
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17
18
/**
19
* Event listener
20
*/
21
class listener implements EventSubscriberInterface
22
{
23
	static public function getSubscribedEvents()
0 ignored issues
show
Coding Style introduced by
As per PSR2, the static declaration should come after the visibility declaration.
Loading history...
24
	{
25
		return array(
26
			'core.page_header'		=> 'page_header',
27
		);
28
	}
29
30
	/** @var \phpbb\controller\helper */
31
	protected $helper;
32
33
	/** @var \phpbb\template\template */
34
	protected $template;
35
36
	/**@var \phpbb\user */
37
	protected $user;
38
39
	/**
40
	* Constructor
41
	*
42
	* @param \phpbb\controller\helper		$helper			Controller helper object
43
	* @param \phpbb\template				$template		Template object
44
	* @param \phpbb\user					$user			User object
45
	*/
46
	public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template, \phpbb\user $user)
47
	{
48
		$this->helper = $helper;
49
		$this->template = $template;
50
		$this->user = $user;
51
	}
52
53
	public function page_header()
54
	{
55
		$this->user->add_lang_ext('tas2580/paypal', 'link');
56
		$this->template->assign_vars(array(
57
			'U_PAYPAL'	=> $this->helper->route('tas2580_paypal_controller', array()),
58
		));
59
	}
60
}
61